Skip to content

Commit

Permalink
Update opentelemetry-collector-prometheus.mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
mangulonr committed May 29, 2023
1 parent b407a46 commit c02e73b
Showing 1 changed file with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Complete the steps below to collect Prometheus metrics:

## Step 2: Prerequisites [#prerequisites]

The collector will use the Prometheus receiver component

Depending on the software you want to monitor the prerequites may change. Prometheus metrics endpoint could be enabled by defaut or may need some setup in the configuration to enable it.
Others software can require a [third-party Prometheus exporter](https://prometheus.io/docs/instrumenting/exporters/#third-party-exporters) to expose metrics.

Expand All @@ -30,17 +32,24 @@ In both cases the Prometheus metrics endpoint needs to be accesible from the Ope

If not done yet, download and install the Opentelemetry collector following [Opentelemetry docs](https://opentelemetry.io/docs/collector/getting-started/).

Download and install the Opentelemetry collector following [Opentelemetry docs](https://opentelemetry.io/docs/collector/getting-started/).

You will need to install [OpenTelemetry Collector Contrib Distro](https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib) or other distribution including, at least, the following components:

* [Prometheus receiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/prometheusreceiver)
* [OTLP exporter](https://pkg.go.dev/go.opentelemetry.io/collector/exporter/otlpexporter)

## Step 4: Configure Opentelemetry collector [#configure-opentelemetry-collector]

Update or create a new file called `config.yaml` from the example below.

Replace the following keys in the file with your own values:

* Prometheus endpoint:
* Prometheus scrape config:
* `PROMETHEUS_JOBNAME`
* `PROMETHEUS_HOSTNAME` `SQUID_EXPORTER_HOSTNAME`
* `PROMETHEUS_HOSTNAME`
* `PROMETHEUS_ENDPOINT_PORT`
* `PROMETHEUS_ENDPOINT_PATH`
* `PROMETHEUS_ENDPOINT_PATH` (optional, default is /metrics)
* [New Relic License key](/docs/apis/intro-apis/new-relic-api-keys/#license-key):
* `NEW_RELIC_LICENSE_KEY`

Expand Down Expand Up @@ -77,7 +86,11 @@ service:
exporters: [otlp]
```

You may check [Opentelemetry Collector docs](https://opentelemetry.io/docs/collector/configuration/) and [Prometheus configuration docs](https://prometheus.io/docs/prometheus/latest/configuration/configuration/) for additional configuration details.
For further configuration options, please review:

* [Opentelemetry Collector docs](https://opentelemetry.io/docs/collector/configuration/).
* [Prometheus configuration docs](https://prometheus.io/docs/prometheus/latest/configuration/configuration/) for additional configuration details.
* [Scrape config doc](https://github.com/prometheus/prometheus/blob/v2.28.1/docs/configuration/configuration.md#scrape_config).

## Step 4: Run the collector [#run-collector]

Expand All @@ -102,17 +115,17 @@ FACET metricName

## Troubleshooting [#troubleshooting]

<CollapserGroup>
<Collapser
id="metric-names-has-changed"
title="Metric names has changed"
id="prometheus-metrics-normalization"
title="Metrics names don't match"
>
From version 0.76.3 the OTEL contrib collector includes a breaking change that causes some Prometheus metric names to be changed following OpenTelemetry conventions.
This change may cause some disruptions on existing dashboard, alerts or queries, we recommend to enable the following feature gate in the collector to preserve the metric names.

```
--feature-gates=-pkg.translator.prometheus.NormalizeName
Prometheus metrics based dashboards and entities use Prometheus metrics naming conventions to match the metrics being reported by the Prometheus endpoints. However, the OpenTelemetry Prometheus receiver uses OpenTelemetry naming conventions by default after [v076.3](https://github.com/open-telemetry/opentelemetry-collector-contrib/releases/tag/v0.76.3).

To use Prometheus metrics naming conventions, disable the `pkg.translator.prometheus.NormalizeName` `feature-gate` when running the OpenTelemetry collector:

```shell
otelcol-contrib --config ./config.yaml --feature-gates=-pkg.translator.prometheus.NormalizeName
```

</Collapser>
</CollapserGroup>

0 comments on commit c02e73b

Please sign in to comment.