Skip to content
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

Docs: Optimizing:Opentelemetry should be updated #77451

Open
WendaoLee opened this issue Mar 24, 2025 · 0 comments
Open

Docs: Optimizing:Opentelemetry should be updated #77451

WendaoLee opened this issue Mar 24, 2025 · 0 comments

Comments

@WendaoLee
Copy link

WendaoLee commented Mar 24, 2025

What is the documentation issue?

The sample code in https://nextjs.org/docs/app/building-your-application/optimizing/open-telemetry#manual-opentelemetry-configuration:

import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'
import { Resource } from '@opentelemetry/resources'
import { NodeSDK } from '@opentelemetry/sdk-node'
import { SimpleSpanProcessor } from '@opentelemetry/sdk-trace-node'
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions'
 
const sdk = new NodeSDK({
  resource: new Resource({
    [ATTR_SERVICE_NAME]: 'next-app',
  }),
  spanProcessor: new SimpleSpanProcessor(new OTLPTraceExporter()),
})
sdk.start()

is not supported for newest OpentelemetrySDK . It should be:

import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'
import { resourceFromAttributes } from '@opentelemetry/resources'
import { NodeSDK } from '@opentelemetry/sdk-node'
import { SimpleSpanProcessor } from '@opentelemetry/sdk-trace-node'
import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from '@opentelemetry/semantic-conventions'

const sdk = new NodeSDK({
    resource: resourceFromAttributes({
        [ATTR_SERVICE_NAME]: 'next-app',
    }),
    spanProcessor: new SimpleSpanProcessor(new OTLPTraceExporter()),
})
sdk.start()

If anyone try to write code like this above opentelemetry/resources >= 2.0.0,the new Resource({ [ATTR_SERVICE_NAME]: 'next-app', }), won't work,for the developer has changed its api.

Should add some annotation for it.

Is there any context that might help us understand?

See open-telemetry/opentelemetry-js#5421.

Does the docs page already exist? Please link to it.

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

No branches or pull requests

1 participant