-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 open telemetry #2530
add open telemetry #2530
Conversation
Hi @MarcelHillmann. Thanks for your PR. I'm waiting for a google member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
) | ||
|
||
func init() { | ||
flag.Var(&traceTags, "trace_tags", "additional tags for tracing (eg. foo=bar)") |
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.
What is the use case for adding tags via flags?
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.
If you need more flags for the search to differ the Traces.
Like k8s.* oder cloud.* https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/resource/semantic_conventions
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 would prefer discovering these from the host wherever possible, rather than setting them via flags. If we do go the route of flags, i'd prefer specific flags for each attribute, rather than a k/v list. But i'm hoping we don't have to do that.
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
@googlebot I fixed it. |
1 similar comment
@googlebot I fixed it. |
6ad8b9f
to
c54c2de
Compare
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
fix typo padding left add logging generic Extractor simplify Signed-off-by: Marcel <[email protected]>
c54c2de
to
a826391
Compare
Signed-off-by: Marcel <[email protected]>
/retest |
1 similar comment
/retest |
Signed-off-by: Marcel <[email protected]>
package opentelemetry | ||
|
||
import ( | ||
"context" |
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.
Could you run goimports
on this file, please?
klog.Fatal(err) | ||
} | ||
|
||
sampler := getTraceSamplerProbability() //*traceSampler, *traceSamplerParam) |
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.
Remove the comment, please.
func getTraceSamplerProbability() trace.Sampler { | ||
probability := *traceProbability | ||
if probability < 0 && probability > 1 { | ||
klog.Errorf("invalid probability value %f, probability is allowed between 0.0 and 1.0", probability) |
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.
Shouldn't you return trace.NeverSample()
here? Otherwise we are going to hit return trace.ProbabilitySampler(probability)
with invalid probability.
mux := http.NewServeMux() | ||
// setup open telemetry | ||
if *traceEndpoint != "" { | ||
defer opentelemetry.InitTrace(*traceEndpoint, *collectorCert).Stop() |
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 I understand why Stop()
call is deferred but why is InitTrace()
call deferred?
} | ||
global.SetTraceProvider(traceProvider) | ||
|
||
apiB3Single, apiB3, traceCtx, corrCtx := apiTrace.B3{SingleHeader: false}, apiTrace.B3{SingleHeader: false}, apiTrace.DefaultHTTPPropagator(), correlation.DefaultHTTPPropagator() |
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.
How is apiB3Single
different from apiB3
? They seem to be identically configured instance of the same struct.
} | ||
} | ||
|
||
func getTraceTags(tags []string) []kv.KeyValue { |
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.
This function seems to be unused.
return keyValue | ||
} | ||
|
||
func ToString(keyValues []kv.KeyValue) 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.
What is this function needed for? Are you trying to generate some Golang code?
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 a first step of adding opentelemetry. I left some comments. Looking forward to see how this will be used
"strings" | ||
) | ||
|
||
type tracingTags []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.
I cannot find where it's used
@@ -23,18 +23,19 @@ require ( | |||
github.com/golang/snappy v0.0.0-20150730031844-723cc1e459b8 // indirect | |||
github.com/influxdb/influxdb v0.9.6-0.20151125225445-9eab56311373 | |||
github.com/klauspost/crc32 v0.0.0-20151223135126-a3b15ae34567 // indirect | |||
github.com/kr/pretty v0.1.0 // indirect |
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.
curious why adding opentelemetry removed this indirect dependency
|
||
const traceServiceName = "cadvisor" | ||
|
||
var traceProbability = flag.Float64("trace_probability", 1, "used for sampler (0=never, 1=always and probability is 0.1 to 0.99)") |
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 see trace_
prefix is used here and for the OTLP collector address. If variables would be standardized in OpenTelemetry, would you be open to reuse names from there instead of inventing new names? Or these flags has it's own naming convention?
func getTraceTags(tags []string) []kv.KeyValue { | ||
keyValue := []kv.KeyValue{ | ||
kv.String("service.name", traceServiceName), | ||
kv.String("service.version", fmt.Sprintf("semver: %s git:%s", version.Info["version"], version.Info["revision"])), |
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 the idea is either use one or another, not two together. Do you need both?
@@ -77,6 +78,8 @@ var rawCgroupPrefixWhiteList = flag.String("raw_cgroup_prefix_whitelist", "", "A | |||
|
|||
var perfEvents = flag.String("perf_events_config", "", "Path to a JSON file containing configuration of perf events to measure. Empty value disabled perf events measuring.") | |||
|
|||
var traceEndpoint = flag.String("trace_endpoint", "", "Url host:port to the OTLP collector") |
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.
why are you reading this variable here? Would it be better to hide this logic inside the InitTrace
?
I'm going to close this for now since there hasn't been any updates in a while, please re-open if appropriate. |
Hi,
the second try for #2516 without Zipkin ;)
Thanks
Marcel