STRACT: A JSON encoder for the OTLP exporter
package OpenTelemetry::Exporter::OTLP::Encoder::JSON;
our $VERSION = '0.021';
class OpenTelemetry::Exporter::OTLP::Encoder::JSON {
use JSON::MaybeXS
lemetry::SDK::Logs::LogRecord';
method content_type () { 'application/json' }
method serialise ($data) { encode_json $data }
method encode_arraylist ($v) {
[ map $self->encode_a
OpenTelemetry::Exporter::OTLP::Encoder::Protobuf
:isa(OpenTelemetry::Exporter::OTLP::Encoder::JSON) {
use OpenTelemetry::Constants 'INVALID_SPAN_ID';
use OpenTelemetry::Proto;
use Ref
default exporter used by
L<OpenTelemetry::SDK>, and can be used to export data either using plain
JSON strings, or binary protocol buffer blobs. See below for details.
=head1 METHODS
This class impl
col
OTLP supports multiple protocols. This exporter currently supports only
"http/json", which exports data as a JSON string over HTTP, and
"http/protobuf", which exports it as a Protobuf-encoded bin
lt to "http/protobuf". Otherwise the exporter will
fall back to "http/json", using whatever encoding back-end is provided by
L<JSON::MaybeXS>.
If the value is set to a value other than the ones laid
::Encoder::JSON - A JSON encoder for the OTLP exporter
=head1 SYNOPSIS
use OpenTelemetry::Exporter::OTLP::Encoder::JSON;
my $encoded = OpenTelemetry::Exporter::OTLP::Encoder::JSON->new
ncoder class used by L<OpenTelemetry::Exporter::OTLP> when using
the "http/json" protocol. It encodes telemetry data as a JSON string
complying with the 1.2.0 version of
L<the OTLP specification|https
github.com/open-telemetry/opentelemetry-proto/tree/v1.2.0>.
This encoder uses L<JSON::MaybeXS> to find a suitable JSON encoder. Please
refer to the documentation of that module for details on how you
ffers::Dynamic;
1;
};
my $PROTOCOL = $CAN_USE_PROTOBUF ? 'http/protobuf' : 'http/json';
my $COMPRESSION = eval {
require Compress::Zlib;
'gzip';
} // 'none';
/(protobuf|json)$/;
my $class = 'OpenTelemetry::Exporter::OTLP::Encoder::';
$class .= 'Protobuf' if $1 eq 'protobuf';
$class .= 'JSON' if $1 eq 'json';
oder class. Defaulting to JSON',
{ class => $class, error => $e },
);
require OpenTelemetry::Exporter::OTLP::Encoder::JSON;
OpenTel