Skip to content

Metrics & Analytics

можно. collects feature flag usage metrics: how many times a flag was evaluated and what result it returned. Metrics are visualized in the web dashboard via sparkline charts and accessible through the REST API.

How Metrics Are Collected

The SDK accumulates evaluation counters for each flag in memory and sends them to the server at a configurable interval (default: 60 seconds):

sequenceDiagram
    participant App
    participant SDK
    participant Server

    loop Flag evaluation
        App->>SDK: isEnabled("new-checkout", ctx)
        SDK-->>App: true/false
        Note over SDK: trueCount++ or falseCount++
    end

    loop Every 60 seconds
        SDK->>Server: POST /api/client/metrics
        Note over Server: Saves to flag_metrics
    end

Each record contains:

FieldDescription
flagIdFlag ID
environmentIdEnvironment ID
evaluationTrueCountNumber of true returns
evaluationFalseCountNumber of false returns
timeBucketTime interval (rounded to the minute)
instanceIdSDK instance identifier
appNameApplication name

Viewing Metrics in the Dashboard

Each flag page displays a sparkline chart — a miniature graph showing the flag's evaluation trend over the selected period. The green line represents true, the gray line false.

Clicking the sparkline opens the Flag Metrics dialog with a full chart and filters:

FilterDescription
EnvironmentDevelopment / Production
InstanceA specific SDK instance
ApplicationApplication name
PeriodLast hour / 24 hours / 7 days / 30 days

Metrics REST API

Flag Metrics

http
GET /api/v1/flags/{flagId}/metrics
ParameterTypeDescription
environmentIdlongEnvironment ID
instanceIdstringSDK instance ID
appNamestringApplication name
bash
curl "http://localhost:8080/api/v1/flags/42/metrics?environmentId=3" \
  -H "Authorization: Bearer $JWT_TOKEN"

Response:

json
{
  "metrics": [
    {
      "timeBucket": "2026-06-21T13:41:00Z",
      "trueCount": 150,
      "falseCount": 50,
      "instanceId": "instance-1",
      "appName": "web-app"
    }
  ]
}

Project Metrics

http
GET /api/v1/metrics
ParameterTypeDescription
environmentIdlongEnvironment ID

Returns aggregated metrics across all project flags.

Disabling Metrics

If metrics are not needed, disable them in the SDK:

java
MozhnoConfig config = MozhnoConfig.builder()
    .appName("my-app")
    .instanceId("instance-1")
    .mozhnoUrl("http://localhost:8080")
    .apiKey("<api-key>")
    .disableMetrics(true)
    .build();

Exporting Metrics via SPI

Through MetricsSinkSpi, metrics can be directed to external systems:

DestinationImplementation
PrometheusStandard endpoint /actuator/prometheus
Datadog, New RelicEnterprise implementation of MetricsSinkSpi
Local storageJdbcMetricsSinkProvider (default)

Interpreting Metrics

PatternInterpretation
trueCount is growingThe flag is being enabled for more users — rollout is working
falseCount is growing, trueCount = 0Flag is off or no one matches the targeting rules
Sudden spike in falseCountPossible issue: flag suddenly stopped being enabled
No metrics at allSDK is not sending data — check connectivity

Limits

ParameterDefaultDescription
Send interval (SDK)60 secondssendMetricsInterval / metricsInterval
Max metrics per API key1000CLIENT_MAX_METRICS_PER_KEY

Released under the AGPL v3.0 License.