Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: OpenTelemetry Elastic exporter #3845

Merged
merged 10 commits into from
Jun 8, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/guide/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ include::./rum.asciidoc[]

include::./opentracing.asciidoc[]

include::./opentelemetry-elastic.asciidoc[]

include::./obs-integrations.asciidoc[]

include::./cross-cluster-search.asciidoc[]
Expand Down
181 changes: 181 additions & 0 deletions docs/guide/opentelemetry-elastic.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
[[open-telemetry-elastic]]
== OpenTelemetry integration

:ot-spec: https://github.com/open-telemetry/opentelemetry-specification/blob/master/README.md
:ot-repo: https://github.com/open-telemetry/opentelemetry-collector
:ot-pipelines: {ot-repo}/blob/master/docs/pipelines.md
:ot-extension: {ot-repo}/blob/master/extension/README.md
:ot-scaling: {ot-repo}/blob/master/docs/performance.md

:ot-collector: https://opentelemetry.io/docs/collector/about/
:ot-dockerhub: https://hub.docker.com/r/otel/opentelemetry-collector-contrib-dev

Elastic's OpenTelemetry integration allows you to reuse your existing OpenTelemetry
instrumentation to quickly analyze distributed traces and metrics with the Elastic Stack.
bmorelli25 marked this conversation as resolved.
Show resolved Hide resolved

[float]
[[what-is-otel]]
=== What is OpenTelemetry?

> OpenTelemetry is a set of APIs, SDKs, tooling, and integrations that enable the creation and
management of telemetry data. It formed through a merger of the OpenTracing and OpenCensus projects.

OpenTelemetry is an open-source project that provides the components necessary to observe your applications and services.
If you're unfamiliar with the project, see the {ot-spec}[spec] for more information.

[float]
[[open-telemetry-elastic-exporter]]
=== Elastic exporter

Elastic's integration is designed to drop into your current OpenTelemetry setup.
We've done this by extending the default OpenTelemetry collector and adding an Elastic exporter.
bmorelli25 marked this conversation as resolved.
Show resolved Hide resolved
This exporter translates the OpenTelemetry trace data collected from your services to Elastic's protocol,
before sending the data to the Elastic Stack.
By extending the OpenTelemetry collector,
no changes are needed in your instrumented services in order to begin using the Elastic Stack.

*************
bmorelli25 marked this conversation as resolved.
Show resolved Hide resolved
Instrumented with
OpenTelemetry
↓ OpenTelemetry Collector The Elastic Stack [ESS]
Service 1 ---> ┐ ┌────────────────┐ ┌─────────────────────────────────────────┐
Service 2 ---> ┤ ---> |Elastic Exporter| ---> |APM Server --> Elasticsearch --> APM app)|
Service 3 ---> ┘ └────────────────┘ └─────────────────────────────────────────┘
↑ ↑
↑ ↑
OpenTelemetry Elastic
Protocol Protocol
*************

[float]
[[open-telemetry-elastic-works]]
=== How the OpenTelemetry Collector works

The OpenTelemetry collector uses three different types of components to handle data: `receivers`, `processors`, and `exporters`.

* `receivers`: Configure how data gets to the collector. At least one receiver must be configured.
* `processors`: Defines optional transformations that occurs between receiving and exporting data.
* `exporters`: Configures how data is sent to its destination--in this case, the Elastic Stack.

Once a `receiver`, `processor`, and `exporter` is defined, `pipelines` can be configured in the `services` section of your configuration. Specifically, a `traces` pipeline will define the path of trace data through your collector, and bring all three of these components together.

TIP: More information is available in the
{ot-pipelines}[OpenTelemetry pipeline docs]

A final note: `extensions` can also be enabled for tasks like monitoring your collectors health.
See the {ot-extension}[OpenTelemetry extension readme]
for a list of supported extensions.

[[open-telemetry-elastic-get-started]]
=== Get started

NOTE: This guide assumes you've already instrumented your services with the OpenTelemetry API and/or SDK.
If you haven't, see the Elastic APM <<install-and-run,install and run guide>> to get started with Elastic APM Agents instead.

==== Deployment planning

OpenTelemetry Collectors can be run as an Agent, or as standalone collectors.
They can be deployed as often as necessary and scaled up or out.

Deployment planning resources are available in OpenTelemetry's {ot-collector}[Getting Started]
documentation, and {ot-scaling}[Collector Performance] research.

==== Download the collector

The Elastic exporter lives in the {ot-repo}[`opentelemetry-collector-contrib repository`],
and the latest release can be downloaded from {ot-repo}/releases[GitHub releases page].
You can also build the collector-contrib repository by cloning it and running:

[source,bash]
----
make otelcontribcol
bmorelli25 marked this conversation as resolved.
Show resolved Hide resolved
----

Docker images are available on {ot-dockerhub}[dockerhub]:

[source,bash]
----
docker pull otel/opentelemetry-collector-contrib-dev
----

==== Configure the collector

Next, create a yaml configuration file.

At a minimum, you must define the URL of the APM Server instance you are sending data to.
Additional configuration options for API keys, secret tokens, and TLS settings are also available.
For example:

[source,yml]
----
exporters:
elastic:
apm_server_url: "https://elasticapm.example.com"
----

The Elastic exporter must also be defined in `service.pipelines.traces.exporters`.
For example:

[source,yml]
----
service:
pipelines:
traces:
exporters: [elastic]
----

If we put everything together, here's an example configuration file that accepts input from an OpenTelemetry Agent,
processes the data, and sends it to an {ess} instance.

[source,yml]
----
receivers:
otlp:
endpoint: localhost:55680
processors:
batch:
timeout: 1s
send_batch_size: 1024
exporters:
elastic:
apm_server_url: "https://elasticapm.example.com"
secret_token: "ESS_TOKEN"
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [elastic]
----

==== Quickstart?

Do we want to provide some sort of dockerized quickstart that uses a load generator to send data to ESS?
bmorelli25 marked this conversation as resolved.
Show resolved Hide resolved

For more information about getting started with an OpenTelemetry Collector,
see the {ot-collector}[OpenTelemetry collector] docs.

[[open-telemetry-elastic-config]]
=== Elastic exporter configuration reference

==== `apm_server_url`
Elastic APM Server URL. (required)

==== `api_key`
Credential for API Key authorization. Must also be enabled in Elastic APM Server. (optional)
bmorelli25 marked this conversation as resolved.
Show resolved Hide resolved

==== `secret_token`
Credential for Secret Token authorization. Must also be enabled in Elastic APM Server. (optional)

==== `ca_file`
Root Certificate Authority (CA) certificate, for verifying the server's identity if TLS is enabled. (optional)

==== `cert_file`
Client TLS certificate. (optional)

==== `key_file`
Client TLS key. (optional)

==== `insecure`
Disable verification of the server's identity if TLS is enabled. (optional)