Help needed with the tracing API. #2
Replies: 2 comments 2 replies
-
Hello, In your second example do I need to close parent myself? |
Beta Was this translation helpful? Give feedback.
-
I just released version Here is the updated example: // Starts immediately the span.
trace.span("test") {
// it is [TracingEvent.Span.Local]
// Set span attributes.
it.attributes["key"] = "value"
// Send events that are related to the current span.
it.event(name = "event-1", level = Level.DEBUG)
it.debug(name = "event-1") // Same as event(name = "event-1", level = Level.DEBUG)
// Include attributes in the event.
it.event(name = "event-2", attributes = mapOf("key" to "value"))
it.event(name = "event-2") { attrs: MutableMap<String, Any?> ->
attrs["key"] = "value"
}
// Automatically closes at the end of te scope.
} Additionally, you can instantiate a span that represents the parent span. // Create the parent span.
// NOTICE: we do not start it, since it's already started.
val parent: TracingEvent.Span.Remote = trace.span(id = "ID_EXAMPLE", traceId = "TRACE_ID_EXAMPLE")
trace.span("test", parent) {
// Your logic here
} Introduced two variations of the
I hope now should be more clear. PS: if in your code you have specified the types (of the span) explicitly, you will have a breaking change. val parent = trace.span(id = "ID_EXAMPLE", traceId = "TRACE_ID_EXAMPLE") |
Beta Was this translation helpful? Give feedback.
-
Hello,
I would like to hear you opinions about the tracing API.
The current API looks like:
Or you can also do:
Also, I'm planning to start implementing the Metrics API, so I would like to hear your opinion.
What else should I provide?
Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions