open-telemetry / open-telemetry/opentelemetry-php

`OTEL_METRICS_EXEMPLAR_FILTER` does not accept the specification values

Open Beginner friendly
#2,054 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
PHP
Stars
912
Forks
232
Avg merge
7d 16h
Merged PRs (30d)
4

Description

MeterProviderFactory::createExemplarFilter() matches all, with_sampled_trace, none instead of the specification's always_on, trace_based, always_off. A spec-compliant value hits the default branch, logs "Unknown exemplar filter", and silently results in no exemplars being captured.

Steps to reproduce

OTEL_PHP_AUTOLOAD_ENABLED=true
OTEL_METRICS_EXEMPLAR_FILTER=always_on
Globals::meterProvider()
    ->getMeter('test')
    ->createCounter('no-span.counter')
    ->add(1);

What is the expected behavior?
Metric contains exemplar.

What is the actual behavior?
Metric does not contain exemplar.

Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating MeterProviderFactory::createExemplarFilter() and inspect how OTEL_METRICS_EXEMPLAR_FILTER is matched. Reproduce with OTEL_PHP_AUTOLOAD_ENABLED=true and OTEL_METRICS_EXEMPLAR_FILTER=always_on, then verify that the specification values select the intended filters and the metric contains an exemplar.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
observability
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.