-
Notifications
You must be signed in to change notification settings - Fork 736
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,10 @@ export const telemetry = new TelemetryTracer() | |
| */ | ||
| declare module './telemetry.gen' { | ||
| 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 | ||
| } | ||
|
Comment on lines
25
to
31
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. Why doesn't span have run()? I don't quite understand the distinction here. I think of metrics as mostly synonymous with spans.
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. The problem is this span as any is a lie. It never actually had run. When you try and do The passed in span is just a telemetry span that has emit, record, increment but isn't a metric type |
||
| } | ||
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()