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

Cannot put traceid & spanid like loki labes #33202

Closed
RaulGF92 opened this issue May 23, 2024 · 2 comments
Closed

Cannot put traceid & spanid like loki labes #33202

RaulGF92 opened this issue May 23, 2024 · 2 comments
Assignees
Labels
exporter/loki Loki Exporter

Comments

@RaulGF92
Copy link

Component(s)

exporter/loki

Describe the issue you're reporting

Previous PR related:

Really I don't know if is a error or really that is solved and we can put traceid like labels but sure documentation is not well explained and a refactor of this could be beneficial.

Explanation of my stack:

I have a full open-telemetry stack

image

When I tried to send my logs that works but I want to put traceid & spanid in my loki.labels for work in a raw format and put the labels I want to search without fight with json format.

That is my configuration otel-configuration (I remove all aditional configuration for free space):

receivers:
  otlp:
    protocols:
      grpc:
      http:

exporters:
  loki:
    endpoint: http://loki:3100/loki/api/v1/push
    tls:
      insecure: true
    default_labels_enabled:
      exporter: false
      job: true

processors:
  attributes:
    actions:
      - action: insert
        key: loki.format
        value: json
      - action: insert
        key: loki.attribute.labels
        value: traceid
  resource:
    attributes:
      - action: insert
        key: loki.resource.labels
        value: record.traceid


service:
  pipelines:
    logs:
      receivers:  [ otlp ]
      processors: [ attributes, resource]
      exporters:  [ loki ]

That error happen in all formats (json, raw, logfmt) when you tried to put traceid like a label that don't let you also loki don't see this like a label:

image

@RaulGF92 RaulGF92 added the needs triage New item requiring triage label May 23, 2024
@github-actions github-actions bot added the exporter/loki Loki Exporter label May 23, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@jpkrohling jpkrohling self-assigned this May 27, 2024
@jpkrohling jpkrohling removed the needs triage New item requiring triage label May 27, 2024
@jpkrohling
Copy link
Member

Loki labels are indexed and should be kept to low-cardinality attributes. Trace ID and Span ID aren't a good fit for this, which is why they are placed in the body instead. This means that you can still query for them after parsing the body (with json or logfmt parsers), but you'd need to reduce the amount of data being queries by first using a low-cardinality value from a label, like service name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exporter/loki Loki Exporter
Projects
None yet
Development

No branches or pull requests

2 participants