OpenTelemetry Collector | Honeycomb

We use cookies or similar technologies to personalize your online experience & tailor marketing to you. Many of our product features require cookies to function properly.

Read our privacy policy I accept cookies from this site

OpenTelemetry Collector

If you use OpenTelemetry Collector, use OpenTelemetry Collector processors to manage your data volume.

Filtering Span Events and Other Data 

If using version v0.66.0 (or higher) of the OpenTelemetry Collector-Contrib distribution, use the filterprocessor to filter Span Events or any other data before sending it to Honeycomb. The filterprocessor component can be especially helpful if using instrumentations that create a lot of noisy, unneeded data.

To use, add the filterprocessor component as a processor in your OpenTelemetry Collector configuration file, such as otel-collector-config.yaml.

Configure your OpenTelemetry Collector to filter Span Events, similar to:

processors:
  # add the filterprocessor
  filter:
    #  tell it to operate on span data
    traces:
      # Filter out span events with the 'grpc' attribute,
      # or have a span event name with 'grpc' in it.
      spanevent:
        - 'attributes["grpc"] == true'
        - 'IsMatch(name, ".*grpc.*") == true'

Note that each individual line in the spanevent list is a separate filter. If any of the filters match, the span event will be filtered out. In other words, each line is an OR condition.

Additionally, Honeycomb currently translates all fields with the instrumentation_scope.name field into library.name. To filter based on the value of an instrumentation scope, use instrumentation_scope.name instead of library.name.

To require multiple conditions to be true, write a single filter that combines them, similar to:

processors:
  filter:
    traces:
      # Filter out only span events with both the 'grpc' attribute and
      # that have a span event name with 'grpc' in it.
      spanevent:
        - 'attributes["grpc"] == true and IsMatch(name, ".*grpc.*") == true'

You can filter any OpenTelemetry signals, not only Span Events. This example filters data across spans, metrics, and logs:

processors:
  filter:
    traces:
      span:
        - 'attributes["container.name"] == "app_container_1"'
        - 'resource.attributes["host.name"] == "localhost"'
        - 'name == "app_3"'
      spanevent:
        - 'attributes["grpc"] == true'
        - 'IsMatch(name, ".*grpc.*") == true'
    metrics:
      metric:
          - 'name == "my.metric" and attributes["my_label"] == "abc123"'
          - 'type == METRIC_DATA_TYPE_HISTOGRAM'
      datapoint:
          - 'metric.type == METRIC_DATA_TYPE_SUMMARY'
          - 'resource.attributes["service.name"] == "my_service_name"'
    logs:
      log_record:
        - 'IsMatch(body, ".*password.*") == true'
        - 'severity_number < SEVERITY_NUMBER_WARN'

The filtering language is done with the OpenTelemetry Transformation Language (OTTL). Learn more about the OTTL Processor.

Did you find what you were looking for?