Skip to content

Commit

Permalink
Add parent span support to tracing examples and tests
Browse files Browse the repository at this point in the history
Introduce a parent span for the "test" span in README and MainTests.kt to provide a more comprehensive tracing setup. This change ensures that the span hierarchy is clearly established and documented.
  • Loading branch information
smyrgeorge committed Oct 20, 2024
1 parent 453edd3 commit a17e231
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@ span.end()
Similarly to the logging API, we also support a more kotlin style API:

```kotlin
// Create the parent span.
// NOTICE: we do not start it, since it's already started.
val parent: TracingEvent.Span = trace.span("parent")
// Starts immediately the span.
trace.span("test") {
trace.span("test", parent) {
// Send events that are related to the current span.
it.event("this is a test event")
// Automatically closes at the end of te scope.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ class MainTests {
delay(1000)

RootLogger.Tracing.register(SimpleConsoleTracingAppender())
// Create the parent span.
// NOTICE: we do not start it, since it's already started.
val parent: TracingEvent.Span = trace.span("parent")
// Starts immediately the span.
trace.span("test") {
trace.span("test", parent) {
// Send events that are related to the current span.
it.event("this is a test event")
// Automatically closes at the end of te scope.
Expand Down

0 comments on commit a17e231

Please sign in to comment.