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

Added routing exporter #1611

Closed

Conversation

jpkrohling
Copy link
Member

@jpkrohling jpkrohling commented Aug 21, 2020

This PR depends on #1609, or a similar solution that will deliver all available exporters as part of host.GetExporters.

While I believe this is still in draft mode, I would like to validate the direction this is going.

Open points to discuss:

  • what to do when an exporter fails?
  • I left processors out for now, as it's probably more complex than exporters, given that there are no host.GetProcessors
  • I still need to do a complete e2e manual test
  • this includes only traces for now. Once the idea is validated, I'll implement the same for the other exporter types.

Signed-off-by: Juraci Paixão Kröhling [email protected]

@jpkrohling
Copy link
Member Author

cc @tigrannajaryan, @jrcamp, as you were involved in the discussion for #1260.

@jpkrohling jpkrohling force-pushed the jpkrohling/issue1260 branch 2 times, most recently from 4115bf6 to d45723c Compare August 21, 2020 15:48
@jpkrohling
Copy link
Member Author

Manually tested with the following config:

receivers:
  otlp/acme:
    protocols:
      grpc:
        endpoint: localhost:55680
  jaeger:
    protocols:
      thrift_compact:

processors:

exporters:
  logging: {}

  jaeger/default:
    endpoint: localhost:24250
    insecure: true

  otlp/acme:
    endpoint: localhost:55680
    insecure: true
    headers:
      "x-tenant": "acme"
  jaeger/acme:
    endpoint: localhost:14250
    insecure: true

  routing:
    from_attribute: X-Tenant
    default_exporters: jaeger/default
    table:
    - value: acme
      exporters: [jaeger/acme]

service:
  pipelines:
    traces:
      receivers: [jaeger]
      processors: []
      exporters: [logging, otlp/acme]

    traces/multitenant:
      receivers: [otlp/acme]
      processors: []
      exporters: [logging, routing]

    traces/routing:
      exporters:
      - jaeger/default
      - jaeger/acme

The jaeger-acme instance was started on my laptop (bare metal) as:

go run ./cmd/all-in-one --query.static-files ./jaeger-ui/packages/jaeger-ui/build --processor.jaeger-compact.server-host-port :16831 --log-level=debug

The jaeger-default instance was started in a container, as:

podman run -p 24250:14250 -p 26686:16686 jaegertracing/all-in-one --log-level=debug

When the x-tenant header in the otlp/acme exporter is set to acme, the traces arrive correctly at jaeger/acme (bare metal). When the x-tenant is set to globex, it arrives at jaeger/default (container).

@jpkrohling
Copy link
Member Author

As @tigrannajaryan and @jrcamp might be too busy, would you be able to review this one, @bogdandrutu, @dmitryax ?

Copy link
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The confusing part to me is the reference to the context. The end user likely knows nothing or very little about the context propagated inside the Collector. We need to make it much more clearer for the user to understand this.

I would also add this component to the contrib repo for now. If there is evidence that this is essential in the Collector we can then move it to the core repo.

exporter/routingexporter/routing.go Outdated Show resolved Hide resolved
exporter/routingexporter/README.md Outdated Show resolved Hide resolved
exporter/routingexporter/README.md Outdated Show resolved Hide resolved
exporter/routingexporter/README.md Outdated Show resolved Hide resolved
@tigrannajaryan tigrannajaryan self-assigned this Aug 26, 2020
@tigrannajaryan tigrannajaryan added this to In progress in Collector Aug 27, 2020
@tigrannajaryan tigrannajaryan moved this from In progress to Review in progress in Collector Aug 27, 2020
@jpkrohling
Copy link
Member Author

As this depends on #1609, this PR is blocked waiting on a resolution for that. Once a decision there is made, I'll work on the review comments and on the pending items from this PR's description.

@jpkrohling
Copy link
Member Author

I would also add this component to the contrib repo for now. If there is evidence that this is essential in the Collector we can then move it to the core repo.

Isn't there a discussion/plan on moving contrib to this main repo?

@tigrannajaryan
Copy link
Member

Isn't there a discussion/plan on moving contrib to this main repo?

No definitive plan yet.

Closes open-telemetry#1260

Signed-off-by: Juraci Paixão Kröhling <[email protected]>
@jpkrohling
Copy link
Member Author

@tigrannajaryan, @nilebox, I rebased this PR and changed it to be a processor instead of exporter, as discussed in #1609.

Signed-off-by: Juraci Paixão Kröhling <[email protected]>
@jpkrohling
Copy link
Member Author

For reference, here's how to perform a manual test for this feature:

Configuration

receivers:
  otlp/acme:
    protocols:
      grpc:
        endpoint: localhost:55680
  jaeger:
    protocols:
      thrift_compact:

processors:
  routing:
    from_attribute: X-Tenant
    default_exporters: jaeger/default
    table:
    - value: acme
      exporters:
      - jaeger/acme
  batch:

exporters:
  logging: {}

  jaeger/default:
    endpoint: localhost:24250
    insecure: true

  otlp/acme:
    endpoint: localhost:55680
    insecure: true
    headers:
      "x-tenant": "acme"
  jaeger/acme:
    endpoint: localhost:14250
    insecure: true

service:
  pipelines:
    traces:
      receivers:
      - jaeger
      processors: []
      exporters:
      - logging
      - otlp/acme

    traces/multitenant:
      receivers: [otlp/acme]
      processors: 
      - routing
      exporters:
      - logging
      - jaeger/default
      - jaeger/acme

Then, start a local Jaeger server (referenced as "jaeger/acme" in the config):

$ go run ./cmd/all-in-one --processor.jaeger-compact.server-host-port=16831 --query.static-files=./jaeger-ui/packages/jaeger-ui/build --log-level=debug

