Skip to main content

Monitoring the SDK

note

This latest release of structured logging and metrics, is currently only available by the Python SDK. Want it in another? Reach out in our Support Slack.

SDK Metrics

Some Statsig SDKs provide built-in metrics to help you monitor its performance and impact on your application. The specific implementation may vary by programming language, refer to the documentation for the language-specific SDK interface.

Metric Interface Methods

The following interface methods are provided by the Statsig SDK to track various metrics:

  • Initialization (init): This method is called on sdk initialization and allows users to initialize their observability client (such as StatsD, OpenTelemetry, etc.), preparing the SDK to send metrics and logs to the chosen observability tool.
  • Shutdown (shutdown): This method is called on sdk shutdown, and allow users to perform any actions to ensure graceful shutdown of the observability client, such as ensuring that any pending metrics or logs are properly handled and sent before the SDK is terminated.
  • Counter: A method that tracks occurrences of specific events.
  • Gauge: A method used to record point-in-time values, such as the number of active connections or other metrics that don’t accumulate over time.
  • Distribution: A method that tracks distributions of numerical data over time, such as latency or response times.
  • Should Enable High Cardinality Tags: This method is called on high cardinality tags and allows users to define if certain high cardinality tags (which can generate large data volumes) should be enabled for detailed tracking. By default, all high cardinality tags are disabled.

List of Metrics

Below is a list of the primary metrics currently available in the SDK:

Metric NameTypeTagsDescription
statsig.sdk.initializationdistributionsuccess, init_source, init_source_api, store_populatedTracks SDK initialization duration.
statsig.sdk.config_propagation_diffdistributionsource, source_api, lcut*, prev_lcut*Measures the time difference between the last config updated time vs the time that sdk received the config.
statsig.sdk.config_no_updatecountersource, source_apiTracks occurrences of no configuration updates.

Note: Tags marked with * (such as lcut and prev_lcut) are high cardinality tags.

Metric Tags

High cardinality tags are tags that can generate large data dimensions when enabled. These tags are disabled by default, but can be enabled as through Should Enable High Cardinality Tags method on the observability client interface. High cardinality tags include:

  • lcut: The last configuration update timestamp.
  • prev_lcut: The previous configuration update timestamp.

Metric Tags:

  • source: The source of the configuration update, such as network/bootstrap/datastore.
  • source_api: The API endpoint used to fetch the configuration update.
  • success: Indicates whether the initialization was successful.
  • store_populated: Indicates whether the configuration store was populated.