JanssenProject / JanssenProject/jans

feat(jans-cedarling): expose local metrics snapshot

Open
#14,892 0 comments 0 reactions 1 assignee Assigned to @dagregi View on GitHub
comp-jans-cedarling kind-feature
Dominant language
Java
Stars
647
Forks
173
Avg merge
1d 18h
Merged PRs (30d)
110

Description

## Context

Cedarling already collects telemetry through `MetricsCollector` (policy stats, error counters, operational stats), but collection is only active when Lock-server telemetry is enabled, and the data is only emitted asynchronously. There is no way to inspect metrics locally or when telemetry is off.

## Goal

Expose a single, uniform observability entry point on the Cedarling core, identical across all bindings (Python, Java, Go, WASM).

## Scope

- Add a public `metrics_snapshot_get_and_clean()` method on `Cedarling`.
- Returns the current metrics snapshot (policy stats, error counters, operational stats).
- Resets to a fresh window after the call, so the next snapshot starts accumulating from zero.
- Add an opt-in bootstrap property to enable local metrics collection independently of Lock-server telemetry. Default: off (smallest memory footprint).
- Return a clear error (e.g. `telemetry-not-enabled`) when:
- metrics collection is not enabled, or
- Lock-server telemetry is active (the background ticker owns snapshots in that mode).
- Expose the same method across all bindings with identical semantics.

## Out of scope

- `status()` / `health()` and an exporter/callback interface
- OpenTelemetry integration

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.