open-telemetry / open-telemetry/opentelemetry-php

Inconsistent console exporter behavior/documentation

Open
#1,645 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Is your feature request related to a problem?
Not really a problem, but an observation.

Code discrepancies:

  • OpenTelemetry\SDK\Logs\Exporter\ConsoleExporter depends on being created by ConsoleExporterFactory to create the appropriate stream transport, otherwise it's not actually exporting to the consol
  • OpenTelemetry\SDK\Metrics\MetricExporter\ConsoleMetricExporter uses echo for output (the only time echo is used anywhere in the SDK)
  • OpenTelemetry\SDK\Trace\SpanExporter\ConsoleSpanExporter depends on SpanExporterFactoryInterface in the same manner as the Log exporter

Documentation discrepancies:

Referencing this otel.io page:

  • Under "Instrumentation setup>Initialize the SDK" the example instrumentation.php creates each exporter by configuring the stream transport directly
  • Under "Traces>Span Processor" the ConsoleSpanExporterFactory is used
  • Under "Metrics>Setup" the ConsoleMetricExporterFactory is used
  • Under "Logs>Setup" the stream transport is configured directly

Describe the solution you'd like

  • Update ConsoleMetricExporter to use a transport instead of echo
  • Update all three exporters to have a default stream transport targeting php://stdout so they are functionally "console" exporters even without the factory
  • Remove the (then redundant) default transport from the factories
  • Update the documentation to use the console exporter factory in all instances

Describe alternatives you've considered
Checked for any related issues, did not see any.

Additional context
None.

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 reading ConsoleExporter, ConsoleMetricExporter, ConsoleSpanExporter, and their corresponding factory classes to compare transport and output handling. Review the referenced instrumentation, span processor, metrics, and logs documentation, then verify that all exporters consistently target php://stdout and that the documentation consistently uses the console exporter factories.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation, observability-sre
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.