Skip to main content

Telemetry

c.Telemetry calls the API's Telemetry group. Telemetry through the controller, such as the spans of a trace.

Methods​

MethodReturnsPermissionDescription
Get(ctx, id, params)*Response[TraceResponse]trace:readGet the spans of a trace.

Get​

func (s *TelemetryService) Get(
ctx context.Context,
id string,
params TelemetryGetParams,
) (*Response[TraceResponse], error)

Get the spans of a trace.

Returns each span of a trace, read from the tracing backend at telemetry.tracing.url. The backend gets the spans a few seconds after the request, so a trace of a request that just ran can be not found yet. A token with a target scope gets a trace only when each target that the trace records is in its scope.

It sends GET /api/telemetry/trace/{id}, and needs the permission trace:read.

The examples of the method's definition:

Get the spans of a trace, go run telemetry.go get:

resp, err := c.Telemetry.Get(ctx, "26e448c9dbe1c4a8d216a98c675079c9", client.TelemetryGetParams{})

Get the spans of a trace, with --id 26e448c9dbe1c4a8d216a98c675079c9 --all, go run telemetry.go get-2:

resp, err := c.Telemetry.Get(ctx, "26e448c9dbe1c4a8d216a98c675079c9", client.TelemetryGetParams{All: true})

Types​

The fields of each type are the properties of its schema in the API's spec.

SpanStatus​

SpanStatus is whether the work of a span failed.

A string, one of ok, error.

TraceNode​

FieldTypeDescription
Children[]TraceNodeThe spans under this one, in start order.
ClockSkewstringHow far the span and the spans under it were moved forward, as a Go duration, because the span started before its parent: the clock of its host is behind. Empty when the span was not moved.
DetailstringWhat the span acted on, as key=value pairs, led by error= on a failed span.
DurationstringHow long the span took, as a Go duration.
NamestringThe name of the span, such as job.process.
OnstringWhat ran the span: the role of its service, such as controller, agent or cli.
SpanTraceSpan
StatusstringThe job's status on a job.process, changed or unchanged on a behavior write, and ok or error on other spans.

TraceResponse​

FieldTypeDescription
DurationstringFrom the start of the first span to the end of the last, as a Go duration.
FailedSpansintThe number of spans that failed.
NATSCallsintThe number of NATS calls left out, the bookkeeping of the job queue. all shows them.
NATSTimestringThe time that the NATS calls left out took, as a Go duration.
Services[]stringThe services that made the spans, in the order each first appears.
Spans[]TraceNodeThe spans that have no parent in the trace, each with its children, in start order.
Startedtime.TimeWhen the first span started.
TraceIDstringThe trace ID.

TraceSpan​

FieldTypeDescription
Attributesmap[string]stringThe attributes of the span, each as text.
DurationMSfloat64How long the span took, in milliseconds.
KindstringThe span kind, such as server, client, producer or consumer.
NamestringThe name of the span, such as job.process.
ParentSpanIDstringThe ID of the parent span. Empty for the root.
ServicestringThe service that made the span, such as osapi-agent.
SpanIDstringThe span ID.
StartTimetime.TimeWhen the span started.
StatusSpanStatusSpanStatus is whether the work of a span failed.
StatusMessagestringThe error of a failed span.

Example​

examples/sdk/client/telemetry.go runs each example of this page. With no argument, it lists them.