keepcalculator

06 Numbers and Powers

OpenTelemetry FAQ: Collectors, Exporters, Sampling & Privacy

Card No. 06·16365 · Updated · Standard formula, shown below

Average pace 5.00 min/km
Average speed
12.00 km/h
Result
Finish time
50 min
You entered
Distance
10 km
You entered
You enter
Finish time, Distance
You get
Average pace, Average speed
Rounding
2 dp

OpenTelemetry is an open-source observability framework that standardizes how you generate, collect, and export telemetry data (traces, metrics, logs). This article answers the most common questions about its collectors, exporters, sampling strategies, and data privacy, giving you a clear picture of how to use it effectively.

What is OpenTelemetry?

OpenTelemetry (OTel) is a Cloud Native Computing Foundation (CNCF) project that provides a set of APIs, SDKs, and tools to instrument, generate, collect, and export telemetry data. It is the second most active CNCF project after Kubernetes. The goal is to give you a single, vendor-neutral standard for observability, so you can send your data to any backend (Jaeger, Prometheus, Grafana, Datadog, etc.) without being locked in.

The project is a merger of two earlier efforts: OpenTracing (focused on traces) and OpenCensus (focused on traces and metrics). It supports all major programming languages, including Java, Python, Go, JavaScript, .NET, and Ruby. You can use it to instrument your code with minimal changes, and it automatically captures context like trace IDs and span IDs to help you correlate data across services.

What is the OpenTelemetry Collector?

The Collector is a vendor-agnostic service that receives telemetry data, processes it, and exports it to one or more backends. It acts as a central hub, decoupling your applications from the storage/analysis tools. You can run it as an agent (on the same host as your app) or as a standalone gateway (a central service).

The Collector has three main components:

  • Receivers: How data gets in (e.g., OTLP, Jaeger, Prometheus, Zipkin).
  • Processors: What you do to the data (e.g., batch, filter, sample, add attributes).
  • Exporters: How data gets out (e.g., to Jaeger, Prometheus, or a cloud service).

You configure these in a YAML file. A minimal config might look like:

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
exporters:
  jaeger:
    endpoint: jaeger:14250
service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [jaeger]

This receives OTLP traces and sends them to Jaeger. The Collector is highly recommended even for small setups because it handles batching, retries, and encryption, and it can reduce the load on your application.

How do Exporters work?

Exporters are the components that send telemetry data to a destination. Each exporter is specific to a backend (e.g., Jaeger, Prometheus, AWS X-Ray, Google Cloud Trace, Azure Monitor). The Collector supports dozens of exporters, and you can configure multiple exporters for the same data (e.g., send to both Jaeger and a cloud service).

Exporters handle connection details, authentication, and the wire format. For example, the OTLP exporter uses gRPC or HTTP to send data in the OpenTelemetry Protocol. The Jaeger exporter uses Thrift over HTTP or gRPC. The Prometheus exporter exposes metrics in the Prometheus text format.

When choosing an exporter, consider:

  • Compatibility: Does your backend support OTLP natively? If yes, use the OTLP exporter.
  • Network: Can your Collector reach the backend? Firewalls, proxies, and TLS certificates matter.
  • Data format: Some backends require specific attributes or resource names. You may need a processor to transform data before export.

You can also write your own exporter using the Collector’s Go API, but that is rare for most users.

What is Sampling and why does it matter?

Sampling is the practice of sending only a subset of your telemetry data to the backend, to reduce cost and storage. In high-throughput systems, sending 100% of traces can be overwhelming. Sampling lets you keep enough data to be statistically meaningful while controlling volume.

There are two main types:

  • Head-based sampling: Decide at the start of a trace (when the root span is created) whether to keep the whole trace. Simple to implement, but you might drop rare errors that happen in a later span.
  • Tail-based sampling: Decide after the trace is complete, based on criteria like error status or duration. More accurate but requires buffering and adds latency. The Collector supports tail-based sampling with the tail_sampling processor.

Common sampling strategies:

  • Rate limiting: Keep a fixed number of traces per second (e.g., 10 traces/sec).
  • Probabilistic: Keep a random percentage (e.g., 10% of all traces).
  • Error-based: Always keep traces that have an error status, and sample the rest.
  • Latency-based: Keep traces that exceed a latency threshold (e.g., >500ms).

Sampling is not a one-size-fits-all. For critical services, you might keep 100% of error traces and 5% of successful ones. The Collector’s tail_sampling processor lets you combine policies with AND/OR logic.

How does OpenTelemetry handle data privacy?

OpenTelemetry itself does not enforce privacy rules; it gives you tools to control what data leaves your system. Privacy concerns usually revolve around sensitive attributes (e.g., user IDs, IP addresses, SQL queries) that might be in spans or metrics.

Key mechanisms:

  • Attribute filtering: Use the attributes processor to delete or mask specific attributes before export. For example, you can remove http.client_ip or db.statement.
  • Resource detection: The SDK automatically adds resource attributes like service.name, host.name, and process.id. You can configure the resource detector to avoid collecting hostnames if that is a concern.
  • Redaction: For sensitive data in log messages, you need to redact at the application level, because the Collector cannot reliably parse free-text logs.
  • Encryption in transit: Always use TLS for OTLP/gRPC connections. The Collector supports TLS server-side and client-side.
  • Data retention: OpenTelemetry does not store data; your backend does. So you must configure retention policies in your backend (e.g., Jaeger, Prometheus) to comply with GDPR or other regulations.

One common misconception is that enabling OpenTelemetry automatically anonymizes data. It does not. You must explicitly configure processors to strip or mask sensitive fields. Also, be aware that sampling can reduce but not eliminate privacy risk—if you sample 10% of traces, you still send 10% of sensitive data.

How to choose between the Agent and Gateway Collector?

You can run the Collector in two modes:

  • Agent: Runs on the same host as your application. It receives telemetry locally, processes it, and exports it to a backend or a gateway. Pros: low latency, easy per-host config. Cons: you need to manage it on every node.
  • Gateway: A central service that receives telemetry from many agents or directly from applications. Pros: central policy control, can do tail-based sampling across services, reduces egress traffic. Cons: a single point of failure (unless you run multiple replicas).

In practice, many deployments use both: an agent on each node for local processing (batching, filtering) and a gateway for central sampling and exporting. The choice depends on your scale and whether you need cross-service sampling.

For small setups (a few services), you can skip the agent entirely and send OTLP directly from your app to a gateway. For large Kubernetes clusters, running the Collector as a DaemonSet (agent) plus a Deployment (gateway) is common.

What are common problems and pitfalls?

Even with a well-designed setup, you may hit issues:

  • Missing context propagation: If you don’t instrument all libraries (e.g., HTTP clients, DB drivers), you’ll get broken traces. Use auto-instrumentation agents where available.
  • Too much data: Without sampling, you’ll overwhelm your backend and your wallet. Start with a sampling policy early.
  • Clock skew: Trace timestamps come from different hosts. Use NTP and be aware that skew can make spans look out of order.
  • Exporter backpressure: If your backend is slow, the Collector can buffer or drop data. Configure batch processors and retries properly.
  • Config errors: YAML indentation mistakes are common. Validate your config with otelcol --validate before deploying.

Another pitfall is forgetting to set the service name. Without it, traces are hard to attribute. Always set service.name as a resource attribute.

How does OpenTelemetry compare to other tools?

OpenTelemetry is not a backend; it is a framework. You still need a storage/visualization tool. Common comparisons:

  • OpenTelemetry vs. Jaeger: Jaeger is a backend for traces. OTel can send data to Jaeger, but Jaeger also has its own instrumentation libraries (now deprecated in favor of OTel).
  • OpenTelemetry vs. Prometheus: Prometheus is a metrics backend with its own pull model. OTel can export metrics to Prometheus via the Prometheus exporter or push to a gateway.
  • OpenTelemetry vs. vendor SDKs: Datadog, New Relic, etc., offer their own SDKs. OTel is vendor-neutral, but you may lose some proprietary features. Many vendors now support OTLP natively.

The main advantage of OTel is avoiding lock-in. You can start with a free backend like Jaeger and later switch to a commercial one without changing your instrumentation.

Frequently Asked Questions

Do I need to run the Collector if I use a cloud provider’s SDK?

No, but it is recommended. Cloud SDKs (e.g., AWS X-Ray SDK) can send directly to the cloud service. However, using the Collector gives you a uniform pipeline, allows you to switch backends, and lets you apply sampling and privacy filters centrally.

Can I use OpenTelemetry for logs?

Yes. OpenTelemetry supports logs as a signal, but the ecosystem is less mature than traces and metrics. You can use the OTLP log exporter, or you can use the Collector to receive logs from Fluent Bit or other sources and export them to a log backend.

What is the difference between OTLP and other protocols?

OTLP is the native protocol for OpenTelemetry. It is efficient (gRPC) and supports traces, metrics, and logs. Jaeger, Zipkin, and Prometheus have their own protocols. The Collector can translate between them, so you can send OTLP from your app and export to Jaeger or Prometheus.

How do I ensure my sampling doesn’t miss critical errors?

Use tail-based sampling with a policy that always keeps traces with error status. For example, set a policy: status_code = ERROR -> keep. Combine with a probabilistic policy for the rest. This way, you never miss an error trace.

Is OpenTelemetry free?

Yes, the framework is open-source and free to use. You only pay for the backend infrastructure you choose (e.g., cloud storage, a commercial observability platform). The Collector itself is lightweight and can run on any VM or container.

Can I send data to multiple backends at once?

Yes. In the Collector config, you can list multiple exporters in the same pipeline. For example, send traces to both Jaeger and a cloud service. You can also have separate pipelines for different data types.

Conclusion

OpenTelemetry gives you a powerful, standardized way to handle observability data, but it requires thoughtful configuration. The Collector is the heart of the system, allowing you to control data flow, sampling, and privacy. By understanding exporters, sampling strategies, and privacy options, you can build an observability stack that is both cost-effective and compliant with your data policies. Start small, validate your setup, and iterate.

Related

Formula used
in t | Finish time | min | 50 | 0
in d | Distance | km | 10 | 0 | 100000
out pace | Average pace | min/km | t / d | 2
out speed | Average speed | km/h | d / (t / 60) | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →