Skip to content

fix: force to string to satisfy loki api#48

Merged
Julien-R44 merged 4 commits intoJulien-R44:devfrom
chaintng:force-to-strings
Dec 14, 2025
Merged

fix: force to string to satisfy loki api#48
Julien-R44 merged 4 commits intoJulien-R44:devfrom
chaintng:force-to-strings

Conversation

@chaintng
Copy link
Copy Markdown
Contributor

@chaintng chaintng commented Sep 8, 2025

image

Reproduce

Input any non string value in metadata key

logger.info({ meta: { statusCode: 200 } }, "Loki support only string in structured metadata")

Error

loghttp.PushRequest.Streams: []loghttp.LogProtoStream: unmarshalerDecoder: Value is string, but can't find closing '"' symbol, error found in #10 byte of ...|e":200}]]}]}|..., bigger context ...|ring in structured metadata",{"statusCode":200}]]}]}|...

Based on this document
https://grafana.com/docs/loki/latest/reference/loki-http-api/#ingest-logs

The JSON object must be a valid JSON object with string keys and string values. The JSON object should not contain any nested object. The JSON object must be set immediately after the log line.

I think it's better to transform to string for user instead of leave it error

@Julien-R44
Copy link
Copy Markdown
Owner

Thanks !

@Julien-R44 Julien-R44 merged commit 6f69d02 into Julien-R44:dev Dec 14, 2025
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants