OpenTelemetry Collector
Go to file
Tigran Najaryan 98973e7008
Add the rest of V2 factories and interfaces (#626)
- Added V2 metric factories and interfaces for receivers and exporters.
- Added V2 factories and interfaces for processors.
- Creation methods in V2 factories accept a CreationParams struct to
  allow for easier addition of new parameters in the future without
  breaking the interface.

All changes are uniform with previously introduced initial batch of
V2 factories and interfaces (except introduction of CreationParams).

Issue: https://github.com/open-telemetry/opentelemetry-collector/issues/478
2020-03-16 15:44:37 -04:00
client Added client package to help identify RPC/HTTP clients (#326) 2020-01-15 17:51:40 -05:00
cmd/otelcol Replace log.Fatal with returning errors to be handled by caller (#627) 2020-03-13 11:36:55 -04:00
component Make component interfaces uniform (#488) 2020-01-10 08:49:34 -05:00
compression Rename all github paths from opentelemtry-service to opentelemetry-collector (#371) 2019-09-27 17:17:03 -04:00
config Add compatibility shim between internal and OC traces (#633) 2020-03-13 18:00:37 -07:00
consumer Add the rest of V2 factories and interfaces (#626) 2020-03-16 15:44:37 -04:00
defaults Add compatibility shim between internal and OC traces (#633) 2020-03-13 18:00:37 -07:00
docs Create troubleshooting.md (#590) 2020-03-05 10:30:48 -05:00
examples Fix a few typos in the k8s example (#598) 2020-03-06 07:51:36 -08:00
exporter Add the rest of V2 factories and interfaces (#626) 2020-03-16 15:44:37 -04:00
extension Add the rest of V2 factories and interfaces (#626) 2020-03-16 15:44:37 -04:00
internal Add to/from OTLP to internal metric data (#630) 2020-03-16 10:24:58 -07:00
observability Delete observability.SetParentLink (#616) 2020-03-11 16:02:29 -04:00
obsreport Update processor metrics to obsreport (#606) 2020-03-16 09:41:02 -04:00
oterr Rename all github paths from opentelemtry-service to opentelemetry-collector (#371) 2019-09-27 17:17:03 -04:00
processor Add the rest of V2 factories and interfaces (#626) 2020-03-16 15:44:37 -04:00
receiver Add the rest of V2 factories and interfaces (#626) 2020-03-16 15:44:37 -04:00
scripts Include all sources in the coverage tests. (#466) 2019-03-04 10:59:09 -08:00
service Add the rest of V2 factories and interfaces (#626) 2020-03-16 15:44:37 -04:00
testbed More details about trace data in logging exporter (#609) 2020-03-13 17:00:10 -04:00
testutils Make testbed usable from other repos (#449) 2019-12-09 11:34:40 -05:00
translator Use NewResource instead of manually creating new struct (#635) 2020-03-16 10:25:44 -04:00
.gitignore Update PR template and add local/ to .gitignore (#545) 2020-02-13 12:36:06 -05:00
.golangci.yml Integrate golangci-lint and enable scope linting (#428) 2019-12-02 11:33:25 -05:00
.travis.yml Migrate to Go1.13 (#509) 2020-01-23 14:58:04 -05:00
CODEOWNERS Add @rghetia as a code owner (#389) 2019-10-09 10:30:11 -07:00
CONTRIBUTING.md Replace log.Fatal with returning errors to be handled by caller (#627) 2020-03-13 11:36:55 -04:00
LICENSE Initial commit 2018-06-05 08:09:00 +00:00
Makefile Change addlicense to use current year (#604) 2020-03-11 11:58:03 -04:00
README.md Fix several example typos in the README (#602) 2020-03-09 12:27:35 -07:00
go.mod Add filterset package that can be used to filter by string properties (#597) 2020-03-12 15:29:57 -04:00
go.sum Update opentelemetry-proto dependency and the internal metric definition (#603) 2020-03-09 14:59:54 -07:00
pull_request_template.md Update PR template and add local/ to .gitignore (#545) 2020-02-13 12:36:06 -05:00

README.md

OpenTelemetry Collector

Build Status GoDoc Gitter chat Coverage Status

We hold regular meetings. See details at community page.

Table of contents:

Introduction

The OpenTelemetry Collector can receive traces and metrics from processes instrumented by OpenTelemetry or other monitoring/tracing libraries (e.g. Jaeger, Prometheus, etc.), can pre-process received data including adding or removing attributes, handles aggregation and smart sampling, and exports traces and metrics to one or more open-source or commercial monitoring/tracing backends.

Some frameworks and ecosystems are now providing out-of-the-box instrumentation by using OpenTelemetry, but the user is still expected to register an exporter to send data. This is a problem during an incident. Even though users can benefit from having more diagnostics data coming out of services already instrumented with OpenTelemetry, they have to modify their code to register an exporter and redeploy. Asking users to recompile and redeploy is not ideal during an incident. In addition, current users need to decide which service backend they want to export to before they distribute their binary instrumented by OpenTelemetry.

The OpenTelemetry Collector is trying to eliminate these requirements. With the OpenTelemetry Collector, users do not need to redeploy or restart their applications as long as it has the OpenTelemetry exporter. All they need to do is configure and deploy the OpenTelemetry Collector separately. The OpenTelemetry Collector will then automatically receive traces and metrics and export to any backend of the user's choice.

Some supplemental documents to review include:

Deployment

The OpenTelemetry Collector can be deployed in a variety of different ways depending on requirements. Currently, the OpenTelemetry Collector consists of a single binary and two deployment methods:

  1. An agent running with the application or on the same host as the application (e.g. binary, sidecar, or daemonset)
  2. A collector running as a standalone service (e.g. container or deployment)

While the same binary is used for either deployment method, the configuration between the two may differ depending on requirements (e.g. queue size and feature-set enabled).

deployment-models

Getting Started

Demo

Instructions for setting up an end-to-end demo environment can be found here

Kubernetes

Apply the sample YAML file:

$ kubectl apply -f example/k8s.yaml

Standalone

Create an Agent configuration file based on the example below. Build the Agent and start it with the example configuration:

$ ./bin/$(go env GOOS)/otelcol  --config ./examples/demo/otel-agent-config.yaml
$ 2018/10/08 21:38:00 Running OpenTelemetry receiver as a gRPC service at "localhost:55678"

Create a Collector configuration file based on the example below. Build the Collector and start it with the example configuration:

$ make otelcol
$ ./bin/$($GOOS)/otelcol --config ./examples/demo/otel-collector-config.yaml

Run the demo application:

$ go run "$(go env GOPATH)/src/github.com/open-telemetry/opentelemetry-collector/examples/main.go"

You should be able to see the traces in your exporter(s) of choice. If you stop otelcol, the example application will stop exporting. If you run it again, exporting will resume.

Configuration

The OpenTelemetry Collector is configured via a YAML file. In general, at least one enabled receiver and one enabled exporter needs to be configured.

The configuration consists of the following sections:

receivers:
  ...
processors:
  ...
exporters:
  ...
extensions:
  ...
service:
  ...

Receivers

A receiver is how data gets into the OpenTelemetry Collector. One or more receivers must be configured. By default, no receivers are configured.

A basic example of all available receivers is provided below. For detailed receiver configuration, please see the receiver README.md.

receivers:
  opencensus:
    endpoint: "0.0.0.0:55678"

  zipkin:
    endpoint: "0.0.0.0:9411"

  jaeger:
    protocols:
      grpc:
      thrift_http:
      thrift_tchannel:
      thrift_compact:
      thrift_binary:

  prometheus:
    config:
      scrape_configs:
        - job_name: "caching_cluster"
          scrape_interval: 5s
          static_configs:
            - targets: ["localhost:8889"]

Processors

Processors are run on data between being received and being exported. Processors are optional though some are recommended.

A basic example of all available processors is provided below. For detailed processor configuration, please see the processor README.md.

processors:
  attributes/example:
    actions:
      - key: db.statement
        action: delete
  batch:
    timeout: 5s
    send_batch_size: 1024
  probabilistic_sampler:
    disabled: true
  span:
    name:
      from_attributes: ["db.svc", "operation"]
      separator: "::"
  queued_retry: {}
  tail_sampling:
    policies:
      - name: policy1
        type: rate_limiting
        rate_limiting:
          spans_per_second: 100

Exporters

An exporter is how you send data to one or more backends/destinations. One or more exporters must be configured. By default, no exporters are configured.

A basic example of all available exporters is provided below. For detailed exporter configuration, please see the exporter README.md.

exporters:
  opencensus:
    headers: {"X-test-header": "test-header"}
    compression: "gzip"
    cert_pem_file: "server-ca-public.pem" # optional to enable TLS
    endpoint: "localhost:55678"
    reconnection_delay: 2s

  logging:
    loglevel: debug

  jaeger_grpc:
    endpoint: "localhost:14250"

  jaeger_thrift_http:
    headers: {"X-test-header": "test-header"}
    timeout: 5
    url: "http://localhost:14268/api/traces"

  zipkin:
    url: "http://localhost:9411/api/v2/spans"

  prometheus:
    endpoint: "localhost:8889"
    namespace: "default"

Extensions

Extensions are provided to monitor the health of the OpenTelemetry Collector. Extensions are optional. By default, no extensions are configured.

A basic example of all available extensions is provided below. For detailed extension configuration, please see the extension README.md.

extensions:
  health_check: {}
  pprof: {}
  zpages: {}

Service

The service section is used to configure what features are enabled in the OpenTelemetry Collector based on the configuration found in the receivers, processors, exporters, and extensions sections. The service section consists of two sub-sections:

  • extensions
  • pipelines

Extensions consist of a list of all extensions to enable. For example:

    service:
      extensions: [health_check, pprof, zpages]

Pipelines can be of two types:

  • metrics: collects and processes metrics data.
  • traces: collects and processes trace data.

A pipeline consists of a set of receivers, processors, and exporters. Each receiver/processor/exporter must be specified in the configuration to be included in a pipeline and each receiver/processor/exporter can be used in more than one pipeline.

Note: For processor(s) referenced in multiple pipelines, each pipeline will get a separate instance of that processor(s). This is in contrast to receiver(s)/exporter(s) referenced in multiple pipelines, where only one instance of a receiver/exporter is used for all pipelines.

The following is an example pipeline configuration. For more information, refer to pipeline documentation.

service:
  pipelines:
    traces:
      receivers: [opencensus, jaeger]
      processors: [batch, queued_retry]
      exporters: [opencensus, zipkin]

Troubleshooting

By default, the OpenTelemetry Collector exposes Prometheus metrics and logs for monitoring and troubleshooting. When troubleshooting live issues it is recommended to use zpages extension.

The zpages extension provides live information about receivers and exporters. By default, zpages is available at http://localhost:55679/debug/tracez. Click on the links of the displayed operations to see information about each individual operation. Operations that encountered errors are reported on the right most column.

zpages-example

Other Information

Extending the Collector

The OpenTelemetry collector can be extended or embedded into other applications.

The list of applications extending the collector:

Owners

Approvers (@open-telemetry/collector-approvers):

Find more about the approver role in community repository.

Maintainers (@open-telemetry/collector-maintainers):

Find more about the maintainer role in community repository.