-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Description
I couldn’t find a better way to not have tracing in local dev (we dont want to run a collector locally yet, setup for the team is a big chore) so i wrote this way:
function noop(): Promise<void> {
return Promise.resolve();
}
const stubSpanProcessor: SpanProcessor = { forceFlush: noop, onEnd: noop, onStart: noop, shutdown: noop };
const config: ResolveConfigFn = (env: Env) => {
if (!env.OTEL_EXPORTER_URL || !env.OTEL_EXPORTER_BEARER_TOKEN)
return { spanProcessors: [stubSpanProcessor], service: { name: 'careers-hubs' } };
return {
exporter: {
url: env.OTEL_EXPORTER_URL,
headers: { Authorization: `Bearer ${env.OTEL_EXPORTER_BEARER_TOKEN}` },
},
service: { name: 'careers-hubs' },
};
};Is there an easier way? this stub with noops sounds weirdly unnecessary but any other way i get tons of errors logged onto the console.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels