-
Notifications
You must be signed in to change notification settings - Fork 825
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
Add auto instrumentation for winston #707
Comments
import opentelemetry from '@opentelemetry/api';
import { Format, format } from 'logform';
import { createLogger } from 'winston';
function tracingFormat(): Format {
const tracer = opentelemetry.trace.getTracer('logform');
return format(info => {
const span = tracer.getCurrentSpan();
if (span) {
const context = span.context();
info['trace.id'] = context.traceId;
info['span.id'] = context.spanId;
}
return info;
})();
}
const logger = createLogger({
format: format.combine(tracingFormat(), format.json())
}); |
I think we can close this one since #736 has been closed ? |
@pauldraper Hi. What is a solution for @opentelemetry/api@0.18.1 ? we don't have |
You can get the currently active span by doing import { context, getSpan, Span } from "@opentelemetry/api";
const span: Span | undefined = getSpan(context.active()); |
Will this not require span.end()? |
Nope, you get a reference to an existing span or |
What's the solution for 1.0.4? There's no getSpan anymore. |
@janquijano it's still here, was moved from top level into trace namespace, see open-telemetry/opentelemetry-js-api#47 |
…sqs ReceiveMessage context handling (open-telemetry#1847) In `@aws-sdk/client-sqs` v3.316 the SQS client methods became async. This breaks the `utils.bindPromise` usage that attempts to propagate the SQS ReceiveMessage span context to the user's handler for the method's returned promise. Fixing that propagation is for open-telemetry#707 or another issue. This change is a workaround that skips the testing of that span context propagation feature. Fixes: open-telemetry#1477 Refs: open-telemetry#707 Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
Weekly downloads: 3.8 mln
https://www.npmjs.com/package/winston
The text was updated successfully, but these errors were encountered: