-
Notifications
You must be signed in to change notification settings - Fork 833
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Span#addLink, for adding link after span start (#6084)
Co-authored-by: John Watson <jkwatson@gmail.com>
- Loading branch information
Showing
7 changed files
with
243 additions
and
64 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
...ions/incubator/src/main/java/io/opentelemetry/extension/incubator/trace/ExtendedSpan.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.extension.incubator.trace; | ||
|
||
import io.opentelemetry.api.common.Attributes; | ||
import io.opentelemetry.api.trace.Span; | ||
import io.opentelemetry.api.trace.SpanBuilder; | ||
import io.opentelemetry.api.trace.SpanContext; | ||
|
||
/** Extended {@link Span} with experimental APIs. */ | ||
public interface ExtendedSpan extends Span { | ||
|
||
/** | ||
* Adds a link to this {@code Span}. | ||
* | ||
* <p>Links are used to link {@link Span}s in different traces. Used (for example) in batching | ||
* operations, where a single batch handler processes multiple requests from different traces or | ||
* the same trace. | ||
* | ||
* <p>Implementations may ignore calls with an {@linkplain SpanContext#isValid() invalid span | ||
* context}. | ||
* | ||
* <p>Callers should prefer to add links before starting the span via {@link | ||
* SpanBuilder#addLink(SpanContext)} if possible. | ||
* | ||
* @param spanContext the context of the linked {@code Span}. | ||
* @return this. | ||
*/ | ||
default Span addLink(SpanContext spanContext) { | ||
return addLink(spanContext, Attributes.empty()); | ||
} | ||
|
||
/** | ||
* Adds a link to this {@code Span}. | ||
* | ||
* <p>Links are used to link {@link Span}s in different traces. Used (for example) in batching | ||
* operations, where a single batch handler processes multiple requests from different traces or | ||
* the same trace. | ||
* | ||
* <p>Implementations may ignore calls with an {@linkplain SpanContext#isValid() invalid span | ||
* context}. | ||
* | ||
* <p>Callers should prefer to add links before starting the span via {@link | ||
* SpanBuilder#addLink(SpanContext, Attributes)} if possible. | ||
* | ||
* @param spanContext the context of the linked {@code Span}. | ||
* @param attributes the attributes of the {@code Link}. | ||
* @return this. | ||
*/ | ||
default Span addLink(SpanContext spanContext, Attributes attributes) { | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.