Skip to content

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

chee
Copy link
Contributor

@chee chee commented Jul 10, 2025

No description provided.

Comment on lines +133 to +139
const message = (error as Error).message ?? 'problem'
span.setStatus({
code: SpanStatusCode.ERROR,
message,
})
span.recordException(error as Error)
throw error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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
Copy link
Contributor

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

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants