Skip to content

Commit

Permalink
chore: added envoy metrics notes
Browse files Browse the repository at this point in the history
  • Loading branch information
jcountsNR committed Feb 14, 2024
1 parent 1e2f0fb commit 80e4ba8
Showing 1 changed file with 50 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Collector for monitoring HCP Consul server metrics
title: Collector for monitoring HCP Consul metrics
tags:
- Integrations
- Open source telemetry integrations
Expand All @@ -8,15 +8,19 @@ tags:
- HCP
- Hashicorp
- Networking
metaDescription: You can collect Consul from HCP managed Consul using the OpenTelemetry Collector.
- Server
- Envoy
metaDescription: You can collect metrics from HCP managed Consul using the OpenTelemetry Collector.
freshnessValidatedDate: never
---

You can collect metrics about your HCP-managed Consul deployment with the OpenTelemetry Collector. The collector is a component of OpenTelemetry that collects, processes, and exports telemetry data to New Relic (or any observability backend).

This integration works by running a prometheus receiver configuration inside the OpenTelemetry collector, which scrapes [HCP Consul's service metrics API](https://developer.hashicorp.com/hcp/docs/consul/monitor/metrics) and exports that data to New Relic.
This example works by running a prometheus receiver configuration inside the OpenTelemetry collector, which scrapes [HCP Consul's service metrics API](https://developer.hashicorp.com/hcp/docs/consul/monitor/metrics) and exports that data to [New Relic's OpenTelemetry API endpoint](https://docs.newrelic.com/docs/more-integrations/open-source-telemetry-integrations/opentelemetry/get-started/opentelemetry-set-up-your-app/#note-endpoints).

Complete the steps below to collect server metrics from your HCP consul network and export them to New Relic.
HCP Consul emits two forms of observability metrics, [Service metrics](https://developer.hashicorp.com/hcp/docs/consul/monitor/consul-central/observability#server-metrics) and [Envoy proxy metrics](https://developer.hashicorp.com/hcp/docs/consul/monitor/consul-central/observability#envoy-proxy-metrics). The example collector used in this guide will get you started with HCP Consul server metrics. For Envoy metrics, you can reference the notes below on Envoy metrics or check the [HCP Documentation](https://developer.hashicorp.com/hcp/docs/consul/monitor/consul-central/observability/telemetry-collector#forward-metrics-to-another-collector).

Complete the steps below to collect metrics from HCP consul and export them to New Relic.

<Steps>
<Step>
Expand All @@ -39,17 +43,17 @@ Complete the steps below to collect server metrics from your HCP consul network

<Step>
## Set environment variables and run the collector
* Set the HCP Access Token and Access URL values in the `.env` file
* Set the New Relic API key variable to your New Relic license ingest key in the `.env` file
* Set the HCP Access Token and Access URL values in the `.env` file
* Set the New Relic API key variable to your New Relic license ingest key in the `.env` file

```bash
# Open the HCP Consul example directory
cd newrelic-opentelemetry-examples/other-examples/collector/hcp-consul
# Open the HCP Consul example directory
cd newrelic-opentelemetry-examples/other-examples/collector/hcp-consul

# Set environment variables.
# Set environment variables.

# run the collector in docker
docker compose up
# run the collector in docker
docker compose up
```

### Local Variable information
Expand Down Expand Up @@ -116,6 +120,40 @@ docker compose up
</tbody>
</table>

</Step>
<Step>
## HCP Consul Envoy Metrics
To monitor HCP Consul Envoy metrics in New Relic, you can configure the OpenTelemetry collector built into your HCP Consul cluster to forward metrics to your own collector. This can include the collector running in this example.


First you will need to add an http reciever to the OpenTelemetry collector. you can add this into the `receivers` group in the example `collector.yaml` file.

```yaml
receivers:
otlp:
protocols:
http:
```
This will add a receiver listening at `0.0.0.0:4318`. Once that is set up, you can then configure your HCP Consul cluster to forward envoy metrics to this receiver. This can be configured from the `telemetryCollector` stanza in your HCP Consul configuration file. Here is an example configuration you can use:

```yaml
telemetryCollector:
enabled: true
customExporterConfig: |-
{
"exporter_config": {
"otlphttp": {
"endpoint": "0.0.0.0:4318",
"headers": {
"authorization": "<auth>"
},
"timeout": "2s"
}
}
}
```

</Step>
<Step>

Expand All @@ -124,7 +162,7 @@ docker compose up
You can view your HCP Consul server data in a few different ways.

* Navigate to the [New Relic marketplace](https://one.newrelic.com/marketplace) and search for `consul`. The available dashboards can be installed right onto your account!
* Navigate to the metrics explorer and filter for `consul`. This data can be added to any custom alert or dashboard.
* Navigate to the metrics explorer and filter for `consul`, or `envoy` for envoy metrics. This data can be added to any custom alert or dashboard.

<Callout variant="tip">
To view all metrics available with this HCP Consul server integration, reference the [documentation here](https://developer.hashicorp.com/consul/docs/agent/telemetry#metrics-reference).
Expand Down

0 comments on commit 80e4ba8

Please sign in to comment.