Metrics endpoint
StreamNative Cloud provides an endpoint that exposes real-time metrics in Prometheus metrics format. The following table displays the currently available metrics endpoints.Currently, the Cloud Metrics API only exposes resource-related metrics for Pulsar, including Tenants, Namespaces, Topics, Functions, Connectors, and others. System-level metrics are not exposed through this API. These system-level metrics are actively monitored and managed by the StreamNative Cloud team. However, for advanced observability use cases, you might need access to these system-level metrics. To meet this requirement, you can use the Local Metrics Endpoint. Please note that the Local Metrics Endpoint is only available for BYOC Pro clusters.
Metrics authorization
To access and scrape metrics from the Cloud endpoints, you must use a Super Admin service account or a normal service account withmetrics-viewer role.
Super Admin service account
To create a super admin service account, please check the create a service account.metrics-viewer role
To bind a service account withmetrics-viewer, your can configure it through snctl or terraform.
- snctl
- terraform
- Console
- create a normal service account
- create role binding with metrics-viewer
- In case you want to remove the permission to list metrics you can delete the rolebinding
Pulsar resource metrics
Kafka resource metrics
Source connector metrics
Sink connector metrics
Function metrics
Kafka Connect metrics
Health metrics
Metrics API integration
The examples below demonstrate how to configure your observability tool to scrape the metrics endpoint. While StreamNative Cloud provides the metrics endpoint, it is your responsibility to set up and manage your own observability stack.
Prometheus integration
To collect Pulsar metrics into Prometheus, add the following to your Prometheus configuration file. The bearer tokens have a limited life cycle, therefore it is recommended to use the OAuth2 authentication method.client_id and client_secret in the Key file of a Super Admin Service Account. For more information, see work with service accounts.
The audience parameter is the Uniform Resource Name (URN), which is a combination of the urn:sn:pulsar, the organization name, and the Pulsar instance name at StreamNative:
The Prometheus response can be large, if your cluster has a lot of topics. Make sure to set the
scrape_timeout parameter large enough to cover the duration of the curl request above.
Your scrape_interval parameter should also be larger than your scrape_timeout parameter.OpenTelemetry collector integration
The OpenTelemetry collector, as described on its official page, is a vendor-agnostic agent process designed for gathering and sending telemetry data from various sources. StreamNative Cloud, which outputs its metrics in the Prometheus format, is compatible with the OpenTelemetry collector. To collect metrics from StreamNative Cloud, configure your OpenTelemetry collector to utilize the Prometheus Receiver, which is fully compatible with Prometheus’s scape_config settings. To configure your collector, refer to the guidance provided in the Prometheus Integration section. There, you will find instructions to create ascape_config for collecting metrics from StreamNative Cloud. This config should be placed in your collector’s configuration file under the following section:
NewRelic integration
You can use a Prometheus instance to forward metrics to NewRelic. To do this, add aremote_write entry to the prometheus.yml configuration file as described in the Prometheus Integration section:
The NewRelic ingestion point could also be
metric-api.eu.newrelic.com depending on your account configuration.storage.tsdb.retention.time parameter:
Grafana Cloud integration
You can use a Prometheus instance to forward metrics to Grafana Cloud. To do this, add aremote_write entry to the prometheus.yml configuration file as described in the Prometheus Integration section:
grafana_cloud_endpoint and grafana_cloud_username values by selecting Prometheus at https://grafana.com/orgs/${grafana_org}. You can find grafana_cloud_api_key at https://grafana.com/orgs/${grafana_org}/api-keys.
Then by running a Prometheus instance, the Pulsar metrics are scraped from the StreamNative endpoint and forwarded to Grafana Cloud:
storage.tsdb.retention.time parameter:
Datadog integration
Integrate with Datadog Agent
Using Datadog Agent, you can connect Datadog to the StreamNative Cloud Metrics endpoint to start collecting metrics. Datadog Agent supports most platform to host and this documentation will mainly to demonstrate with Docker and Kubernetes.
- Docker
- Kubernetes
Create a file
conf.yaml, with the spec of your Datadog Agent deployment configuration.- [1]
client_id: Required. You need to prepare a service account with Super Admin pemision and theclient_idcan be obtained from an OAuth2 credential file. - [2]
client_secret: Required. You need to prepare a service account with Super Admin pemision andt theclient_idcan be obtained from an OAuth2 credential file. - [3]
audience: Required. Audience is the Uniform Resource Name (URN), which is a combination of theurn:sn:pulsar, your organization name, and your Pulsar instance name.{organization}is the name of your organization and the{instance}is the name of your instance.
- [1]
DD_API_KEY: Your Datadog API key. - [2]
DD_SITE: Destination site for your metrics, traces, and logs. Set your Datadog site to:datadoghq.com. Defaults todatadoghq.com. - [3]
your-config-yaml-file-path: Theconf.yamlconfiguration file created in the first step.
Bridge with OpenTelemetry
You can use OpenTelemetry Collector to collect the metrics from StreamNative Cloud and export them to Datadog. To export metrics to Datadog, you can use the Datadog Exporter and add it to your OpenTelemetry Collector configuration. Use the example file which provides a basic configuration that is ready to use after you set your Datadog API key as the${DD_API_KEY} variable:
${DD_SITE} is your site, .
The above configuration enables the receiving of metrics from StreamNative Cloud, sets up a batch processor, which is mandatory for any non-development environment, and exports to Datadog. You can refer to this full documented example configuration file for all possible configuration options for Datadog Exporter.