-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
the spec has added in-development otlp file/stdout exporter. We already supported this programmatically, so add some factories and sdk config to allow configuration from environment (only for stdout, per spec)
- Loading branch information
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Contrib\Otlp; | ||
|
||
use OpenTelemetry\SDK\Common\Export\Stream\StreamTransportFactory; | ||
use OpenTelemetry\SDK\Logs\LogRecordExporterFactoryInterface; | ||
use OpenTelemetry\SDK\Logs\LogRecordExporterInterface; | ||
|
||
class StdoutLogsExporterFactory implements LogRecordExporterFactoryInterface | ||
{ | ||
public function create(): LogRecordExporterInterface | ||
{ | ||
$transport = (new StreamTransportFactory())->create('php://stdout', ContentTypes::NDJSON); | ||
|
||
return new LogsExporter($transport); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Contrib\Otlp; | ||
|
||
use OpenTelemetry\SDK\Common\Export\Stream\StreamTransportFactory; | ||
use OpenTelemetry\SDK\Metrics\MetricExporterFactoryInterface; | ||
use OpenTelemetry\SDK\Metrics\MetricExporterInterface; | ||
|
||
class StdoutMetricExporterFactory implements MetricExporterFactoryInterface | ||
{ | ||
public function create(): MetricExporterInterface | ||
{ | ||
$transport = (new StreamTransportFactory())->create('php://stdout', ContentTypes::NDJSON); | ||
|
||
return new MetricExporter($transport); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\Contrib\Otlp; | ||
|
||
use OpenTelemetry\SDK\Common\Export\Stream\StreamTransportFactory; | ||
use OpenTelemetry\SDK\Trace\SpanExporter\SpanExporterFactoryInterface; | ||
use OpenTelemetry\SDK\Trace\SpanExporterInterface; | ||
|
||
class StdoutSpanExporterFactory implements SpanExporterFactoryInterface | ||
{ | ||
public function create(): SpanExporterInterface | ||
{ | ||
$transport = (new StreamTransportFactory())->create('php://stdout', ContentTypes::NDJSON); | ||
|
||
return new SpanExporter($transport); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters