Skip to content

Component donation: exporter/lgtmexporter #46744

@matt-gp

Description

@matt-gp

Building and distributing outside this repository

  • I understand I can use and distribute my component outside of this repository.

Existing component implementation

https://github.com/matt-gp/lgtmexporter

Components covering similar use cases

  • extensions/headerssetterextension - Allows you to set static headers or headers using values from contexts or attributes returned from authentication. You can then forward to LGTM using the oltp exporter. However this does not apply the header value from the Resource Attributes.

The purpose and use-cases of the component

Grafana LGTM is a multi-tenant platform that stores Logs (Loki), Metrics (Mimir) and Traces (Tempo), which can then be visualised in Grafana. The method to read/write data is by providing a header (default X-Scope-OrgID) with the tenant id.

LGTM Exporter allows you to forward to Grafana LGTM using a resource attribute as the tenant id. This means that you can run a Collector as a gateway and forward multiple tenants data.

A real life example would be:

  • You run a multi-tenant k8s cluster where each tenant gets a namespace.
  • You would then collect logs/metrics/traces and apply the namespace as a resource attribute via relabelling.
  • You would then configure the LGTM Exporter to use this namespace resource attribute as the tenant id.
  • Then each tenant would then have their own data isolated from others in LGTM.

Example configuration for the component

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317

processors:
  batch:

exporters:
  lgtm:
    logs:
      endpoint: http://loki:3100/otlp/v1/logs
      timeout: 30s
      tls:
        insecure: true
    metrics:
      endpoint: http://mimir:8080/otlp/v1/metrics
      timeout: 30s
      tls:
        insecure: true
    traces:
      endpoint: http://tempo:3200/v1/traces
      timeout: 30s
      tls:
        insecure: true
    tenant:
      label: tenant.id
      labels:
        - tenant_id
        - tenantID
        - tenantId
      header: X-Scope-OrgID
      format: "%s-dev"
      default: default
    content_type: protobuf
    retry_on_failure:
      enabled: true
      initial_interval: 5s
      max_interval: 30s
    sending_queue:
      enabled: true
      num_consumers: 10
      queue_size: 1000

service:
  pipelines:
    logs:
      receivers: [otlp]
      processors: [batch]
      exporters: [lgtm]
    metrics:
      receivers: [otlp]
      processors: [batch]
      exporters: [lgtm]
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [lgtm]

Telemetry data types supported

traces, metrics, logs

Code Owners

matt-gp

Sponsor (optional)

No response

Additional context

Previously to do this I would use https://github.com/matt-gp/otel-lgtm-proxy and run it as a sidecar.

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Sponsor NeededNew component seeking sponsor

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions