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

Add tenant ID processor #12

Merged
merged 15 commits into from
Jan 27, 2021
Merged

Conversation

pavolloffay
Copy link
Member

This PR adds tenant ID processor that adds tenant header as an attribute to every span. If the header is missing an error is returned.

The headers are obtained from context, this works well for grpc receivers (see test with OTLP and Jaeger). Accessing headers from other receivers (e.g. HTTP) is tracked under open-telemetry/opentelemetry-collector#2401.

@pavolloffay pavolloffay requested a review from davexroth January 26, 2021 15:58
@jcchavezs
Copy link
Contributor

Thanks @pavolloffay, nice find. Although I would hold on with this PR as it does not solve our use case ATM.

go.mod Outdated
@@ -7,6 +7,7 @@ require (
github.com/go-sql-driver/mysql v1.5.0 // indirect
github.com/golangci/golangci-lint v1.31.0 // indirect
github.com/google/addlicense v0.0.0-20200622132530-df58acafd6d5 // indirect
github.com/jaegertracing/jaeger v1.21.0
Copy link
Contributor

Choose a reason for hiding this comment

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

I am very reluctant to add this kind of things just for testing (disclaimer: this is a dependency/test argument rather than a library specific one). Also I don't see the need for this given we have a generic test for GRPC without the need of adding a new library: https://github.com/hypertrace/hypertrace-collector/pull/12/files#diff-dc84efdcda988ef18ddc3ae41e3f99d20f5b172fd77cea30016087f334cd9e70R63. Could you elaborate more on the benefit of this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I can remove the Jaeger test. The dependency on Jaeger will be pulled in anyways since the jaeger receiver is in the standard components.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is alright that dependency will be pulled by a dependency as long as we keep our list of dependencies minimal.


import (
"context"
"go.opencensus.io/stats/view"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we truly need this?

Copy link
Member Author

Choose a reason for hiding this comment

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

if we want to use metrics then yes. I would stick with metrics API that the upstream uses, there is plan to migrate but who knows when open-telemetry/opentelemetry-collector#816

Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
@pavolloffay
Copy link
Member Author

Thanks @pavolloffay, nice find. Although I would hold on with this PR as it does not solve our use case ATM.

What use-case are you refering to? This PR migrates a processor from the old traceable OC service. We need this functionality here as well. There is nothing controversial in the PR to put it on hold. The support for Jaeger thrift will be added in a separate PR. I don't want to keep open PRs and keep rebasing.

Copy link

@davexroth davexroth left a comment

Choose a reason for hiding this comment

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

Thanks @pavolloffay, nice find. Although I would hold on with this PR as it does not solve our use case ATM.

What use-case are you refering to? This PR migrates a processor from the old traceable OC service. We need this functionality here as well. There is nothing controversial in the PR to put it on hold. The support for Jaeger thrift will be added in a separate PR. I don't want to keep open PRs and keep rebasing.

I think it makes sense to get this in as is, because as Pavol states, this is needed functionality. We will also need to support jaeger thrift for compatibility, but that will be a later PR.

tenantIDHeaders := md.Get(p.tenantIDHeaderName)
if len(tenantIDHeaders) == 0 {
return traces, nil
} else if len(tenantIDHeaders) > 1 {

Choose a reason for hiding this comment

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

is there ever a case where this would be valid? I'm inclined to err on the side of caution and
just drop spans which have multiple tenant header values.

Copy link
Member Author

Choose a reason for hiding this comment

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

TBH I don't know, it's probably safer to return an error in this case. Every user should have assigned a single tenant.

Signed-off-by: Pavol Loffay <[email protected]>
@pavolloffay
Copy link
Member Author

@jcchavezs @davexroth PR updated.

Signed-off-by: Pavol Loffay <[email protected]>
Signed-off-by: Pavol Loffay <[email protected]>
@jcchavezs
Copy link
Contributor

What use-case are you refering to? This PR migrates a processor from the old traceable OC service. We need this functionality here as well. There is nothing controversial in the PR to put it on hold. The support for Jaeger thrift will be added in a separate PR. I don't want to keep open PRs and keep rebasing.

I don't see anything controversial in this PR. My main concern is that this does not address our main use cases (report over jaeger and zipkin endpoint) and the more processors we add at this stage, the more we have to maintain towards breaking changes from otel. If we delay the merge we only need to do the update the processors in here. Remember in this PR we mostly add new code and that won't be affected by rebases most likely cc @davexroth @pavolloffay

Signed-off-by: Pavol Loffay <[email protected]>
@pavolloffay
Copy link
Member Author

pavolloffay commented Jan 27, 2021

This processor is not needed for Zipkin and as it is stated above the Jaeger support will be added in upstream and here in a separate PR (e.g. as a test at least).

This processor will be used with OTLP (going forward) and Jaeger Thrift over HTTP for existing deployments.

At traceable Zipkin is used only to report data from agents to a local collector in the customer cluster.

@jcchavezs jcchavezs merged commit f08ae5f into hypertrace:main Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants