Skip to content

Commit

Permalink
feat(OTEL) Add collector documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rhetoric101 committed Mar 21, 2022
1 parent aeb3191 commit e9f2358
Show file tree
Hide file tree
Showing 6 changed files with 535 additions and 79 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: Collector with New Relic (basic setup)
tags:
- Integrations
- Open source telemetry integrations
- OpenTelemetry
metaDescription: The OpenTelemetry collector is a central tool to collect, process, and export your telemetry.
---

The [OpenTelemetry Collector](https://opentelemetry.io/docs/collector/) is a configurable and extensible software component to receive, process, and export telemetry data. When you set up a collector, it can operate as a gateway or as an agent:

* **Gateway:** The collector receives data from a variety of sources and applies standard processing before exporting to some backend.
* **Agent:** The collector is deployed on each host in an environment and can collect telemetry data about the host and processes running on it.

When you use a collector, you start by following the same routine as above for setting up OTLP in your service. In this case, instead of exporting data directly to New Relic, you export through a collector that you set up. In the collector, you configure the [OTLP exporter](https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/otlpexporter) to export data to New Relic.

When your data goes through a collector, the transport looks like this:

![Diagram showing OpenTelemetry using the OpenTelemetry Collector and New Relic's OTLP endpoint.](./images/native_otlp_with_collector.svg "Diagram of OTLP with collector")

Here's a Docker example of how to set up and run an OpenTelemetry collector with the collector YAML:

1. Save the following as `otel-config.yaml`:

```
receivers:
otlp:
protocols:
grpc:
http:
processors:
batch:
exporters:
otlp:
endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT}
headers:
api-key: ${NEW_RELIC_LICENSE_KEY}
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
metrics:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
logs:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
```
2. Run the OpenTelemetry collector after you make the following changes:
* Replace <var>OTLP_ENDPOINT_HERE</var> with the appropriate [endpoint](#review-settings.
* Replace <var>YOUR_KEY_HERE</var> with your account's [license key](https://one.newrelic.com/launcher/api-keys-ui.launcher).

```
export OTEL_EXPORTER_OTLP_ENDPOINT=<var>OTLP_ENDPOINT_HERE</var>
export NEW_RELIC_LICENSE_KEY=<var>YOUR_KEY_HERE</var>
docker run --rm \
-e OTEL_EXPORTER_OTLP_ENDPOINT \
-e NEW_RELIC_LICENSE_KEY \
-p 4317:4317 \
-v "${PWD}/otel-config.yaml":/otel-config.yaml \
--name otelcol \
otel/opentelemetry-collector \
--config otel-config.yaml
```




0 comments on commit e9f2358

Please sign in to comment.