-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddingSpanAttributes.java
More file actions
35 lines (32 loc) · 1.37 KB
/
AddingSpanAttributes.java
File metadata and controls
35 lines (32 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.instrumentation.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* This annotation marks that an execution of this method or constructor is able to add attributes
* to the current span {@link io.opentelemetry.api.trace.Span}.
*
* <p>Application developers can use this annotation to signal OpenTelemetry auto-instrumentation
* that attributes annotated with the {@link
* io.opentelemetry.instrumentation.annotations.SpanAttribute} should be detected and added to the
* current span.
*
* <p>If no span is currently active no new span will be created, and no attributes will be
* extracted.
*
* <p>Similar to {@link
* io.opentelemetry.api.trace.Span#setAttribute(io.opentelemetry.api.common.AttributeKey,
* java.lang.Object) Span.setAttribute() } methods, if the key is already mapped to a value the old
* value is replaced by the extracted value.
*
* <p>If you are a library developer, then probably you should NOT use this annotation, because it
* is non-functional without some form of auto-instrumentation.
*/
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
@Retention(RetentionPolicy.RUNTIME)
public @interface AddingSpanAttributes {}