-
Notifications
You must be signed in to change notification settings - Fork 27.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
feat: add OTEL instrumentation for next-server + OTEL example #46198
Conversation
@@ -0,0 +1,30 @@ | |||
# Data fetch example |
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 a reminder to update the readme
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.
will do in a subsequent pr
This reverts commit 3924658.
* This should be lazily evaluated. | ||
*/ | ||
private getTracerInstance(): Tracer { | ||
return trace.getTracer('next.js', '0.0.1') |
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.
what's the 0.0.1 version for? should we cache it as a property instead call getTracer each time or this is by designed?
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.
Not sure if this makes much difference in both ways
@@ -0,0 +1,23 @@ | |||
export function register() { |
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.
Need to align this file with other pages should either be js or ts
fix NEXT-479 (link)
content
This PR adds a
getTracer
API to Next.js that uses theotel/api
under the hood to provide Next.js level instrumentation through Open Telemetry.This also adds an example
with-opentelemetry
to demonstrate how it can be used, assuming you have a collector.This allows most notably to have
getServerSideProps
andfetch
calls inside Server Components traced.details
config.experimental.instrumentationHook
config option to initialise OTEL, like in the exampleBug
fixes #number
contributing.md
Feature
fixes #number
contributing.md
Documentation / Examples
pnpm build && pnpm lint