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

[exporter/loki] Auto convert OpenTelemetry ResourceAttributes to log labels #19215

Closed
fkalinowski opened this issue Mar 6, 2023 · 29 comments
Closed
Labels
enhancement New feature or request exporter/loki Loki Exporter Stale

Comments

@fkalinowski
Copy link

Component(s)

exporter/loki

Is your feature request related to a problem? Please describe.

The Resource Attributes are very interesting to use as labels in the log events.

With the current implementation, I need to declare an explicit mapping in my collector's configuration for each Resource Attribute. This approach requires to reconfigure my opentelemetry-collector each time an application introduces a new Resource Attribute (available in SemConv or not).

Moreover due to #14113 I need to declare each ResourceAttribute twice - which can be tedious.

Describe the solution you'd like

Since Loki's backend is largely inspired by the Prometheus backend (Loki uses Mimir implementation of Prometheus compliant backend), that seems natural to apply the same constraint and have the same feature sets than exporter/prometheusremotewriteexporter.

That would be great if the feature resource_to_telemetry_conversion could be ported into the lokiexporter.

Describe alternatives you've considered

No response

Additional context

@gouthamve #14113 (comment)

@fkalinowski fkalinowski added enhancement New feature or request needs triage New item requiring triage labels Mar 6, 2023
@github-actions github-actions bot added the exporter/loki Loki Exporter label Mar 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2023

Pinging code owners:

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

@atoulme atoulme removed the needs triage New item requiring triage label Mar 7, 2023
@jpkrohling
Copy link
Member

cc @mar4uk

@mar4uk
Copy link
Contributor

mar4uk commented Apr 3, 2023

I think we can go for it. Adding resource_to_telemetry_conversion will also solve another issue #2290

So basically, if users trust their downstream configurations and keep the number of resource attributes minimal, we can allow users to promote that attributes to labels automatically. The fact that we have resource_to_telemetry_conversion for exporter/prometheusremotewriteexporter makes adding the same option to loki exporter nice to have.

We can add a warning to the description of this option in README: use with cautions since a high number of resource attributes can lead to high cardinality that will affect exploring such logs performance in Loki

@kovrus, @gouthamve

@github-actions
Copy link
Contributor

github-actions bot commented Jun 5, 2023

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

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

@github-actions github-actions bot added the Stale label Jun 5, 2023
@mar4uk
Copy link
Contributor

mar4uk commented Jun 6, 2023

let's keep this issue for a little bit longer

@github-actions github-actions bot removed the Stale label Jun 7, 2023
@kago-dk
Copy link

kago-dk commented Jul 18, 2023

Were you still planning to implement resource_to_telemetry_conversion in the Loki Exporter?

@mar4uk
Copy link
Contributor

mar4uk commented Jul 24, 2023

Yes, it would be good to have

@github-actions
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

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

@github-actions github-actions bot added the Stale label Sep 25, 2023
@mar4uk
Copy link
Contributor

mar4uk commented Sep 25, 2023

still relevant

@jpkrohling jpkrohling removed the Stale label Sep 25, 2023
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

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

@github-actions github-actions bot added the Stale label Nov 27, 2023
@sathieu
Copy link

sathieu commented Nov 27, 2023

This issue is still relevant.

But another road will be possible in the next loki version: https://grafana.com/docs/loki/next/send-data/otel/

@github-actions github-actions bot removed the Stale label Nov 28, 2023
Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

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

@github-actions github-actions bot added the Stale label Jan 29, 2024
@jpkrohling jpkrohling removed the Stale label Feb 2, 2024
@jpkrohling
Copy link
Member

@sandeepsukhani, do we have a logic like that already on the Loki side?

@sandeepsukhani
Copy link
Contributor

sandeepsukhani commented Feb 7, 2024

@sandeepsukhani, do we have a logic like that already on the Loki side?

Hey @jpkrohling, we have this logic documented. The code for converting otlp format to loki format can be found here.

@jpkrohling
Copy link
Member

@mar4uk, do you think the logic can be reused?

@mar4uk
Copy link
Contributor

mar4uk commented Feb 13, 2024

I think so.
The logic could be like this: if resource_to_telemetry_conversion is set to true then we convert the same list of resource attributes as the native Loki OTLP endpoint does https://grafana.com/docs/loki/next/send-data/otel/#format-considerations to labels:

  • cloud.availability_zone
  • cloud.region
  • container.name
  • deployment.environment
  • k8s.cluster.name
  • k8s.container.name
  • k8s.cronjob.name
  • k8s.daemonset.name
  • k8s.deployment.name
  • k8s.job.name
  • k8s.namespace.name
  • k8s.pod.name
  • k8s.replicaset.name
  • k8s.statefulset.name
  • service.instance.id
  • service.name
  • service.namespace

All the rest resource attributes will be sent as structured metadata. Does it sound good?

@jpkrohling
Copy link
Member

Yes, sounds good to me!

@mhulscher
Copy link

mhulscher commented Feb 15, 2024

I found this issue because I am also looking to store attributes as structured metadata. After the seeing the (static) list of converted attributes I was a little skeptical of the proposed solution. However, the docs clearly mention that it will be possible to extend or even replace this list. That would be amazing!

Edit: for example, host.name is missing from the list. Which would be a useful label to have if you are collecting telemetry from a VM!

@mk-raven
Copy link

Also interesting about this issue.
Any updates?

@crutonjohn
Copy link

this is a feature i'd like as well. been spending hours and hours trying to get otelcol to send "native" loki labels. a plug-and-play option would be awesome.

@jpkrohling
Copy link
Member

@mhulscher , @mk-raven , @crutonjohn , given that Loki 3.0 supports OTLP natively, I'm interested in knowing whether you still see the need for the Loki exporter.

@mk-raven
Copy link

@jpkrohling hello! We needed this exporter because some service, use loki api for store telemetry data in Clickhouse DB.
There are products like qryn, oteldb and other could integrate loki api for natively support logs querying in Grafana UI. Without manage custom plugins. Its great feature for many companies and teams.

@jpkrohling
Copy link
Member

qryn, oteldb

A quick look into both makes me believe they support OTLP natively as well.

@mk-raven
Copy link

Its true, but Grafana UI doesn't support query in otlp format. Its has Clickhouse plugin, but for many people its hard to using. Better use natively LogQL, PromQL and TraceQL

@jpkrohling
Copy link
Member

Better use natively LogQL, PromQL and TraceQL

Ingesting data in OTLP doesn't mean you have to query data in OTLP (even if there was one query language for OTLP). You should still be able to send data in via OTLP and query them via LogQL, as we do with Grafana Cloud :-)

@mk-raven
Copy link

But from otlp logs there no query filters in Grafana, if You use LogQL and Loki datasource.

@jpkrohling
Copy link
Member

It's certainly possible to use LogQL to query a Loki data source containing logs that were ingested via OTLP.

Copy link
Contributor

github-actions bot commented Jul 8, 2024

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

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

@github-actions github-actions bot added the Stale label Jul 8, 2024
@jpkrohling
Copy link
Member

I'm closing, as the Loki exporter will be deprecated soon and this won't likely be sorted out on that component.

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

No branches or pull requests

10 participants