-
Notifications
You must be signed in to change notification settings - Fork 819
secrets: migrate secrets to utilize opentelemetry #3547
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
base: master
Are you sure you want to change the base?
Conversation
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.
Let's iterate on this one until it looks good, then you can update the others as needed and I'll look at those.
otel.Handle(err) | ||
} | ||
|
||
completedCallsCounter, err = meter.Int64Counter( |
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 do we need this? Doesn't the latency histogram implicitly have a call count?
metric.WithDescription("Latency distribution of method calls"), | ||
) | ||
if err != nil { | ||
otel.Handle(err) |
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 does this do, and in what state does it leave the latencyHistogram?
defer func() { | ||
// Set status on span before ending | ||
if err != nil { | ||
span.SetAttributes(attribute.String("gocdk.status", "13")) // Internal error |
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.
Where did you get 13? Isn't there a constant for it somewhere?
defer func() { k.tracer.End(ctx, err) }() | ||
start := time.Now() | ||
ctx, span := k.tracer.Start(ctx, "Decrypt") | ||
// Set span attributes for testing |
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.
So, it's not great that we went from 2 lines of code to record metrics to about 30. I suspect this will happen in every package. It's repetitive even inside this package (lines 130-160, lines 178-209 are basically the same).
a) Why does OpenTelemetry need so much more? For example, you're already passing the method name to the OpenSpan, why do we need to provide it again as an attribute?
b) Can you add a wrapper Start/End in the otel/ package that could be called here so that secrets/blob/pubsub/etc. only have to call Start and defer End?
Micro PR to migrate monolith : #3539
PR affects :
secrets