/** Basic constructor holding components for implementing Sleuth's {@link Tracer} interface. */ public OpenCensusSleuthTracer( Sampler defaultSampler, Random random, SpanNamer spanNamer, SpanLogger spanLogger, SpanReporter spanReporter, TraceKeys traceKeys, boolean traceId128) { this.defaultSampler = defaultSampler; this.random = random; this.spanNamer = spanNamer; this.spanLogger = spanLogger; this.spanReporter = spanReporter; this.traceId128 = traceId128; this.traceKeys = traceKeys != null ? traceKeys : new TraceKeys(); }
/** * Builds a * @param traceKeys Sleuth's {@link TraceKeys} * @return A mapping of Sleuth's HTTP trace keys to Stackdriver label keys */ public static Map<String, String> buildLabelRenameMapFromTraceKeys(TraceKeys traceKeys) { Map<String, String> labelRenameMap = new HashMap<>(); TraceKeys.Http httpKeys = traceKeys.getHttp(); labelRenameMap = new HashMap<>(); labelRenameMap.put(httpKeys.getHost(), "/http/host"); labelRenameMap.put(httpKeys.getMethod(), "/http/method"); labelRenameMap.put(httpKeys.getStatusCode(), "/http/status_code"); labelRenameMap.put(httpKeys.getRequestSize(), "/http/request/size"); labelRenameMap.put(httpKeys.getResponseSize(), "/http/response/size"); labelRenameMap.put(httpKeys.getUrl(), "/http/url"); return labelRenameMap; }