Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for actual structured metadata #255

Open
oliver-unifii opened this issue Mar 6, 2024 · 1 comment
Open

Add support for actual structured metadata #255

oliver-unifii opened this issue Mar 6, 2024 · 1 comment
Labels
enhancement New feature or request investigation needed The investigation is needed
Milestone

Comments

@oliver-unifii
Copy link

It appears this library doesn't actually support structured logging, instead it formats log lines into nested JSON message and then relies on json parser within loki to allow filtering.

As per Loki HTTP documentation to add structured logs one can append them as last item to log line array: https://grafana.com/docs/loki/latest/reference/api/#push-log-entries-to-loki

That will produce structured metadata as per https://grafana.com/docs/loki/latest/get-started/labels/structured-metadata/

Looking through the sourcecode it seems this library only serialises timestamp and message:

Entries.Add(new[] {timestamp.ToUnixNanosecondsString(), entry});

@mishamyte
Copy link
Member

Hi,

You define what properties of log entry should be added as labels with propertiesAsLabels setting.
Other data as you mentioned is serialized as a JSON and relies on JSON parser for querying.
That was the concept over time to avoid the high cardinality problems, but give the possibility to query the data.

The concept of structured metadata was added later and it's a good extension point IMO.

For now I see the conceptual point to be solved:

  • Should it be added to V8
  • Design the architectural part & API (give the user possibility to define the metadata fields etc)
  • Ensure it will be a valid payload for older Loki version (or get the default optional configuration)

@mishamyte mishamyte added enhancement New feature or request investigation needed The investigation is needed labels Mar 6, 2024
@mishamyte mishamyte added this to the Backlog milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request investigation needed The investigation is needed
Development

No branches or pull requests

2 participants