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

Routing Processor is always Routing to default exporter when receiver is oltp http #20913

Closed
shahrajesh2006 opened this issue Apr 17, 2023 · 7 comments · Fixed by #21726
Closed
Labels
bug Something isn't working processor/routing Routing processor

Comments

@shahrajesh2006
Copy link

shahrajesh2006 commented Apr 17, 2023

Component(s)

processor/routing

What happened?

Description

Routing Processor is routing to default exporter when the receiver is oltp http.

Steps to Reproduce

See the below configuration of routing processor

-------------------
receivers:
  otlp:
    protocols:
      http:
        endpoint: "0.0.0.0:8443"
exporters:
  logging:
    loglevel: debug
  otlp:
    endpoint: https://xyz.com/
    headers:
      api-key: $API_KEY_1
    compression: gzip
  otlp/one:
    endpoint: https://xyz.com/
    headers:
      api-key: $API_KEY_2
    compression: gzip
  otlp/two:
    endpoint: https://xyz.com/
    headers:
      api-key: $API_KEY_3
    compression: gzip
processors:
  routing:
    from_attribute: otel-exporter-lob
    default_exporters:
    - logging
    - otlp
    table:
    - value: one
      exporters: [logging, otlp/one]
    - value: two
      exporters: [logging, otlp/two]
extensions:
  health_check:
    endpoint: "0.0.0.0:8080"
  pprof:
  zpages:
    endpoint: "0.0.0.0:11400"
service:
  telemetry:
    logs:
      level: "debug"
  extensions: [pprof, zpages, health_check]
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [logging, otlp, otlp/one, otlp/two]
      processors: [routing]
    metrics:
      receivers: [otlp]
      exporters: [logging, otlp, otlp/one, otlp/two]
      processors: [routing]
---------------------------------

Routing process is ignoring http header"otel-exporter-lob" values "one/two" and always routes to default exporters.

Expected Result

When the http header "otel-exporter-lob" is "one" route to following exporters
exporters: [logging, otlp/one]

When the http header "otel-exporter-lob" is "two" route to following exporters
exporters: [logging, otlp/two]

Actual Result

Routing process is ignoring http header"otel-exporter-lob" values "one/two" and always routes to default exporters.

Collector version

latest

Environment information

Environment

OS: Amazon Linux
Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

receivers:
  otlp:
    protocols:
      http:
        endpoint: "0.0.0.0:8443"
exporters:
  logging:
    loglevel: debug
  otlp:
    endpoint: https://xyz.com
    headers:
      api-key: $API_KEY_1
    compression: gzip
  otlp/one:
    endpoint: https://xyz.com
    headers:
      api-key: $API_KEY_2
    compression: gzip
  otlp/two:
    endpoint: https://xyz.com
    headers:
      api-key: $API_KEY_3
    compression: gzip
processors:
  routing:
    from_attribute: otel-exporter-lob
    default_exporters:
    - logging
    - otlp
    table:
    - value: one
      exporters: [logging, otlp/one]
    - value: two
      exporters: [logging, otlp/two]
extensions:
  health_check:
    endpoint: "0.0.0.0:8080"
  pprof:
  zpages:
    endpoint: "0.0.0.0:11400"
service:
  telemetry:
    logs:
      level: "debug"
  extensions: [pprof, zpages, health_check]
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [logging, otlp, otlp/one, otlp/two]
      processors: [routing]
    metrics:
      receivers: [otlp]
      exporters: [logging, otlp, otlp/one, otlp/two]
      processors: [routing]

Log output

No relevant log

Additional context

Router works when the the receiver is using "oltp" grpc protocol

@shahrajesh2006 shahrajesh2006 added bug Something isn't working needs triage New item requiring triage labels Apr 17, 2023
@github-actions github-actions bot added the processor/routing Routing processor label Apr 17, 2023
@github-actions
Copy link
Contributor

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 Apr 17, 2023
@kovrus kovrus removed the bug Something isn't working label Apr 24, 2023
@kovrus
Copy link
Member

kovrus commented Apr 24, 2023

You need to provide the following configuration for the otlp receiver, that should fix your configuration

     otlp:
       protocols:
         http:
           endpoint: "0.0.0.0:8443"
           include_metadata: true

@shahrajesh2006
Copy link
Author

ok let me try that - Thanks @kovrus

@shahrajesh2006
Copy link
Author

@kovrus - Even after updating config as suggested above. I still see routing to default value.

@kovrus kovrus added the bug Something isn't working label Apr 25, 2023
@akats7
Copy link
Contributor

akats7 commented May 8, 2023

Hi @jpkrohling, it looks like in the current state the processor does not support http metadata that is not from the grpc server, would you accept a PR to add this functionality. We can still default to the default grpc extraction using the grpc metadata module and then in the case that it does not return anything try to extract it from client.Info.

@shahrajesh2006
Copy link
Author

@atoulme @kovrus @akats7 tagging couple of more folks to this discussion thread.

@jpkrohling
Copy link
Member

Thank you for the PR. The direction is good, just need one more test.

jpkrohling pushed a commit that referenced this issue Jul 13, 2023
**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
Hi all,

This enables the processor to perform context based routing for payloads
that are received on the http server of the otlp receiver. It defaults
to the original grpc metadata extraction but if it is not able to
extract the grpc metadata, it will then attempt to extract it from
client.Info. Currently the routing processor will always use the default
route if the payload was received through the http server.

**Link to tracking Issue:** <Issue number if applicable>
resolves #20913 
**Testing:** <Describe what testing was performed and which tests were
added.>
Added test cases for traces, metrics and logs to includes testing
context based routing when the metadata is in client.Info
**Documentation:** <Describe the documentation added.>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working processor/routing Routing processor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants