All Products
Search
Document Center

Managed Service for Prometheus:OpenTelemetry endpoints for data reporting

Last Updated:Aug 22, 2024

Alibaba Cloud Managed Service for Prometheus provides OpenTelemetry endpoints for you to import OpenTelemetry metrics of your application and use Grafana to obtain monitoring data. This way, you can efficiently monitor and manage the performance and health of the application.

Usage notes

  • OpenTelemetry metrics can only be reported over HTTP. gRPC is not supported.

  • When you use HTTP to report data, configure the default application/protobuf serialization method for the Content-Encoding header. The application/json serialization method is not supported.

  • The following table describes the mapping relationships between the OpenTelemetry metric model and the Prometheus metric model.

    OpenTelemetry

    Prometheus

    Sum(monotonic & cumulative)

    Counter

    Sum(monotonic & delta)

    Gauge

    Sum(none-monotonic & cumulative)

    Gauge

    Gauge

    Gauge

    Histogram(cumulative)

    Histogram

    Histogram(delta)

    Not supported

    Exponential Histogram

    Not supported

    Summary

    Summary

  • The following table lists the regions that support OpenTelemetry endpoints.

    Geographical area

    Region name

    Region ID

    Regions in China

    China (Hangzhou)

    cn-hangzhou

    China (Shanghai)

    cn-shanghai

    China (Shenzhen)

    cn-shenzhen

    China (Heyuan)

    cn-heyuan

    China (Guangzhou)

    cn-guangzhou

    China (Qingdao)

    cn-qingdao

    China (Beijing)

    cn-beijing

    China (Zhangjiakou)

    cn-zhangjiakou

    China (Hohhot)

    cn-huhehaote

    China (Ulanqab)

    cn-wulanchabu

    China (Chengdu)

    cn-chengdu

    China (Hong Kong)

    cn-hongkong

    Regions outside China

    Singapore

    ap-southeast-1

Prerequisites

Step 1: Obtain an OpenTelemetry endpoint

  1. Log on to the Managed Service for Prometheus console.

  2. In the left-side navigation pane, click Instances.

  3. In the top navigation bar of the Instances page, select a region, find your Prometheus instance, and click Settings in the Actions column.

  4. On the Settings page, copy the public or internal OpenTelemetry endpoint based on your business requirements.

Step 2: Modify the Endpoint parameter of your application

Take a Java application as an example. You need to replace the Endpoint parameter in OtlpHttpMetricExporterBuilder with the OpenTelemetry endpoint obtained in Step 1 to import the OpenTelemetry metrics of the application to Managed Service for Prometheus. For more information, see Sample code.

You also need to configure the following parameters:

  • By default, compression is disabled for OpenTelemetry clients. We recommend that you set the Compression parameter to gzip to reduce network consumption.

  • If you want to add prefixes to all metrics when you report OpenTelemetry metrics to Managed Service for Prometheus, you can configure a set of headers and set the metricNamespace parameter.

  • After OpenTelemetry metrics are reported to Managed Service for Prometheus, OpenTelemtery scope labels are attached to all metrics by default. You can configure a group of headers and set the skipGlobalLabel parameter to true, so that Managed Service for Prometheus does not add the default scope labels when it processes the received metrics.

Note

For more information about how to configure the preceding parameters, see Sample code.

Step 3: View monitoring data in Grafana

  1. Log on to the Managed Service for Grafana console.

  2. On the Workspace Management page, click Grafana shared edition. On the Workspace Information page, select a public endpoint and click Log On.

  3. In the left-side navigation pane, click image.png. On the right side of the Explore page, select a data source.

    Important

    Select the Prometheus instance as the data source.