diff --git a/src/content/docs/more-integrations/open-source-telemetry-integrations/opentelemetry/collector/collector-configuration-examples/opentelemetry-collector-hcp-consul.mdx b/src/content/docs/more-integrations/open-source-telemetry-integrations/opentelemetry/collector/collector-configuration-examples/opentelemetry-collector-hcp-consul.mdx index 01e1338a6ef..195627d41e7 100644 --- a/src/content/docs/more-integrations/open-source-telemetry-integrations/opentelemetry/collector/collector-configuration-examples/opentelemetry-collector-hcp-consul.mdx +++ b/src/content/docs/more-integrations/open-source-telemetry-integrations/opentelemetry/collector/collector-configuration-examples/opentelemetry-collector-hcp-consul.mdx @@ -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 @@ -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. @@ -39,17 +43,17 @@ Complete the steps below to collect server metrics from your HCP consul network ## 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 @@ -116,6 +120,40 @@ docker compose up + + + ## 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": "" + }, + "timeout": "2s" + } + } + } + + ``` + @@ -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. 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).