-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Improved custom tracing span API (#10)
* feat: Improved custom tracing span API * Drop the tracing context, provide access to parent span if needed, update docs * Improved javadoc * review feedback --------- Co-authored-by: Johan Andrén <[email protected]>
- Loading branch information
1 parent
e346b53
commit f4fba08
Showing
37 changed files
with
404 additions
and
270 deletions.
There are no files selected for viewing
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
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
20 changes: 20 additions & 0 deletions
20
akka-javasdk-testkit/src/main/scala/akka/javasdk/testkit/impl/TestKitTracing.scala
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,20 @@ | ||
/* | ||
* Copyright (C) 2021-2024 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package akka.javasdk.testkit.impl | ||
|
||
import akka.javasdk.Tracing | ||
import io.opentelemetry.api.trace.Span | ||
|
||
import java.util.Optional | ||
|
||
/** | ||
* INTERNAL API | ||
*/ | ||
object TestKitTracing extends Tracing { | ||
|
||
override def startSpan(name: String): Optional[Span] = Optional.empty() | ||
|
||
override def parentSpan(): Optional[Span] = Optional.empty() | ||
} |
27 changes: 0 additions & 27 deletions
27
akka-javasdk-tests/src/test/java/akkajavasdk/components/tracing/Batches.java
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
akka-javasdk-tests/src/test/java/akkajavasdk/components/tracing/Traces.java
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,38 @@ | ||
/* | ||
* Copyright (C) 2021-2024 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package akka.javasdk; | ||
|
||
import akka.annotation.DoNotInherit; | ||
import io.opentelemetry.api.trace.Span; | ||
|
||
import java.util.Optional; | ||
|
||
/** | ||
* Factory for manually creating open telemetry spans in addition to those automatically provided by | ||
* the runtime and SDK. | ||
* | ||
* <p>Not for user extension. Injectable into endpoint constructors or available through component | ||
* command contexts. | ||
*/ | ||
@DoNotInherit | ||
public interface Tracing { | ||
/** | ||
* If tracing is enabled, create and start a new custom span with the given name, setting a parent | ||
* for the span is done automatically so that the span is a child of the incoming request or | ||
* component call. | ||
* | ||
* @return Optional of the span if tracing is enabled, empty option if tracing is not enabled. | ||
*/ | ||
Optional<Span> startSpan(String name); | ||
|
||
/** | ||
* If tracing is enabled, this returns the current parent span, to use for propagating trace | ||
* parent through third party integrations. This span should only be used for observing, ending it | ||
* or marking it as failed etc. is managed by the SDK and the runtime. | ||
* | ||
* @see {{@link #startSpan(String)}} for creating a custom span tied to some logic in a service. | ||
*/ | ||
Optional<Span> parentSpan(); | ||
} |
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
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.