And a second instance, from a container ("jaeger/default" in the config):

$ podman run -p 24250:14250 -p 26686:16686 jaegertracing/all-in-one --log-level=debug

Jaeger's tracegen can be used to generate traces:

$ go run ./cmd/tracegen -traces 10

Check "jaeger/acme" (http:https://localhost:16686), and you'll see the 10 traces there.

Change the configuration, so that the line with "x-tenant" has "globex" as value and reload otelcol. Run tracegen again, and check that the new traces arrived at the "jaeger/default" instance (http:https://localhost:26686).

In a production setup, each tenant would have its own otelcol instance, with the appropriate x-tenant value.

@codecov
Copy link

codecov bot commented Sep 1, 2020

Codecov Report

Merging #1611 into master will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1611      +/-   ##
==========================================
+ Coverage   92.40%   92.44%   +0.04%     
==========================================
  Files         265      267       +2     
  Lines       19981    20064      +83     
==========================================
+ Hits        18464    18549      +85     
+ Misses       1090     1089       -1     
+ Partials      427      426       -1     
Impacted Files Coverage Δ
processor/routingprocessor/factory.go 100.00% <100.00%> (ø)
processor/routingprocessor/routing.go 100.00% <100.00%> (ø)
service/defaultcomponents/defaults.go 85.71% <100.00%> (+0.25%) ⬆️
translator/internaldata/resource_to_oc.go 88.88% <0.00%> (+1.85%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 57aeb8f...b6c2c88. Read the comment docs.

@jpkrohling
Copy link
Member Author

The CI failed at correctness, but I have no idea what's going on there and I don't think it's related to this PR:

    --- FAIL: TestTracingGoldenData/zipkin-zipkin (2.46s)
FAIL
exit status 1
FAIL	go.opentelemetry.io/collector/testbed/correctness/traces	137.314s
# Test Results
Started: Tue, 01 Sep 2020 11:14:02 +0000

Test                                    |Result|Duration|Sent Items|Received Items|Failure Count|Failures
----------------------------------------|------|-------:|---------:|-------------:|------------:|--------
TracingGoldenData/otlp-jaeger           |PASS  |      1s|      3907|          3907|            0|
TracingGoldenData/zipkin-opencensus     |PASS  |      1s|      3907|          3907|            0|
TracingGoldenData/otlp-opencensus       |PASS  |      1s|      3907|          3907|            0|
TracingGoldenData/jaeger-opencensus     |PASS  |      1s|      3907|          3907|            0|
TracingGoldenData/opencensus-jaeger     |PASS  |      1s|      3907|          3907|            0|
TracingGoldenData/zipkin-otlp           |PASS  |      1s|      3907|          3907|            0|
TracingGoldenData/jaeger-jaeger         |PASS  |      1s|      3907|          3907|            0|
TracingGoldenData/opencensus-opencensus |PASS  |      1s|      3907|          3907|            0|
TracingGoldenData/otlp-zipkin           |PASS  |      1s|      3907|          3907|            0|
TracingGoldenData/jaeger-zipkin         |PASS  |      1s|      3907|          3907|            0|
TracingGoldenData/opencensus-zipkin     |PASS  |      1s|      3907|          3907|            0|
TracingGoldenData/zipkin-jaeger         |PASS  |      1s|      3907|          3907|            0|
TracingGoldenData/otlp-otlp             |PASS  |    120s|      3907|          3907|            0|
TracingGoldenData/jaeger-otlp           |PASS  |      1s|      3907|          3907|            0|
TracingGoldenData/opencensus-otlp       |PASS  |      1s|      3907|          3907|            0|
TracingGoldenData/zipkin-zipkin         |FAIL  |      2s|      2529|          2529|            0|

https://app.circleci.com/pipelines/github/open-telemetry/opentelemetry-collector/3206/workflows/a7d8172d-1fe6-4576-b4b3-1d3baaf91ca5/jobs/31894

Signed-off-by: Juraci Paixão Kröhling <[email protected]>
@jpkrohling
Copy link
Member Author

And the CI error is now gone O_O

Copy link
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this to contrib repo? With all the limitations around what other processors it can be used with I do not feel that it is ready for the core.

processor/routingprocessor/README.md Show resolved Hide resolved
@jpkrohling
Copy link
Member Author

Closed in favor of open-telemetry/opentelemetry-collector-contrib#907

@jpkrohling jpkrohling closed this Sep 3, 2020
Collector automation moved this from Review in progress to Done Sep 3, 2020
tigrannajaryan pushed a commit to open-telemetry/opentelemetry-collector-contrib that referenced this pull request Sep 10, 2020
Closes open-telemetry/opentelemetry-collector#1260
Supersedes open-telemetry/opentelemetry-collector#1611 

**Testing:** unit tests + manual tests (see open-telemetry/opentelemetry-collector#1611)

**Documentation:** README included.

Signed-off-by: Juraci Paixão Kröhling <[email protected]>
MovieStoreGuy pushed a commit to atlassian-forks/opentelemetry-collector that referenced this pull request Nov 11, 2021
Included all directives from the specification, clarify english, and
translate specifics for the Go language.
hughesjj pushed a commit to hughesjj/opentelemetry-collector that referenced this pull request Apr 27, 2023
…y#1611)

Bumps [boto3](https://github.com/boto/boto3) from 1.23.7 to 1.23.8.
- [Release notes](https://github.com/boto/boto3/releases)
- [Changelog](https://github.com/boto/boto3/blob/develop/CHANGELOG.rst)
- [Commits](boto/boto3@1.23.7...1.23.8)

---
updated-dependencies:
- dependency-name: boto3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Collector
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants