/** Override the customize the span based on the start of a request. */ protected <ReqT, RespT> void onStart(MethodDescriptor<ReqT, RespT> method, CallOptions options, Metadata headers, SpanCustomizer span) { span.name(spanName(method)); } }
/** {@inheritDoc} */ @Override public SpanCustomizer name(String name) { return tracer.currentSpanCustomizer().name(name); }
@Override public void parse(MethodInvocation pjp, NewSpan newSpan, SpanCustomizer span) { String name = newSpan == null || StringUtils.isEmpty(newSpan.name()) ? pjp.getMethod().getName() : newSpan.name(); String changedName = SpanNameUtil.toLowerHyphen(name); if (log.isDebugEnabled()) { log.debug("For the class [" + pjp.getThis().getClass() + "] method " + "[" + pjp.getMethod().getName() + "] will name the span [" + changedName + "]"); } span.name(changedName); }
/** Override the customize the span based on the start of a request. */ protected <ReqT, RespT> void onStart(ServerCall<ReqT, RespT> call, Metadata headers, SpanCustomizer span) { span.name(spanName(call.getMethodDescriptor())); } }
@Override public <Req> void request(HttpAdapter<Req, ?> adapter, Req req, SpanCustomizer customizer) { customizer.name(adapter.method(req).toLowerCase() + " " + adapter.path(req)); customizer.tag("http.url", adapter.url(req)); // just the path is logged by default customizer.tag("context.visible", String.valueOf(currentTraceContext.get() != null)); customizer.tag("request_customizer.is_span", (customizer instanceof brave.Span) + ""); }
/** * Override to change what data from the http request are parsed into the span representing it. By * default, this sets the span name to the http method and tags "http.method" and "http.path". * * <p>If you only want to change the span name, you can override {@link #spanName(HttpAdapter, * Object)} instead. * * @see #spanName(HttpAdapter, Object) */ // Eventhough the default span name is the method, we have no way of knowing that a user hasn't // overwritten the name to something else. If that occurs during response parsing, it is too late // to go back and get the http method. Adding http method by default ensures span naming doesn't // prevent basic HTTP info from being visible. A cost of this is another tag, but it is small with // very limited cardinality. Moreover, users who care strictly about size can override this. public <Req> void request(HttpAdapter<Req, ?> adapter, Req req, SpanCustomizer customizer) { customizer.name(spanName(adapter, req)); String method = adapter.method(req); if (method != null) customizer.tag("http.method", method); String path = adapter.path(req); if (path != null) customizer.tag("http.path", path); }
statusCode = adapter.statusCodeAsInt(res); String nameFromRoute = spanNameFromRoute(adapter, res, statusCode); if (nameFromRoute != null) customizer.name(nameFromRoute); String maybeStatus = maybeStatusAsString(statusCode, 299); if (maybeStatus != null) customizer.tag("http.status_code", maybeStatus);
/** Override the customize the span based on the start of a request. */ protected <ReqT, RespT> void onStart(MethodDescriptor<ReqT, RespT> method, CallOptions options, Metadata headers, SpanCustomizer span) { span.name(spanName(method)); } }
/** {@inheritDoc} */ @Override public SpanCustomizer name(String name) { return tracer.currentSpanCustomizer().name(name); }
@Override public void parse(MethodInvocation pjp, NewSpan newSpan, SpanCustomizer span) { String name = newSpan == null || StringUtils.isEmpty(newSpan.name()) ? pjp.getMethod().getName() : newSpan.name(); String changedName = SpanNameUtil.toLowerHyphen(name); if (log.isDebugEnabled()) { log.debug("For the class [" + pjp.getThis().getClass() + "] method " + "[" + pjp.getMethod().getName() + "] will name the span [" + changedName + "]"); } span.name(changedName); }
/** Override the customize the span based on the start of a request. */ protected <ReqT, RespT> void onStart(ServerCall<ReqT, RespT> call, Metadata headers, SpanCustomizer span) { span.name(spanName(call.getMethodDescriptor())); } }
@Override public <Req> void request(HttpAdapter<Req, ?> adapter, Req req, SpanCustomizer customizer) { customizer.name(adapter.method(req).toLowerCase() + " " + adapter.path(req)); customizer.tag("http.url", adapter.url(req)); // just the path is logged by default customizer.tag("context.visible", String.valueOf(currentTraceContext.get() != null)); customizer.tag("request_customizer.is_span", (customizer instanceof brave.Span) + ""); }
void onRequest(Exchange exchange, SpanCustomizer span) { span.name(spanName); span.tag("camel.client.endpoint.url", url); span.tag("camel.client.exchange.id", exchange.getExchangeId()); span.tag("camel.client.exchange.pattern", exchange.getPattern().name()); if (eventNotifier.isIncludeMessageBody() || eventNotifier.isIncludeMessageBodyStreams()) { boolean streams = eventNotifier.isIncludeMessageBodyStreams(); StreamCache cache = prepareBodyForLogging(exchange, streams); String body = MessageHelper.extractBodyForLogging(exchange.hasOut() ? exchange.getOut() : exchange.getIn(), "", streams, streams); span.tag("camel.client.exchange.message.request.body", body); if (cache != null) { cache.reset(); } } } }
void onRequest(Exchange exchange, SpanCustomizer span) { span.name(spanName); span.tag("camel.server.endpoint.url", url); span.tag("camel.server.exchange.id", exchange.getExchangeId()); span.tag("camel.server.exchange.pattern", exchange.getPattern().name()); if (eventNotifier.isIncludeMessageBody() || eventNotifier.isIncludeMessageBodyStreams()) { boolean streams = eventNotifier.isIncludeMessageBodyStreams(); StreamCache cache = prepareBodyForLogging(exchange, streams); String body = MessageHelper.extractBodyForLogging(exchange.hasOut() ? exchange.getOut() : exchange.getIn(), "", streams, streams); span.tag("camel.server.exchange.message.request.body", body); if (cache != null) { cache.reset(); } } } }