Berserk Docs

OTEL Field Mapping

How OpenTelemetry Protocol fields map to Berserk columns for traces, logs, and metrics

Berserk converts OTLP data into rows with the following conventions:

  • Field names use snake_case
  • Timestamps are stored as DateTime (nanoseconds since epoch)
  • Durations are stored as Timespan (100-nanosecond ticks)
  • IDs (trace, span) are hex-encoded strings
  • Attribute keys are stored as-is (e.g., "http.method" stays as a flat key under attributes). Dotted-path shortcuts let you also access them as attributes.http.method.
  • Empty/default fields are omitted to save space

Common Structures

Resource

resource: {
  attributes: {
    "service.name": "my-service",
    "host.name": "host-1"
  },
  dropped_attributes_count: 5  // only if > 0
}

Scope

scope: {
  name: "opentelemetry-java",
  version: "1.25.0",
  attributes: {                 // only if non-empty
    "custom.attr": "value"
  }
}

Attributes

All attributes (span, log, event, link) store keys as flat strings:

attributes: {
  "http.method": "GET",
  "http.status_code": 200
}

Accessible via both attributes.['http.method'] (bracket notation) and attributes.http.method (dotted shortcut).

Traces (Spans)

Each OTLP span becomes one row.

OTEL FieldBerserk FieldTypeNotes
start_time_unix_nanostart_timeDateTimeSpan start timestamp
end_time_unix_nanoend_timeDateTimeSpan end timestamp
end_time_unix_nano$timeDateTimePrimary timestamp (copy of end_time)
(computed)$time_ingestDateTimeIngestion timestamp
(computed)durationTimespan(end_time - start_time) / 100
trace_idtrace_idStringHex-encoded
span_idspan_idStringHex-encoded
parent_span_idparent_span_idStringHex-encoded, omitted if empty
namenameString
kindkindStringINTERNAL, SERVER, CLIENT, PRODUCER, CONSUMER
trace_statetrace_stateStringW3C trace state
statusstatusPropertybag{code: "OK"/"ERROR"/"UNSET", message: "..."}
flags (bit 0)sampledBooleanOnly if sampled flag is set
flags (bits 1-31)flagsLongOnly if uninterpreted bits remain
attributesattributesPropertybagFlat keys
resourceresourcePropertybagSee Resource structure
scopescopePropertybagSee Scope structure
eventseventsArraySee Events below
linkslinksArraySee Links below
dropped_*_countdropped_*_countLongOnly if > 0

Events

Each event in the events array is a propertybag with time, name, attributes, and optional dropped_attributes_count.

Each link in the links array is a propertybag with trace_id, span_id, optional trace_state, sampled, is_remote, flags, attributes, and optional dropped_attributes_count.

Example

{
  "$time": datetime(2024-01-15T10:30:00.150000000Z),
  "start_time": datetime(2024-01-15T10:30:00.000000000Z),
  "end_time": datetime(2024-01-15T10:30:00.150000000Z),
  "$time_ingest": datetime(2024-01-15T10:31:00.000000000Z),
  "trace_id": "0af7651916cd43dd8448eb211c80319c",
  "span_id": "b7ad6b7169203331",
  "parent_span_id": "00f067aa0ba902b7",
  "name": "GET /api/users",
  "kind": "SERVER",
  "duration": timespan(150ms),
  "status": { "code": "OK" },
  "attributes": {
    "http.method": "GET",
    "http.status_code": 200
  },
  "resource": {
    "attributes": {
      "service.name": "user-service"
    }
  }
}

Logs

Each OTLP log record becomes one row.

OTEL FieldBerserk FieldTypeNotes
time_unix_nano$timeDateTimeFalls back to current time if 0
observed_time_unix_nanoobserved_timeDateTime
(computed)$time_ingestDateTimeIngestion timestamp
trace_idtrace_idStringHex-encoded, for log-trace correlation
span_idspan_idStringHex-encoded
severity_numberseverity_numberLong1-24 per OTEL spec
severity_textseverity_textStringINFO, ERROR, etc.
bodybodyDynamicString, object, or array
flags (bit 0)sampledBooleanOnly if sampled flag is set
flags (bits 1-31)flagsLongOnly if uninterpreted bits remain
attributesattributesPropertybagFlat keys
resourceresourcePropertybagSee Resource structure
scopescopePropertybagSee Scope structure
dropped_attributes_countdropped_attributes_countLongOnly if > 0

Example

{
  "$time": datetime(2024-01-15T10:30:00.000000000Z),
  "$time_ingest": datetime(2024-01-15T10:31:00.000000000Z),
  "severity_number": 9,
  "severity_text": "INFO",
  "body": "User login successful",
  "trace_id": "0af7651916cd43dd8448eb211c80319c",
  "attributes": {
    "user.id": "12345"
  },
  "resource": {
    "attributes": {
      "service.name": "auth-service"
    }
  }
}

Metrics

Each OTLP metric data point becomes one row. The structure varies by metric type.

Common Fields

OTEL FieldBerserk FieldTypeNotes
time_unix_nano$timeDateTimeData point timestamp
(computed)$time_ingestDateTimeIngestion timestamp
start_time_unix_nanostart_timeDateTimeAggregation window start
(multiple)metricPropertybag{name, type, description, unit}
attributesattributesPropertybagFlat keys, data point attributes
resourceresourcePropertybagSee Resource structure
scopescopePropertybagSee Scope structure
flags (bit 0)no_recorded_valueBooleanOnly if no_recorded_value flag is set

Gauge / Sum

Single value field (int or double). Sum also includes aggregation_temporality and is_monotonic.

Histogram

Fields: count, sum, min, max, bucket_counts, explicit_bounds, aggregation_temporality.

Exponential Histogram

Fields: count, sum, min, max, scale, zero_count, positive (offset + bucket_counts), negative (offset + bucket_counts), aggregation_temporality.

Summary

Fields: count, sum, quantile_values (array of {quantile, value}).

Omitted Fields

The following OTEL fields are intentionally not stored:

  • Schema URLs at all levels (not needed for storage)
  • InstrumentationScope.dropped_attributes_count (low value)
  • Metric exemplars (high cardinality; can be added if needed)
  • Link.flags are decomposed into sampled, is_remote, and remaining flags

On this page