Table of Contents

Class OTelMetricNameBuilder

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Converts Typhon resource paths and metric kinds to OpenTelemetry metric names.

public static class OTelMetricNameBuilder
Inheritance
OTelMetricNameBuilder
Inherited Members

Remarks

OTel metric naming conventions:

  • Use dots (.) for hierarchy
  • Use lowercase with underscores for multi-word names
  • Pattern: {prefix}.{path}.{kind}.{sub_metric}

Prometheus auto-converts dots to underscores, so the same names work for both systems.

var name = OTelMetricNameBuilder.Build("typhon.resource", "Storage/PageCache", "memory", "allocated_bytes");
// Result: "typhon.resource.storage.page_cache.memory.allocated_bytes"

Methods

Build(string, string, string, string)

Build an OTel metric name from components.

public static string Build(string prefix, string nodePath, string metricKind, string subMetric)

Parameters

prefix string

Metric namespace prefix (e.g., "typhon.resource").

nodePath string

Resource path (e.g., "Storage/PageCache" or "Root/Storage/PageCache").

metricKind string

Metric category (e.g., "memory", "capacity", "contention").

subMetric string

Specific metric within the category (e.g., "allocated_bytes", "utilization").

Returns

string

Fully qualified OTel metric name.

BuildNamed(string, string, string, string, string)

Build an OTel metric name for throughput and duration metrics that have named instances.

public static string BuildNamed(string prefix, string nodePath, string metricKind, string metricName, string subMetric)

Parameters

prefix string

Metric namespace prefix (e.g., "typhon.resource").

nodePath string

Resource path (e.g., "Storage/PageCache").

metricKind string

Metric category (e.g., "throughput", "duration").

metricName string

Named metric instance (e.g., "CacheHits", "Checkpoint").

subMetric string

Specific metric within the instance (e.g., "count", "last_us").

Returns

string

Fully qualified OTel metric name.

NormalizePath(string)

Normalize a resource path to OTel-compatible format.

public static string NormalizePath(string nodePath)

Parameters

nodePath string

Resource path (e.g., "Root/Storage/PageCache" or "Storage/PageCache").

Returns

string

Normalized path in lowercase with underscores and dots (e.g., "storage.page_cache").

Remarks

Transformations applied:

  • Remove "Root/" prefix if present
  • Convert "/" to "."
  • Convert PascalCase to snake_case
  • Convert to lowercase

ToSnakeCase(string)

Convert a PascalCase or camelCase string to snake_case.

public static string ToSnakeCase(string input)

Parameters

input string

Input string in PascalCase or camelCase.

Returns

string

Output string in snake_case.