-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
WIP - Add remote sampling extension #432
WIP - Add remote sampling extension #432
Conversation
Consider a name like jaegerremotesampling for the package name? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add details about the extension to the docs:
https://github.com/open-telemetry/opentelemetry-collector#extensions
https://github.com/open-telemetry/opentelemetry-collector/blob/master/extension/README.md
Also, I think this will currently conflict with the jaeger receiver as it opens port 5778 when it's starting up the jaeger agent. I am currently looking at #157 and will fix in a PR that adds these configuration options.
|
||
// Addr is the upstream Jaeger collector address that can be used to fetch | ||
// sampling configurations. The default value is `:14250`. | ||
Addr string `mapstructure:"addr"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this field be more descriptive to help the operator know what it's for. CollectorAddress?
NameVal: typeStr, | ||
}, | ||
Port: 5778, | ||
Addr: "0.0.0.0:14250", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a meaningful default for this field? Maybe it should just default to empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After thinking more about this PR, and reading the code I think we can have this as part of the Jaeger receiver:
- Extend the jaegerreceiver.Config to include a "RemoteSampling(port, address)" extra config.
This way we keep this specific only to the Jaeger receiver, I know that this is not related to the processing pipeline but it is still a property of the Jaeger receiver.
What do you think?
That works for me. It was my initial thought, but there was some strangeness about it which is why we had questions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a PR description to explain the motivation of this change and why it should be in the core Collector repository. Unless there is a specific justification for it by default all new extensions should be added to "contrib" repo: https://github.com/open-telemetry/opentelemetry-collector-contrib/
@joe-elliott @tigrannajaryan - Thanks for the reviews. @bogdandrutu - Hmm, I was thinking the same thing while writing the extension, but I thought that remote sampling is not something that should be enabled with the jaeger receiver. Functionally it makes sense to add it as an extension for users to explicitly configure and enable when they really need remote sampling. |
rs.jProxy = jAgent.NewConfigManager(conn) | ||
|
||
// Register the http handler at the sampling URI | ||
rs.server.Handler = rs.Handler() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we're only handling the remote sampling proxy? and doing so at every endpoint?
I think we should handle queries like the agent does here: https://github.com/jaegertracing/jaeger/blob/master/cmd/agent/app/httpserver/server.go#L39
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will add a mux handler for the endpoints.
It is still unclear to me why this needs to be in the core. I am not even sure this functionality the way it is implemented belongs to Collector at all. It looks like a standalone HTTP server proxying some information it receives and it does not interact in any way with the rest of the Collector. Why this functionality needs to be in OpenTelemetry Collector? It seems to me it can be a standalone executable. |
@tigrannajaryan - The assumption is that eventually, the Otel collector will host sampling configurations that the clients/agents can query remotely. |
I can't say I know what the defined goals are of the otel collector, but the sampling rules/baggage proxy is required to fully support the jaeger client. We have need of it in our environment to begin using the otel collector which is why are we are working to contribute it. I've been through the docs (https://github.com/open-telemetry/opentelemetry-collector/tree/master/docs) and not found any good guiding principles for whether or not this should be included. If there's a good resource for this please let us know. |
I would like to see a more detailed description of what is the proposed functionality to understand where is the best place for this. The information that I see in this PR is not enough to make a decision.
There is none currently and thanks for pointing it out, this is something I or one of other maintainers will need to create. For now here is a few principles that I follow as a maintainer:
|
The Jaeger client has the expectation to be able to make an http request for json documents that describe sampling rules and baggage restrictions. Currently, depending on configuration, the agent converts these requests to either tchannel or grpc and forwards them to the collector. Additionally, Jaeger is in the process of adding adaptive sampling rules which will also rely on remote sampling functionality (https://www.jaegertracing.io/docs/1.15/sampling/#adaptive-sampler). The otel collector supports a variety of agent (thrift compact, thrift binary) and collector protocols (tchannel, grpc, http) span ingesting protocols, but does not support this feature. We are proposing to add the following to the otel-collector:
The additional configuration would be roughly:
These additions can be made with existing Jaeger dependencies. For Jaeger users this should lower the friction of adoption and increase Jaeger client compatibility. Anyone using the existing Jaeger client across many services with the remote sampling feature and wanting to adopt the otel collector as part of their span pipeline would have similar needs. |
@joe-elliott thank you for detailed description and I agree it makes sense to support in the Collector since we declared we have built-in Jaeger support.
Can this new functionality be part of Jaeger receiver that already exists in this repo? Or this functionality is independently useful even if one is not using Jaeger receiver? Is there a use-case when a Jaeger client needs retrieve the configuration from the Collector but does not send collected trace data to the Collector?
Does this mean the same Jaeger |
IIUC, I do not think there is a use-case where one would run a Jaeger collector just to serve sampling strategies but not to consume trace data. The agent is usually configured to receive sampling strategies from the same collector that it forwards spans to.
Correct. IIUC, remote sampling configurations will soon be supported with Otel-collector as well, and then we would have to write a remote sampling extension. So my vote would be to keep this package under extensions and not make it specific to the Now:
Later:
|
I am not aware of any initiatives to do that. What do you refer to? |
@tigrannajaryan there was a discussion to add a remote sampling configuration at the otel protocol during the opentelemetry maintainers track. We did not commit to do it but I think this is probably something that we will need and will end up implementing. Also I think as I mentioned in one of my previous comment that this functionality better fits in the Jaeger receiver for the moment. |
@bogdandrutu I think, along those lines, we'll need (in the end) a way to remotely configure metrics, which instruments, which dimensions, which aggregations, and so on. It would be very similar to getting a trace-sampling configuration--I'd expect it to be something included in an OTLP response. |
I agree that you would almost certainly be using a receiver along with the proxy functionality. The agent protocols and the proxy are essentially part of the same api that the jaeger client consumes.
I could see a scenario in which you would want to configure the sampling proxy, but not even have a Jaeger exporter in a two tier otel collector setup. One tier would be configured to be close to the process in an "agent" style and a second tier configured for tail based sampling in a "collector" style. Then backend the whole thing with Jaeger. The "agent" tier would not even have a Jaeger exporter but would need to be configured to see the Jaeger backend to provide this functionality. I am fine with coupling the proxy functionality with the receiver, but think it should be independent of an exporter. I am not opinionated on whether it should be an extension or part of the receiver. |
Thanks for the comments. Given the information I see in this thread I want to suggest that we do the following:
jaeger:
# protocols is how we currently configure Jaeger receiver.
protocols:
grpc:
endpoint: localhost:9876
# remoteconfig is a new setting.
remoteconfig:
# Remote server to connect to and fetch Jaeger config
fetch_endpoint: "jaeger.collector:14251"
# Local address to serve config at
listen_endpoint: "localhost:5779" The actual settings that go under As for generic remote configuration functionality please show me proposals with design docs attached, happy to review :-) |
This would definitely meet our needs. If we could review this PR #434 It lays the groundwork for independently configurable pieces of the Jaeger agent protocols. @annanay25 could then port his work to use this base for the proxy feature additions in the Jaeger receiver. |
This PR takes over from #432 - Added SamplingManager to the `jReceiver` struct - Added new parameters to configure remote sampling endpoint (`remote_sampling:fetch_endpoint`) - Added tests and updated README
Rename the package from "export" to "metric". Note that all the existing imports of this package use an explicit name of `export` and, therefore, no import declaration changes are included. Rename the `MetricKind` to `Kind` to not stutter in the type usage. Note this does not include a method name change for the `Descriptor` method `MetricKind`.
) Bumps [go.uber.org/zap](https://github.com/uber-go/zap) from 1.16.0 to 1.17.0. - [Release notes](https://github.com/uber-go/zap/releases) - [Changelog](https://github.com/uber-go/zap/blob/master/CHANGELOG.md) - [Commits](uber-go/zap@v1.16.0...v1.17.0) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Adds an extension to proxy client requests for remote sampling configuration to a configured Jaeger collector.
Refer open-telemetry/opentelemetry-go#327
Motivation
Remote sampling is an important feature that the OpenTelemetry collector does not support but the Jaeger agent does, and to ensure that the OpenTelemetry collector can be used as a drop in replacement for the Jaeger agent (discussed at KubeCon) we add an extension that supports proxying client requests for sampling configuration to a Jaeger collector.
cc @joe-elliott @bogdandrutu