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 open telemetry #2530

Closed
wants to merge 3 commits into from
Closed

Conversation

MarcelHillmann
Copy link

Hi,

the second try for #2516 without Zipkin ;)

Thanks
Marcel

@k8s-ci-robot
Copy link
Collaborator

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@dashpole
Copy link
Collaborator

dashpole commented May 1, 2020

/ok-to-test

)

func init() {
flag.Var(&traceTags, "trace_tags", "additional tags for tracing (eg. foo=bar)")
Copy link
Collaborator

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?

Copy link
Author

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

Copy link
Collaborator

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.

cmd/internal/opentelemetry/wrapperMux.go Outdated Show resolved Hide resolved
cmd/internal/opentelemetry/wrapperMux.go Outdated Show resolved Hide resolved
cmd/internal/opentelemetry/wrapperMux.go Outdated Show resolved Hide resolved
cmd/internal/opentelemetry/wrapperMux.go Outdated Show resolved Hide resolved
cmd/internal/opentelemetry/wrapperMux.go Outdated Show resolved Hide resolved
@googlebot
Copy link
Collaborator

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.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@MarcelHillmann
Copy link
Author

@googlebot I fixed it.

1 similar comment
@MarcelHillmann
Copy link
Author

@googlebot I fixed it.

@googlebot
Copy link
Collaborator

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]>
Signed-off-by: Marcel <[email protected]>
@MarcelHillmann
Copy link
Author

/retest

1 similar comment
@MarcelHillmann
Copy link
Author

/retest

Signed-off-by: Marcel <[email protected]>
package opentelemetry

import (
"context"
Copy link
Collaborator

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)
Copy link
Collaborator

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)
Copy link
Collaborator

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()
Copy link
Collaborator

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()
Copy link
Collaborator

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 {
Copy link
Collaborator

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 {
Copy link
Collaborator

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?

@dashpole
Copy link
Collaborator

cc @SergeyKanzhelev

Copy link
Collaborator

@SergeyKanzhelev SergeyKanzhelev left a 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
Copy link
Collaborator

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
Copy link
Collaborator

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)")
Copy link
Collaborator

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"])),
Copy link
Collaborator

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")
Copy link
Collaborator

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?

@dashpole dashpole self-assigned this Aug 13, 2020
@bobbypage
Copy link
Collaborator

I'm going to close this for now since there hasn't been any updates in a while, please re-open if appropriate.

@bobbypage bobbypage closed this Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants