diff --git a/packages/grafana-ui/src/components/Logs/LogLabels.test.tsx b/packages/grafana-ui/src/components/Logs/LogLabels.test.tsx index acbf2ef7ae8..eaee962f963 100644 --- a/packages/grafana-ui/src/components/Logs/LogLabels.test.tsx +++ b/packages/grafana-ui/src/components/Logs/LogLabels.test.tsx @@ -20,4 +20,9 @@ describe('', () => { expect(wrapper.text()).not.toContain('42'); expect(wrapper.text()).not.toContain('13'); }); + it('excludes labels with empty string values', () => { + const wrapper = shallow(); + expect(wrapper.text()).toContain('bar'); + expect(wrapper.html()).not.toContain('baz'); + }); }); diff --git a/packages/grafana-ui/src/components/Logs/LogLabels.tsx b/packages/grafana-ui/src/components/Logs/LogLabels.tsx index ab21a2cfd02..1f40f0abfe7 100644 --- a/packages/grafana-ui/src/components/Logs/LogLabels.tsx +++ b/packages/grafana-ui/src/components/Logs/LogLabels.tsx @@ -59,6 +59,9 @@ export const UnThemedLogLabels: FunctionComponent = ({ labels, theme }) = {displayLabels.sort().map(label => { const value = labels[label]; + if (!value) { + return; + } const tooltip = `${label}: ${value}`; return (