-
Notifications
You must be signed in to change notification settings - Fork 3
Add opentelemetry instrumentation to blobs methods #338
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: main
Are you sure you want to change the base?
Conversation
We already buffer stdout. This makes for nicer testing and debugging and will work well with a unikraft log collector
const message = (error as Error).message ?? 'problem' | ||
span.setStatus({ | ||
code: SpanStatusCode.ERROR, | ||
message, | ||
}) | ||
span.recordException(error as Error) | ||
throw 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.
SugaredTracer
we get from @netlify/otel
will already automatically handle recording errors ( https://github.com/open-telemetry/opentelemetry-js/blob/41ba7f57cbf5ae22290168188b467e0c60cd4765/api/src/experimental/trace/SugaredTracer.ts#L19-L24 )
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.
oh neat, thank u
export type BlobResponseType = 'arrayBuffer' | 'blob' | 'json' | 'stream' | 'text' | ||
|
||
export class Store { | ||
private client: Client | ||
private name: string | ||
private span: Span | null = null |
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.
I know this currently unused, but generally you wouldn't want to store a span like that because single blobs store can have multiple concurrent operations going on and this wouldn't work for such scenarios.
If you need to get some active span - https://opentelemetry.io/docs/languages/js/instrumentation/#get-the-current-span is the way to go (not sure if @netlify/otel
expose it or not, but if needed could be added there). That uses async_hooks
to propagate active context/span through concurrent async hell
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.
thanks, i will look into that api
No description provided.