///|
fn _trace_readme_get_tracer() -> Tracer {
TracerProvider::noop().tracer("moonbit-community/example-library")
}///|
async fn _trace_readme_span_lifecycle() -> Unit {
let tracer = TracerProvider::noop().tracer("example")
let builder = tracer
.span_builder("http.request")
.with_kind(Server)
.with_attributes([
@common.KeyValue::new("http.request.method", String("GET")),
])
let span = tracer.build(builder)
span.add_event("handler.start")
span.set_status(Status::ok())
span.end()
}fn Link::new(span_context : SpanContext, attributes? : ArrayView[KeyValue], dropped_attributes_count? : Int) -> Linkpub struct Span {
span_context_fn : () -> SpanContext
context_fn : () -> Context
is_recording_fn : () -> Bool
has_ended_fn : () -> Bool
add_event_fn : (StringView, Int64, ArrayView[KeyValue]) -> Unit
set_attribute_fn : (KeyValue) -> Unit
set_status_fn : (Status) -> Unit
update_name_fn : (StringView) -> Unit
add_link_fn : (SpanContext, ArrayView[KeyValue]) -> Unit
end_fn : async (Int64) -> Unit
}fn Span::add_link(self : Span, span_context : SpanContext, attributes? : ArrayView[KeyValue]) -> Unitfn Span::from_functions(span_context_fn : () -> SpanContext, context_fn : () -> Context, is_recording_fn : () -> Bool, has_ended_fn : () -> Bool, add_event_fn : (StringView, Int64, ArrayView[KeyValue]) -> Unit, set_attribute_fn : (KeyValue) -> Unit, set_status_fn : (Status) -> Unit, update_name_fn : (StringView) -> Unit, add_link_fn : (SpanContext, ArrayView[KeyValue]) -> Unit, end_fn : async (Int64) -> Unit) -> Spanfn SpanBuilder::with_attributes(self : SpanBuilder, attributes : ArrayView[KeyValue]) -> SpanBuilderfn Tracer::build_with_context(self : Tracer, builder : SpanBuilder, parent_context : Context) -> Spanasync fn[T] Tracer::in_span_with_builder(self : Tracer, builder : SpanBuilder, parent_context : Context, f : async (Context) -> T) -> Tfn TracerProvider::from_functions(tracer_with_scope_fn : (InstrumentationScope) -> Tracer) -> TracerProviderThe MoonBit implementation of OpenTelemetry.
Dependencies