File tree Expand file tree Collapse file tree
integration-tests/docker/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ func (e *LogEntry) UnmarshalJSON(data []byte) error {
5353 return nil
5454 }
5555
56+ // Query responses use a object in the third array element, for example:
57+ // ["<ts>", "<line>", {"structuredMetadata": {...}}]
58+ // See https://github.com/grafana/loki/blob/5f06abe88d1a5cb7df12cfd2e07808c9d3238312/pkg/loghttp/entry.go#L63-L73
59+ // Because we always use this to unmashal query response we don't have to handle the flat map case.
5660 var metadata struct {
5761 StructuredMetadata map [string ]string `json:"structuredMetadata"`
5862 }
@@ -62,10 +66,8 @@ func (e *LogEntry) UnmarshalJSON(data []byte) error {
6266
6367 if len (metadata .StructuredMetadata ) > 0 {
6468 e .Metadata .StructuredMetadata = metadata .StructuredMetadata
65- return nil
6669 }
67-
68- return json .Unmarshal (raw [2 ], & e .Metadata .StructuredMetadata )
70+ return nil
6971}
7072
7173func (m * LogResponse ) Unmarshal (data []byte ) error {
You can’t perform that action at this time.
0 commit comments