-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[core] - Scope down OpenTelemetry interfaces #17730
Changes from all commits
61e1427
92b05a2
9eb638b
35d018c
efdb0eb
ec84f87
1d47583
b023fad
7eedf67
b5b5c84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,42 +33,9 @@ export interface CreateSpanFunctionArgs { | |
packagePrefix: string; | ||
} | ||
|
||
// @public | ||
export type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string; | ||
|
||
// @public | ||
export interface ExceptionWithCode { | ||
code: string | number; | ||
message?: string; | ||
name?: string; | ||
stack?: string; | ||
} | ||
|
||
// @public | ||
export interface ExceptionWithMessage { | ||
code?: string | number; | ||
message: string; | ||
name?: string; | ||
stack?: string; | ||
} | ||
|
||
// @public | ||
export interface ExceptionWithName { | ||
code?: string | number; | ||
message?: string; | ||
name: string; | ||
stack?: string; | ||
} | ||
|
||
// @public | ||
export function extractSpanContextFromTraceParentHeader(traceParentHeader: string): SpanContext | undefined; | ||
|
||
// @public | ||
export function getSpan(context: Context): Span | undefined; | ||
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. These are all used in test code only (but see my callout about EH / SB in summary) so I got rid of them and had the test code updated to pull in from @azure/test-utils |
||
|
||
// @public | ||
export function getSpanContext(context: Context): SpanContext | undefined; | ||
|
||
// @public | ||
export function getTraceParentHeader(spanContext: SpanContext): string | undefined; | ||
|
||
|
@@ -78,9 +45,6 @@ export function getTracer(): Tracer; | |
// @public | ||
export function getTracer(name: string, version?: string): Tracer; | ||
|
||
// @public | ||
export type HrTime = [number, number]; | ||
|
||
// @public | ||
export function isSpanContextValid(context: SpanContext): boolean; | ||
|
||
|
@@ -95,18 +59,12 @@ export interface OperationTracingOptions { | |
tracingContext?: Context; | ||
} | ||
|
||
// @public | ||
export function setSpan(context: Context, span: Span): Context; | ||
|
||
// @public | ||
export function setSpanContext(context: Context, spanContext: SpanContext): Context; | ||
|
||
// @public | ||
export interface Span { | ||
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. I love to see the simplification! Could you lay out what the next sequence of steps you think are? e.g. will Span eventually be a re-export of OT? Do we need to have some minimal interface for it ourselves? Same with 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. Sure! Assumption: EventHubs and ServiceBus are ok taking a direct dependency on @opentelemetry/api (I still have to get confirmation on that and will reach out offline) I should note though that at the end of the day we can remove what we can but we are likely stuck with some of these interfaces for the time being... they've been here for a while, packages have taken dependencies on them, and so we can't unfortunately pull the rug from under them anymore. Must stay
I'd love to remove all of these, but these are the ones that will be really hard to tease out at this point Still investigating if these can go
Longer term (post GA)
What do you think? 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.
Figured I'll expand what those are:
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. This is an interesting point. Since tracing is heavily dependent on OpenTelemetry, I think it's reasonable to match their support level for TS. So if they only work on TS 3.8+, I think it's fair that we are the same (for tracing interfaces, that is.) I don't want to be in the business of trying to monkeypatch their compat story. 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. Also I'm curious what the blocker is from re-exporting the OT shapes? Why does our definition of Span vs theirs make a meaningful difference to TS? 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.
There's two issues that I am aware of and I believe both are related to The first is that our version of API Extractor (7.7.x) does not support them so we end up with these warnings on every package when I try to re-export any APIs directly from OTel:
See #9410 and #13557 as related issues (and of course upgrading API Extractor is not free because of how it handles name collision in later versions, see #17702 for an example) The second is less clear to me - I'm hopeful @richardpark-msft or @chradek remember why #14618 was needed? That looks like where we removed the re-exports and redeclared the types |
||
addEvent(name: string, attributesOrStartTime?: SpanAttributes | TimeInput, startTime?: TimeInput): this; | ||
end(endTime?: TimeInput): void; | ||
addEvent(name: string, attributesOrStartTime?: SpanAttributes | Date, startTime?: Date): this; | ||
end(endTime?: Date): void; | ||
isRecording(): boolean; | ||
recordException(exception: Exception, time?: TimeInput): void; | ||
recordException(exception: Error, time?: Date): void; | ||
setAttribute(key: string, value: SpanAttributeValue): this; | ||
setAttributes(attributes: SpanAttributes): this; | ||
setStatus(status: SpanStatus): this; | ||
|
@@ -116,11 +74,11 @@ export interface Span { | |
|
||
// @public | ||
export interface SpanAttributes { | ||
[attributeKey: string]: SpanAttributeValue | undefined; | ||
[attributeKey: string]: SpanAttributeValue; | ||
} | ||
|
||
// @public | ||
export type SpanAttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>; | ||
export type SpanAttributeValue = string | number | boolean; | ||
|
||
// @public | ||
export interface SpanContext { | ||
|
@@ -144,7 +102,7 @@ export interface SpanOptions { | |
attributes?: SpanAttributes; | ||
kind?: SpanKind; | ||
links?: Link[]; | ||
startTime?: TimeInput; | ||
startTime?: Date; | ||
} | ||
|
||
// @public | ||
|
@@ -160,9 +118,6 @@ export enum SpanStatusCode { | |
UNSET = 0 | ||
} | ||
|
||
// @public | ||
export type TimeInput = HrTime | number | Date; | ||
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. Let's just call this |
||
|
||
// @public | ||
export const enum TraceFlags { | ||
NONE = 0, | ||
|
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 is really just
Error | string
- for our usecase we can just sayError