mirror of https://github.com/grafana/loki
Categorized Labels: Return empty JSON object if no parsed nor structured metadata labels (#11325)
This is a followup PR for https://github.com/grafana/loki/pull/10419 wrt this comment https://github.com/grafana/loki/pull/10419#discussion_r1406285386. If there is no parsed nor structured-metadata labels in a given entry, and the categorize-labels header is set, add an empty object to the entry array. For example, we currently return: ```json { "data": { "encodingFlags": [ "categorize-labels" ], "result": [ { "stream": { "agent": "promtail", "filename": "/var/log/nginx/json_access.log", "host": "appfelstrudel", "job": "nginx_access_log" }, "values": [ [ "1701096036028751750", "example line" ] ] } ] } } ``` But we want: ```json { "data": { "encodingFlags": [ "categorize-labels" ], "result": [ { "stream": { "agent": "promtail", "filename": "/var/log/nginx/json_access.log", "host": "appfelstrudel", "job": "nginx_access_log" }, "values": [ [ "1701096036028751750", "example line", {} <<<--- WE WANT THIS ] ] } ] } } ```pull/11094/head^2
parent
bd505f8e2d
commit
10210b884c
Loading…
Reference in new issue