Skip to content

Help to config otel colletor to send traces to different newrelic account based on attibute value #38791

Closed
@sambestsolutions

Description

@sambestsolutions

Component(s)

No response

Describe the issue you're reporting

HI

I want to configure the OpenTelemetry (OTel) Collector to send traces to different New Relic accounts based on the value of the tenantId attribute.

For example, if tenantId="t0001", the trace should be sent to one New Relic account, and if tenantId="t0002", it should be sent to another New Relic account. If neither of these values is present, the trace should be sent to a default third New Relic account.

I tried to achieve this using the routing processor, but all traces ended up in every account.

Can someone provide the correct configuration and specify which OTel Collector version I should use for this?

Below is the config I used for this purpose

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318
        cors:
          allowed_origins:
            - http://*:5080


processors:
  batch: {}
  routing:
    from_attribute: tenantId
    default_exporters: [otlphttp/newrelic3]
    table:
    - value: t0001
      exporters: [otlphttp]
    - value: t0002
      exporters: [otlphttp/newrelic2]


exporters:
  debug:
    verbosity: detailed
    sampling_initial: 5
    sampling_thereafter: 200

  otlphttp:
    endpoint: https://otlp.nr-data.net:4317
    headers:
      api-key: 

  otlphttp/newrelic2:
    endpoint: https://otlp.nr-data.net:4317
    headers:
      api-key: 
  
  otlphttp/newrelic3:
    endpoint: https://otlp.nr-data.net:4317
    headers:
      api-key: 

service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [debug, otlphttp, otlphttp/newrelic2, otlphttp/newrelic3]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions