Skip to main content

Module semantic

Module semantic 

Source
Expand description

Per-table semantic metadata accumulated during one ingest pass (OTLP metrics, Prometheus remote write v2).

Each written table collects the scalar semantic keys its wire metadata declares (an OTLP histogram fans out into _bucket/_sum/_count companions; a remote write series names one metric family). The resulting index is serialized onto the greptime.internal.semantic.per_table_index context extension as {schema -> {table -> {key -> value}}} and folded into each table’s options at auto-create time.

Conflict handling follows the RFC: when two sources disagree on a single-valued key the value collapses to mixed (or unknown for keys whose domain has no mixed).

Structs§

SemanticIndex
Index of {table_name -> {semantic_key -> value}} for one target schema.
SemanticIndexes
Schema-aware collection of SemanticIndexes: Prometheus remote write lets each series override the target schema with a special label, so one request may write the same metric name into several schemas — their metadata must not collapse into each other.

Constants§

METRIC_TYPE_COUNTER
METRIC_TYPE_GAUGE
METRIC_TYPE_GAUGE_HISTOGRAM
METRIC_TYPE_HISTOGRAM
METRIC_TYPE_INFO
METRIC_TYPE_STATESET
METRIC_TYPE_SUMMARY
METRIC_TYPE_UPDOWN_COUNTER

Functions§

collapse_value 🔒
The collapsed value for a conflicting scalar key: mixed when the key’s domain accepts it, else unknown. Uses the vocabulary validator as the single source of truth for which keys allow mixed.
openmetrics_unit_to_ucum
Maps an OpenMetrics unit name (open vocabulary full words: seconds, bytes) to the UCUM code the greptime.semantic.metric.unit option is defined in. Only the OpenMetrics base units are mapped; anything else is dropped — a missing unit beats a corrupted cross-protocol vocabulary.