Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opentelemetry-php/api
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.9.0
Choose a base ref
...
head repository: opentelemetry-php/api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.10.0
Choose a head ref
  • 5 commits
  • 5 files changed
  • 5 contributors

Commits on Apr 29, 2026

  1. Add trigger_error as Log Destination Option (#1939)

    * Add trigger_error as log destination option
    
    * Update tests/Unit/API/Behavior/Internal/LogWriterFactoryTest.php
    
    Co-authored-by: Chris Lightfoot-Wild <[email protected]>
    
    ---------
    
    Co-authored-by: Chris Lightfoot-Wild <[email protected]>
    SoulofAkuma and ChrisLightfootWild authored Apr 29, 2026
    Configuration menu
    Copy the full SHA
    09f423a View commit details
    Browse the repository at this point in the history

Commits on May 28, 2026

  1. Enforce W3C Baggage size and entry-count caps in Parser (#1975)

    The W3C Baggage specification recommends a max of 8192 total bytes and
    180 list-members. `Parser::parseInto` walked the entire
    `explode(',', $header)` with no cap on header byte size, no cap on
    entry count, and no per-entry length cap, allowing a single inbound
    HTTP request with an oversized `baggage` header to consume linear
    CPU/memory in PHP-FPM workers.
    
    This change adds two private constants `MAX_BAGGAGE_BYTES` (8192) and
    `MAX_BAGGAGE_ENTRIES` (180), rejects the whole header up-front when
    `strlen($header) > MAX_BAGGAGE_BYTES`, and breaks the parse loop once
    the entry cap is reached. Mirrors the inject-side caps already in the
    go, dotnet, cpp, and (post-1.62.0) java SDKs.
    
    Background context: GHSA-7f5h-mpj3-v3hf (closed advisory; treated as a
    hardening bug per the project security policy).
    
    Refs: https://www.w3.org/TR/baggage/#limits
    tonghuaroot authored May 28, 2026
    Configuration menu
    Copy the full SHA
    a5d4df2 View commit details
    Browse the repository at this point in the history
  2. Add W3C Baggage boundary tests and entry-counter intent comment (#1976)

    Follow-up to #1975. Pins the exact off-by-one behaviour of the W3C
    Baggage caps that the existing tests (1024 pairs / 500 pairs) only
    exercised well past the limits:
    
    - byte cap is inclusive: 8192 bytes accepted, 8193 bytes rejected
    - list-member cap: 180 entries accepted, 181st dropped
    
    Also documents that $entries counts only ACCEPTED pairs (incremented at
    the bottom of the loop), not raw comma-separated list-members, so a
    future change does not silently move the counter and alter semantics.
    
    Signed-off-by: tonghuaroot <[email protected]>
    tonghuaroot authored May 28, 2026
    Configuration menu
    Copy the full SHA
    5c33a03 View commit details
    Browse the repository at this point in the history

Commits on Jun 23, 2026

  1. feat(sdk): implement OTel SDK self-observability metrics (#1987)

    * feat(sdk): implement OTel SDK self-observability metrics (Trace + Logs)
    
    Replace legacy otel.trace.span_processor.* and otel.logs.log_processor.*
    metrics with the standardized otel.sdk.* names from the semconv spec.
    Add new metrics: otel.sdk.span.started, otel.sdk.span.live,
    otel.sdk.processor.span.{queue.capacity,queue.size,processed},
    otel.sdk.exporter.span.{inflight,exported}, otel.sdk.log.created,
    otel.sdk.processor.log.{queue.capacity,queue.size,processed},
    otel.sdk.exporter.log.{inflight,exported}.
    
    Wire MeterProvider into TracerProvider, TracerProviderBuilder,
    LoggerProvider, LoggerProviderBuilder and the config-based
    OpenTelemetrySdk so all signals are instrumented automatically.
    
    * feat(sdk): add metric reader and exporter self-observability metrics
    
    Add otel.sdk.metric_reader.collection.duration (Histogram),
    otel.sdk.exporter.metric_data_point.inflight (UpDownCounter) and
    otel.sdk.exporter.metric_data_point.exported (Counter) to ExportingReader.
    
    ExportingReader accepts an optional MeterProvider to avoid a circular
    dependency — pass a separate provider instance for self-observability.
    
    * fix(sdk): improved self-observability metrics
    
    - Add hasShutdown() guard in Logger::emit() before incrementing log counter
    - Fix ExportingReader::countDataPoints() to use count() for arrays instead
      of iterator_count() which would exhaust generators
    - Fix ExportingReader::doCollect() to record collection duration before
      export, not after, matching the spec intent
    - Replace all literal attribute/metric name strings with OtelIncubatingAttributes
      and OtelIncubatingMetrics constants across TracerSharedState, LoggerSharedState,
      SpanBuilder, Span, BatchSpanProcessor, BatchLogRecordProcessor, ExportingReader
    
    * fix(sdk): improved self-observability metrics
    
    Replace iterator_count() fallback in ExportingReader::countDataPoints()
    with 0 to avoid exhausting generators before export. Use '_OTHER' (semconv
    catch-all) instead of 'export_failure' for metric export failures where no
    exception class is available. Track dropped spans/logs in the processed counter
    with error.type='_OTHER' to restore observability of queue-full drops. Add
    tests verifying counter values after successful export and after queue-full
    drops for BatchSpanProcessor, BatchLogRecordProcessor and ExportingReader.
    
    * fix(sdk): fixed self-observability metrics
    
    - ExportingReader: wrap export() in try/finally so dataPointInflightCounter
      is always decremented even if the exporter throws
    - ExportingReader: fix countDataPoints() to use is_countable() instead of
      is_array() (dataPoints is typed iterable, not array) and remove dead isset()
    - ExportingReader/BatchSpanProcessor/BatchLogRecordProcessor: move
      ReflectionClass call inside the meterProvider non-null branch to avoid
      unnecessary reflection when self-observability is disabled
    - ExportingReader/BatchSpanProcessor/BatchLogRecordProcessor: replace
      static \$instanceCount with spl_object_id(\$this) for stable, test-safe
      instance naming that does not accumulate global state across test runs
    - BatchSpanProcessor/BatchLogRecordProcessor: remove dead \$dropped and
      \$processed fields; drops and processed counts are now fully captured
      by the self-observability counters
    - Logger: add hasShutdown() check to isEnabled() to match emit() behaviour;
      previously isEnabled() returned true for post-shutdown loggers while
      emit() silently dropped records
    - LoggerProviderFactory: forward \$meterProvider to LoggerProvider so that
      factory-created providers emit self-observability metrics
    - Context: add withMeterProvider() to allow updating the config context
      after MeterProvider is constructed
    - OpenTelemetrySdk: update \$context with the real MeterProvider before
      building span/log processors so that BatchSpanProcessor and
      BatchLogRecordProcessor receive it via \$context->meterProvider
    
    * fix(sdk): code style fixes
    
    * fix(sdk): remove Noop metric instrument dependencies from SDK layer
    
    Replace NoopCounter/NoopUpDownCounter/NoopHistogram defaults with
    nullable properties and null-safe ?-> operator, eliminating all
    deptrac violations where SDK depended on API\Metrics\Noop\*.
    Also add Sum instanceof assertions in tests to satisfy PHPStan.
    
    * fix(sdk): fix import ordering in test files
    
    * fix(sdk): fix phan readonly property and type errors
    
    Replace early-return pattern with if/else so Phan correctly sees
    each readonly metric property assigned exactly once per branch.
    Also replace is_countable/count with is_array/count for dataPoints
    to satisfy Phan's type narrowing, and remove unused Metric import.
    
    * fix(sdk): use local variable for Phan type narrowing in countDataPoints
    
    * fix(sdk): fix psalm errors in self-observability metrics
    
    - Change attribute array PHPDoc types from array<string, string> to
      array<non-empty-string, string> to satisfy psalm metric instrument
      iterable key constraints
    - Add @psalm-suppress RedundantCondition for isset($metric->data) which
      guards against uninitialized typed property at runtime
    - Fix test code: replace spread operator on iterable with is_array()
      assertion; replace reset()->value chain with explicit variable and
      assert($dp !== false) narrowing
    
    * fix(sdk): address PR review comments on self-observability metrics
    
    Add dataPointCount() to DataInterface so ExponentialHistogram and any future
    data type is forced to implement counting instead of silently returning 0.
    Extract repeated MeterProvider test setup into MeterProviderFactory helper.
    
    * fix(sdk): fix import ordering in test files after refactor
    
    * fix(sdk): add #[Override] to dataPointCount() implementations
    intuibase authored Jun 23, 2026
    Configuration menu
    Copy the full SHA
    47f87ae View commit details
    Browse the repository at this point in the history

Commits on Jul 6, 2026

  1. fix: preserve debug log level priority in Logging::level() (#1991)

    * fix(api): preserve debug log level priority in Logging::level()
    
    array_search returns 0 for debug (first in the LEVELS array) and false
    when not found; the old ?: 1 collapsed both to 1 (info), silently
    ignoring debug-level messages. Use !== false to distinguish the two.
    
    * test(api): set debug log level for test_log_methods debug case
    
    The debug data set relied on the pre-f46ff1d6 bug that collapsed
    debug's priority to info. With the fix, debug is correctly below the
    default info threshold, so set OTEL_LOG_LEVEL=debug to exercise all
    levels.
    jorgsowa authored Jul 6, 2026
    Configuration menu
    Copy the full SHA
    7c029c4 View commit details
    Browse the repository at this point in the history
Loading