Skip to content

Metrics

Chinmina collects metrics for HTTP request handling, cache operations, encryption, and token vendor behavior. Metrics use dimensional attributes for filtering and aggregation.

Every route is wrapped with otelhttp.NewHandler(), which produces HTTP semantic convention metrics automatically.

Type: Float64Histogram

Unit: s (seconds)

Server request duration. Attributes include http.request.method, http.response.status_code, http.route, and url.scheme.

Type: Float64Histogram

Unit: By (bytes)

Size of the request body.

Type: Float64Histogram

Unit: By (bytes)

Size of the response body.

When OBSERVE_HTTP_TRANSPORT_ENABLED=true, outgoing requests to Buildkite and GitHub APIs are wrapped with otelhttp.NewTransport(), producing client-side HTTP semantic convention metrics. These mirror the server metrics above with a http.client.* prefix.

Connection-level trace attributes (DNS, TLS handshake timing) are added when OBSERVE_CONNECTION_TRACE_ENABLED=true. See traces for details.

Counts cache operations performed.

Type: Int64Counter

Unit: None (dimensionless count)

Meter: github.com/chinmina/chinmina-bridge/internal/cache

AttributeTypeValues
cache.typestringCache implementation type (e.g., "token")
cache.operationstring"get", "set", "invalidate"
cache.statusstring"hit", "miss", "error", "success"
OperationSuccess StatusFailure Status
get"hit" or "miss""error"
set"success""error"
invalidate"success""error"

Note: For get operations, "hit" indicates a cached value was found, "miss" indicates no cached value exists, and "error" indicates the cache operation failed.

Measures duration of cache operations.

Type: Float64Histogram

Unit: s (seconds)

Meter: github.com/chinmina/chinmina-bridge/internal/cache

AttributeTypeValues
cache.typestringCache implementation type (e.g., "token")
cache.operationstring"get", "set", "invalidate"

Duration is measured from operation start to completion. The metric is recorded before the operation status is determined, so duration histograms include both successful and failed operations.

Expected values for the in-memory token cache: get operations typically complete in under 10ms, set operations in under 20ms. Sustained values above these thresholds may indicate memory pressure or garbage collection pauses.

Measures duration of encrypt and decrypt operations on cached values.

Type: Float64Histogram

Unit: s (seconds)

Meter: github.com/chinmina/chinmina-bridge/internal/cache

These metrics are only produced when the distributed cache is configured with encryption (via Tink AEAD with AWS KMS).

AttributeTypeValues
encryption.operationstring"encrypt", "decrypt"

Counts encrypt and decrypt operations.

Type: Int64Counter

Unit: None (dimensionless count)

Meter: github.com/chinmina/chinmina-bridge/internal/cache

AttributeTypeValues
encryption.operationstring"encrypt", "decrypt"
encryption.outcomestring"success", "error"

Counts token cache lookup outcomes in the vendor layer.

Type: Int64Counter

Unit: None (dimensionless count)

Meter: github.com/chinmina/chinmina-bridge/internal/vendor

AttributeTypeValuesDescription
token.cache.resultstring"hit", "miss", "mismatch"Lookup outcome
ResultMeaning
"hit"Cached token found and repository matches request
"miss"No cached token found or cache error occurred
"mismatch"Cached token found but repository does not match request (cache invalidated)

A "mismatch" result occurs when a cached token exists but was vended for a different repository than the current request. In this case, the cache is invalidated and a new token is generated.

High mismatch rates indicate pipelines that frequently switch between repositories — for example, sequential pipeline steps accessing different repos, or pipelines using multiple organization profiles. A sustained mismatch rate above the miss rate may point to profile configuration issues worth investigating.

The overall cache hit rate is:

hit_rate = hits / (hits + misses + mismatches)

The cache.type attribute distinguishes between different cache instances. Current values:

Cache TypeValue
Token vendor cache"token"

For metric configuration details, see: