/** * * * <pre> * Collection of spans in the trace. * </pre> * * <code>repeated .google.devtools.cloudtrace.v1.TraceSpan spans = 3;</code> */ public Builder addSpans(com.google.devtools.cloudtrace.v1.TraceSpan.Builder builderForValue) { if (spansBuilder_ == null) { ensureSpansIsMutable(); spans_.add(builderForValue.build()); onChanged(); } else { spansBuilder_.addMessage(builderForValue.build()); } return this; } /**
/** * * * <pre> * Collection of spans in the trace. * </pre> * * <code>repeated .google.devtools.cloudtrace.v1.TraceSpan spans = 3;</code> */ public Builder addSpans( int index, com.google.devtools.cloudtrace.v1.TraceSpan.Builder builderForValue) { if (spansBuilder_ == null) { ensureSpansIsMutable(); spans_.add(index, builderForValue.build()); onChanged(); } else { spansBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * * * <pre> * Collection of spans in the trace. * </pre> * * <code>repeated .google.devtools.cloudtrace.v1.TraceSpan spans = 3;</code> */ public Builder setSpans( int index, com.google.devtools.cloudtrace.v1.TraceSpan.Builder builderForValue) { if (spansBuilder_ == null) { ensureSpansIsMutable(); spans_.set(index, builderForValue.build()); onChanged(); } else { spansBuilder_.setMessage(index, builderForValue.build()); } return this; } /**
.setProjectId(projectId) .setTraceId(formatTraceId(context.getTraceId())) .addSpans(spanBuilder.build());
.setProjectId(projectId) .setTraceId(formatTraceId(context.getTraceId())) .addSpans(spanBuilder.build());
/** * Converts a start span event into an API v1 trace message. * * @param projectId a string that contains the Google Cloud Platform project identifier. * @param context a span context that represents the event span. * @param parentContext a span context that represents the parent span of the event span. * @param spanKind the span kind of the event span. * @param name a string containing the name of the event span. * @param timestamp a timestamp that represents the start time of the event span. * @return a trace message that represents the start span event. */ public Trace generateStartSpan(String projectId, SpanContext context, SpanContext parentContext, SpanKind spanKind, String name, Timestamp timestamp) { TraceSpan.Builder spanBuilder = TraceSpan.newBuilder() .setSpanId(context.getSpanId().getSpanId()) .setKind(toSpanKindProto(spanKind)) .setName(name) .setStartTime(toTimestamp(timestamp)); if (parentContext.getTraceId().equals(context.getTraceId()) && parentContext.getSpanId().isValid()) { spanBuilder.setParentSpanId(parentContext.getSpanId().getSpanId()); } Trace.Builder traceBuilder = Trace.newBuilder() .setProjectId(projectId) .setTraceId(formatTraceId(context.getTraceId())) .addSpans(spanBuilder.build()); return traceBuilder.build(); }
/** * Converts a start span event into an API v1 trace message. * * @param projectId a string that contains the Google Cloud Platform project identifier. * @param context a trace context that represents the event span. * @param parentContext a trace context that represents the parent span of the event span. * @param spanKind the span kind of the event span. * @param name a string containing the name of the event span. * @param timestamp a timestamp that represents the start time of the event span. * @return a trace message that represents the start span event. */ public Trace generateStartSpan(String projectId, TraceContext context, TraceContext parentContext, SpanKind spanKind, String name, Timestamp timestamp) { TraceSpan.Builder spanBuilder = TraceSpan.newBuilder() .setSpanId(context.getSpanId().getSpanId()) .setKind(toSpanKindProto(spanKind)) .setName(name) .setStartTime(toTimestamp(timestamp)); if (parentContext.getTraceId().equals(context.getTraceId()) && parentContext.getSpanId().isValid()) { spanBuilder.setParentSpanId(parentContext.getSpanId().getSpanId()); } Trace.Builder traceBuilder = Trace.newBuilder() .setProjectId(projectId) .setTraceId(formatTraceId(context.getTraceId())) .addSpans(spanBuilder.build()); return traceBuilder.build(); }
/** * Converts a start span event into an API v1 trace message. * * @param projectId a string that contains the Google Cloud Platform project identifier. * @param context a span context that represents the event span. * @param parentContext a span context that represents the parent span of the event span. * @param spanKind the span kind of the event span. * @param name a string containing the name of the event span. * @param timestamp a timestamp that represents the start time of the event span. * @return a trace message that represents the start span event. */ public Trace generateStartSpan(String projectId, SpanContext context, SpanContext parentContext, SpanKind spanKind, String name, Timestamp timestamp) { TraceSpan.Builder spanBuilder = TraceSpan.newBuilder() .setSpanId(context.getSpanId().getSpanId()) .setKind(toSpanKindProto(spanKind)) .setName(name) .setStartTime(toTimestamp(timestamp)); if (parentContext.getTraceId().equals(context.getTraceId()) && parentContext.getSpanId().isValid()) { spanBuilder.setParentSpanId(parentContext.getSpanId().getSpanId()); } Trace.Builder traceBuilder = Trace.newBuilder() .setProjectId(projectId) .setTraceId(formatTraceId(context.getTraceId())) .addSpans(spanBuilder.build()); return traceBuilder.build(); }
/** * Converts a start span event into an API v1 trace message. * * @param projectId a string that contains the Google Cloud Platform project identifier. * @param context a span context that represents the event span. * @param parentContext a span context that represents the parent span of the event span. * @param spanKind the span kind of the event span. * @param name a string containing the name of the event span. * @param timestamp a timestamp that represents the start time of the event span. * @return a trace message that represents the start span event. */ public Trace generateStartSpan(String projectId, SpanContext context, SpanContext parentContext, SpanKind spanKind, String name, Timestamp timestamp) { TraceSpan.Builder spanBuilder = TraceSpan.newBuilder() .setSpanId(context.getSpanId().getSpanId()) .setKind(toSpanKindProto(spanKind)) .setName(name) .setStartTime(toTimestamp(timestamp)); if (parentContext.getTraceId().equals(context.getTraceId()) && parentContext.getSpanId().isValid()) { spanBuilder.setParentSpanId(parentContext.getSpanId().getSpanId()); } Trace.Builder traceBuilder = Trace.newBuilder() .setProjectId(projectId) .setTraceId(formatTraceId(context.getTraceId())) .addSpans(spanBuilder.build()); return traceBuilder.build(); }
/** * Converts a span label annotation event into an API v1 trace message. * * @param projectId a string that contains the Google Cloud Platform project identifier. * @param context a span context that represents the event span. * @param labels a labels containing the label annotations for the event span. * @return a trace message that represents the span label annotation event. */ public Trace generateAnnotateSpan(String projectId, SpanContext context, Labels labels) { TraceSpan.Builder spanBuilder = TraceSpan.newBuilder().setSpanId(context.getSpanId().getSpanId()); for (Label label : labels.getLabels()) { spanBuilder.putLabels(label.getKey(), label.getValue()); } Trace.Builder traceBuilder = Trace.newBuilder() .setProjectId(projectId) .setTraceId(formatTraceId(context.getTraceId())) .addSpans(spanBuilder.build()); return traceBuilder.build(); }
/** * Converts a span label annotation event into an API v1 trace message. * * @param projectId a string that contains the Google Cloud Platform project identifier. * @param context a span context that represents the event span. * @param labels a labels containing the label annotations for the event span. * @return a trace message that represents the span label annotation event. */ public Trace generateAnnotateSpan(String projectId, SpanContext context, Labels labels) { TraceSpan.Builder spanBuilder = TraceSpan.newBuilder().setSpanId(context.getSpanId().getSpanId()); for (Label label : labels.getLabels()) { spanBuilder.putLabels(label.getKey(), label.getValue()); } Trace.Builder traceBuilder = Trace.newBuilder() .setProjectId(projectId) .setTraceId(formatTraceId(context.getTraceId())) .addSpans(spanBuilder.build()); return traceBuilder.build(); }
/** * Converts a span label annotation event into an API v1 trace message. * * @param projectId a string that contains the Google Cloud Platform project identifier. * @param context a span context that represents the event span. * @param labels a labels containing the label annotations for the event span. * @return a trace message that represents the span label annotation event. */ public Trace generateAnnotateSpan(String projectId, SpanContext context, Labels labels) { TraceSpan.Builder spanBuilder = TraceSpan.newBuilder().setSpanId(context.getSpanId().getSpanId()); for (Label label : labels.getLabels()) { spanBuilder.putLabels(label.getKey(), label.getValue()); } Trace.Builder traceBuilder = Trace.newBuilder() .setProjectId(projectId) .setTraceId(formatTraceId(context.getTraceId())) .addSpans(spanBuilder.build()); return traceBuilder.build(); }
/** * Converts an end span event into an API v1 trace message. * * @param projectId a string that contains the Google Cloud Platform project identifier. * @param context a span context that represents the event span. * @param timestamp a timestamp that represents the end time of the event span. * @return a trace message that represents the end span event. */ public Trace generateEndSpan(String projectId, SpanContext context, Timestamp timestamp) { TraceSpan.Builder spanBuilder = TraceSpan.newBuilder() .setSpanId(context.getSpanId().getSpanId()) .setEndTime(toTimestamp(timestamp)); Trace.Builder traceBuilder = Trace.newBuilder() .setProjectId(projectId) .setTraceId(formatTraceId(context.getTraceId())) .addSpans(spanBuilder.build()); return traceBuilder.build(); }
/** * Converts a span label annotation event into an API v1 trace message. * * @param projectId a string that contains the Google Cloud Platform project identifier. * @param context a trace context that represents the event span. * @param labels a labels containing the label annotations for the event span. * @return a trace message that represents the span label annotation event. */ public Trace generateAnnotateSpan(String projectId, TraceContext context, Labels labels) { TraceSpan.Builder spanBuilder = TraceSpan.newBuilder().setSpanId(context.getSpanId().getSpanId()); for (Label label : labels.getLabels()) { spanBuilder.putLabels(label.getKey(), label.getValue()); } Trace.Builder traceBuilder = Trace.newBuilder() .setProjectId(projectId) .setTraceId(formatTraceId(context.getTraceId())) .addSpans(spanBuilder.build()); return traceBuilder.build(); }
/** * Converts an end span event into an API v1 trace message. * * @param projectId a string that contains the Google Cloud Platform project identifier. * @param context a span context that represents the event span. * @param timestamp a timestamp that represents the end time of the event span. * @return a trace message that represents the end span event. */ public Trace generateEndSpan(String projectId, SpanContext context, Timestamp timestamp) { TraceSpan.Builder spanBuilder = TraceSpan.newBuilder() .setSpanId(context.getSpanId().getSpanId()) .setEndTime(toTimestamp(timestamp)); Trace.Builder traceBuilder = Trace.newBuilder() .setProjectId(projectId) .setTraceId(formatTraceId(context.getTraceId())) .addSpans(spanBuilder.build()); return traceBuilder.build(); }
/** * Converts an end span event into an API v1 trace message. * * @param projectId a string that contains the Google Cloud Platform project identifier. * @param context a span context that represents the event span. * @param timestamp a timestamp that represents the end time of the event span. * @return a trace message that represents the end span event. */ public Trace generateEndSpan(String projectId, SpanContext context, Timestamp timestamp) { TraceSpan.Builder spanBuilder = TraceSpan.newBuilder() .setSpanId(context.getSpanId().getSpanId()) .setEndTime(toTimestamp(timestamp)); Trace.Builder traceBuilder = Trace.newBuilder() .setProjectId(projectId) .setTraceId(formatTraceId(context.getTraceId())) .addSpans(spanBuilder.build()); return traceBuilder.build(); }
/** * Converts an end span event into an API v1 trace message. * * @param projectId a string that contains the Google Cloud Platform project identifier. * @param context a trace context that represents the event span. * @param timestamp a timestamp that represents the end time of the event span. * @return a trace message that represents the end span event. */ public Trace generateEndSpan(String projectId, TraceContext context, Timestamp timestamp) { TraceSpan.Builder spanBuilder = TraceSpan.newBuilder() .setSpanId(context.getSpanId().getSpanId()) .setEndTime(toTimestamp(timestamp)); Trace.Builder traceBuilder = Trace.newBuilder() .setProjectId(projectId) .setTraceId(formatTraceId(context.getTraceId())) .addSpans(spanBuilder.build()); return traceBuilder.build(); }
protected TraceSpan convert(Span span) { Span adjustedSpan = span; for (SpanAdjuster adjuster : this.spanAdjusters) { adjustedSpan = adjuster.adjust(adjustedSpan); } TraceSpan.Builder builder = TraceSpan.newBuilder(); // Set name if (StringUtils.hasText(adjustedSpan.getName())) { builder.setName(adjustedSpan.getName()); } TraceSpan.SpanKind kind = getKind(adjustedSpan); builder.setKind(kind); builder.setSpanId(adjustedSpan.getSpanId()); rewriteIds(adjustedSpan, kind, builder); writeStartEndTime(adjustedSpan, builder); builder.putAllLabels(this.labelExtractor.extract(adjustedSpan, builder.getKind(), this.instanceId)); return builder.build(); }
private void appendSpan(Trace.Builder builder, Span zipkinSpan) { TraceSpan span = translator.translate(TraceSpan.newBuilder(), zipkinSpan).build(); builder.addSpans(span); }
/** * Converts a Zipkin Span into a Stackdriver Trace Span. * * @param zipkinSpan The Zipkin Span. * @return A Stackdriver Trace Span. */ public TraceSpan translate(Span zipkinSpan) { TraceSpan.Builder builder = TraceSpan.newBuilder(); translate(builder, zipkinSpan); return builder.build(); }