Java Code Examples for io.opencensus.trace.Annotation#fromDescriptionAndAttributes()
The following examples show how to use
io.opencensus.trace.Annotation#fromDescriptionAndAttributes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TelemetryUtils.java From meghanada-server with GNU General Public License v3.0 | 6 votes |
public static ParentSpan startExplicitParentSpan(String name) { Span span; if (enabledExporter) { span = tracer.spanBuilderWithExplicitParent(name, null).startSpan(); } else { span = tracer.spanBuilderWithExplicitParent(name, null).setRecordEvents(true).startSpan(); } span.addAnnotation(getBaseAnnotation()); Annotation vmAnno = Annotation.fromDescriptionAndAttributes("java.vm properties", javaAttributeMap); span.addAnnotation(vmAnno); Annotation osAnno = Annotation.fromDescriptionAndAttributes("os properties", osAttributeMap); span.addAnnotation(osAnno); return new ParentSpan(span, name); }
Example 2
Source File: TelemetryUtils.java From meghanada-server with GNU General Public License v3.0 | 5 votes |
private static Annotation getBaseAnnotation() { if (isNull(meghanadaAnnotation)) { String version = System.getProperty("meghanada-server.version", ""); String uid = System.getProperty("meghanada-server.uid", ""); Map<String, AttributeValue> m = new HashMap<>(2); m.put("meghanada-server.version", AttributeValue.stringAttributeValue(version)); m.put("meghanada-server.uid", AttributeValue.stringAttributeValue(uid)); meghanadaAnnotation = Annotation.fromDescriptionAndAttributes("meghanada properties", m); } return meghanadaAnnotation; }
Example 3
Source File: TelemetryUtils.java From meghanada-server with GNU General Public License v3.0 | 5 votes |
public static void setStatusINTERNAL(String message) { // add error info annotation Span current = tracer.getCurrentSpan(); current.addAnnotation(getBaseAnnotation()); HashMap<String, AttributeValue> newMap = new HashMap<>(javaAttributeMap); newMap.put("java.vm.memory", AttributeValue.stringAttributeValue(Config.getMemoryString())); Annotation vmAnno = Annotation.fromDescriptionAndAttributes("java.vm properties", newMap); current.addAnnotation(vmAnno); Annotation osAnno = Annotation.fromDescriptionAndAttributes("os properties", osAttributeMap); current.addAnnotation(osAnno); TelemetryUtils.setStatus(Status.INTERNAL.withDescription(message)); }
Example 4
Source File: SpanOperationsBenchmark.java From opencensus-java with Apache License 2.0 | 5 votes |
/** Add an annotation with an annotation. */ @Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public Span addAnnotationWithAnnotation(Data data) { Span span = data.annotationSpanAnnotation; Annotation annotation = Annotation.fromDescriptionAndAttributes(ANNOTATION_DESCRIPTION, data.attributeMap); span.addAnnotation(annotation); return span; }
Example 5
Source File: BasicDataBenchmark.java From opencensus-java with Apache License 2.0 | 5 votes |
/** Create an Annotation. */ @Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) public Annotation createAnnotation(Data data) { return Annotation.fromDescriptionAndAttributes(ANNOTATION_DESCRIPTION, data.attributeMap); }
Example 6
Source File: TelemetryUtils.java From meghanada-server with GNU General Public License v3.0 | 4 votes |
public Annotation build(String description) { return Annotation.fromDescriptionAndAttributes(description, this.map); }