-
Notifications
You must be signed in to change notification settings - Fork 5.3k
opentelemetrytracer: Dynatrace sampler: Use http_service in configura… #33034
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
Changes from all commits
815fc9c
2aaa593
7d1a86a
8fc17d4
9198d06
9c1e750
b819ee8
087f921
cec4b0f
08600a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,9 +35,12 @@ SamplerConfigProviderImpl::SamplerConfigProviderImpl( | |
| Server::Configuration::TracerFactoryContext& context, | ||
| const envoy::extensions::tracers::opentelemetry::samplers::v3::DynatraceSamplerConfig& config) | ||
| : cluster_manager_(context.serverFactoryContext().clusterManager()), | ||
| http_uri_(config.http_uri()), | ||
| authorization_header_value_(absl::StrCat("Api-Token ", config.token())), | ||
| sampler_config_(config.root_spans_per_minute()) { | ||
| http_uri_(config.http_service().http_uri()), sampler_config_(config.root_spans_per_minute()) { | ||
|
|
||
samohte marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| for (const auto& header_value_option : config.http_service().request_headers_to_add()) { | ||
| parsed_headers_to_add_.push_back({Http::LowerCaseString(header_value_option.header().key()), | ||
| header_value_option.header().value()}); | ||
| } | ||
|
|
||
| timer_ = context.serverFactoryContext().mainThreadDispatcher().createTimer([this]() -> void { | ||
| const auto thread_local_cluster = cluster_manager_.getThreadLocalCluster(http_uri_.cluster()); | ||
|
|
@@ -47,8 +50,9 @@ SamplerConfigProviderImpl::SamplerConfigProviderImpl( | |
| } else { | ||
| Http::RequestMessagePtr message = Http::Utility::prepareHeaders(http_uri_); | ||
| message->headers().setReferenceMethod(Http::Headers::get().MethodValues.Get); | ||
| message->headers().setReference(Http::CustomHeaders::get().Authorization, | ||
| authorization_header_value_); | ||
| for (const auto& header_pair : parsed_headers_to_add_) { | ||
| message->headers().setReference(header_pair.first, header_pair.second); | ||
| } | ||
|
Comment on lines
-50
to
+55
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM overall except this one. Basically, we think the token or passwd should be kept in secret. And if an raw string is used then we should mark it as So, if you use the If you think it's OK, then I am also OK to this design.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank's for the hint. I have discussed this with @joaopgrassi. We are aware of the problem but we would like to keep it as is for now. We would have to add the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My suggestion is to keep the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Waiting your last confirmation, then I will merge this PR. /wait-any
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wbpcode We have discussed internally and we prefer to keep it as is. We already have the same situation in the HTTP exporter, where the token is also passed/used in the http headers, so we prefer to keep the config consistent to not confuse users. It also makes the Istio part of the configuration easier, because we can then re-use the headers of the HTTP exporter for the sampler, as in 99% of the cases they will be configured together by customers (http exporter + Dynatrace sampler). |
||
| active_request_ = thread_local_cluster->httpAsyncClient().send( | ||
| std::move(message), *this, | ||
| Http::AsyncClient::RequestOptions().setTimeout(std::chrono::milliseconds( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.