Skip to content

The OpenTelemetry Data Model: Spans, Metric Points and Log Records: OTCA practice questions

OpenTelemetry describes every signal with a shared vocabulary. Attributes are key-value pairs whose keys are non-empty strings and whose values are AnyValue types: strings, booleans, doubles, signed 64-bit integers, byte arrays, arrays and maps. Two attached structures appear on all signals.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What The OpenTelemetry Data Model: Spans, Metric Points and Log Records covers in OTCA

OpenTelemetry describes every signal with a shared vocabulary. Attributes are key-value pairs whose keys are non-empty strings and whose values are AnyValue types: strings, booleans, doubles, signed 64-bit integers, byte arrays, arrays and maps. Two attached structures appear on all signals. The Resource describes the entity that produced the telemetry, such as a service in a container, and the instrumentation scope identifies the code unit that emitted it through a tuple of name, version, schema_url and attributes. You pick the scope when you ask a provider for a Tracer, Meter or Logger.

A span carries a name, an immutable SpanContext, an optional parent, a SpanKind, start and end timestamps, attributes, links and timestamped events, plus a status. The SpanContext holds a 16-byte TraceId and an 8-byte SpanId, each of which must contain at least one non-zero byte, together with TraceFlags and TraceState. In hex these IDs become 32 and 16 lowercase characters. SpanKind defaults to INTERNAL; the other kinds are CLIENT, SERVER, PRODUCER and CONSUMER. Status starts as Unset, can be set to Error, or can be set to Ok by an application developer, and the codes follow the total order Ok over Error over Unset, so an explicit Ok is final.

Metric streams use four basic point kinds: Sum, Gauge, Histogram and Exponential Histogram, with Summary kept for compatibility with older formats. A Sum has an aggregation temporality, either delta or cumulative, and a flag saying whether it is monotonic. Delta streams report non-overlapping windows, while cumulative streams keep reporting the running total since a start time that is often close to process start. A Gauge reports the last sampled value and has no temporality. Histograms carry count, sum, optional min and max, and bucket counts; bucket upper bounds are inclusive and lower bounds exclusive. Exponential histograms compress bucket boundaries through a scale parameter. Data points may also carry exemplars that link a measurement to a trace and span.

A log record has named top-level fields and attribute collections. Timestamp is when the event happened at the source, while ObservedTimestamp is when OpenTelemetry observed it, which matters when the Collector reads older lines from a file. TraceId, SpanId and TraceFlags correlate a record with a trace. SeverityText keeps the original level string, and SeverityNumber normalizes it into ranges from TRACE (1 to 4) up to FATAL (21 to 24), which is the field to use for comparisons. Body may hold a plain message or structured AnyValue data, and a non-empty EventName marks the record as an event.

A frequent confusion is mixing up byte lengths with hex lengths for IDs, or assuming that Unset means failure. Another is treating a Gauge like a Sum: only Sums and histograms define temporality.

Key points

  • A TraceId is 16 bytes and a SpanId is 8 bytes, and each must contain at least one non-zero byte.
  • Span status defaults to Unset, and an explicit Ok overrides later attempts to set Error.
  • Sum and Histogram points carry delta or cumulative temporality, while a Gauge reports the last sampled value.
  • Explicit histogram buckets include their upper bound and exclude their lower bound.
  • LogRecord Timestamp is the source time and ObservedTimestamp is the time OpenTelemetry saw the event.

Three sample questions

22 OTCA questions on The OpenTelemetry Data Model: Spans, Metric Points and Log Records, 22 with explanations. How practice works

Question 1

What is the primary purpose of a Span Link in OpenTelemetry?
  1. A.To mark specific timed events within a Span.
  2. B.To relate a Span to other, causally related Spans.
  3. C.To indicate the status of a Span as Unset, Error or Ok.
  4. D.To denote the start and end time of a Span.

Correct answer: B

The Traces concepts page says "Links exist so that you can associate one span with one or more spans, implying a causal relationship", and the specification overview says a span may be linked to other spans that are causally related, inside one trace or across traces. Why the other options are wrong. "To mark specific timed events within a Span.": timed points inside a span are span events, which the Traces page describes as structured log messages on a span. "To indicate the status of a Span as Unset, Error o…": Unset, Error and Ok are the values of span status, a different span field. "To denote the start and end time of a Span.": start and end timestamps are their own span fields; links do not carry them.

Sources: OpenTelemetry docs: Traces, OpenTelemetry spec: Overview

Question 2

In an ExponentialHistogram, how are negative values handled?
  1. A.Negative values are bucketed by absolute value in a separate range, same scale.
  2. B.Negative values are ignored and not represented in the histogram.
  3. C.Negative values are stored in the same buckets as positive values but with negative counts.
  4. D.Negative values are combined with positive values in a single range.

Correct answer: A

The Metrics Data Model spec says the positive and negative ranges of an ExponentialHistogram are expressed separately, and "Negative values are mapped by their absolute value into the negative range using the same scale as the positive range". Why the other options are wrong. "Negative values are ignored and not represented in…": negative values are kept, in their own range. "Negative values are stored in the same buckets as…": bucket counts are never negative; negative values go to a separate range. "Negative values are combined with positive values…": the two ranges are separate, not combined.

Sources: OpenTelemetry spec: Metrics Data Model, OpenTelemetry spec: Metrics SDK

Question 3

When a span is linked to another span, what does the Link record to identify the linked span?
  1. A.Only the linked span's name
  2. B.Its SpanContext, plus optional attributes
  3. C.The linked span's resource attributes
  4. D.The parent span ID of the current span, plus its name

Correct answer: B

The Tracing API spec says a Link "is structurally defined by the following properties: SpanContext of the Span to link to. Zero or more Attributes further describing the link." Why the other options are wrong. "Only the linked span's name": span names are not unique and are not used to identify linked spans. "The linked span's resource attributes": resource attributes describe the producing entity, not the identity of one span. "The parent span ID of the current span, plus its n…": the parent span ID belongs to the current span's own parent, not to the linked span.

Sources: OpenTelemetry spec: Tracing API, OpenTelemetry spec: Overview

Practice this topic

Focus mode keeps every question on The OpenTelemetry Data Model: Spans, Metric Points and Log Records until you leave it. 10 free guest answers, then a free account; no credit card.

Or open OTCA practice across all topics.

Sources

The explanation above was checked against these official documents.

Frequently asked questions

Which log field should be used to filter records by severity?

SeverityNumber. It is normalized so that larger numbers mean more severe events, and the Logs Data Model says comparisons should use it. SeverityText keeps the source spelling and is better suited for display.

Does a Gauge have an aggregation temporality?

No. Temporality and the monotonic flag belong to Sums, and temporality also applies to histograms. A Gauge reports the last sampled value for its time window.