-
Notifications
You must be signed in to change notification settings - Fork 737
refactor(telemetry): Remove telemetry.foo.record #5646
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
refactor(telemetry): Remove telemetry.foo.record #5646
Conversation
875b3f6 to
f95e2f4
Compare
|
|
||
| // This function is expected to be called in the context of restoreConnection() | ||
| telemetry.auth_modifyConnection.record({ | ||
| span.record({ |
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.
just for reference: this could also do telemetry.record() , right? In general, I don't think we can (or want to) except spans to be passed around; that defeats much of the advantage of the "execution scope" concept, which allows the context to be augmented by any codepath.
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.
Technically yes, but it also has the side effect that every subsequent span thats created would have connectionState and authStatus
Instead I could have technically used telemetry.activeSpan?.record()
| interface Metric<T extends MetricBase = MetricBase> { | ||
| run<U>(fn: (span: Span<T>) => U, options?: SpanOptions): U | ||
| } | ||
|
|
||
| interface Span<T extends MetricBase = MetricBase> { | ||
| increment(data: { [P in NumericKeys<T>]+?: number }): void | ||
| run<U>(fn: (span: this) => U, options?: SpanOptions): U | ||
| } |
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 doesn't span have run()? I don't quite understand the distinction here. I think of metrics as mostly synonymous with spans.
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.
The problem is this span as any is a lie. It never actually had run. When you try and do span.run you get "span.run is not a function"
The passed in span is just a telemetry span that has emit, record, increment but isn't a metric type
Problem: - Theres quite a few missues of telemetry.foo.record inside of the codebase and it can be confusing for external contributors Solution: - Clean up the telemetry interface by only allowing record/increment on spans
f95e2f4 to
ecca20d
Compare
Problem
Solution
License: I confirm that my contribution is made under the terms of the Apache 2.0 license.