Skip to content

Commit

Permalink
feat(OTEL) Adjust indentations for code snippets.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhetoric101 committed Mar 21, 2022
1 parent e9f2358 commit 6305a8f
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,69 +7,64 @@ tags:
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:
For a basic setup of the collector where you are **not** monitoring infrastructure hosts, follow the Docker instructions below. If you need more information about whether to set up a collector, see our [introduction](/docs/more-integrations/open-source-telemetry-integrations/opentelemetry/collector/opentelemetry-collector-intro).

* **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")
The collector setup is part of the larger process of setting up OpenTelemetry with New Relic. If you haven't already done so, make sure you've completed "Step 2. Instrument your service with OpenTelemetry" in our [primary instructions](/docs/more-integrations/open-source-telemetry-integrations/opentelemetry/opentelemetry-quick-start/#instrument). Then, as a substitute for "Step 3. Export your telemetry data to New Relic," complete the steps below.

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]
```
```
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
```


```
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
```



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ tags:
metaDescription: The OpenTelemetry collector is a central tool to collect, process, and export your telemetry.
---

You can collect metrics about your infrastructure hosts with OpenTelemetry if you set up a collector. The collector is a component of OpenTelemetry that collects, processes, and exports telemetry data to New Relic (or any observability back-end).
You can collect metrics about your infrastructure hosts with OpenTelemetry if you set up a collector. The collector is a component of OpenTelemetry that collects, processes, and exports telemetry data to New Relic (or any observability back-end).

The collector setup is part of the larger process of setting up OpenTelemetry with New Relic. If you haven't already done so, make sure you've completed "Step 2. Instrument your service with OpenTelemetry" in our [primary instructions](/docs/more-integrations/open-source-telemetry-integrations/opentelemetry/opentelemetry-quick-start/#instrument). Then, as a substitute for "Step 3. Export your telemetry data to New Relic," complete the steps below.

If you're looking for help with other collector use cases, see the [newrelic-opentelemetry-examples](https://github.com/newrelic/newrelic-opentelemetry-examples) repository.

Expand Down Expand Up @@ -122,7 +123,7 @@ CPU, load, memory and disk utilization metrics require otelcol-contri release `v
</tbody>
</table>

Here is a sample configuration yaml file:
Here is a sample configuration YAML file:

```
extensions:
Expand Down

0 comments on commit 6305a8f

Please sign in to comment.