=encoding UTF-8

=head1 NAME

OpenTelemetry::Constants - Constants used by OpenTelemetry

=head1 SYNOPSIS

    use OpenTelemetry::Constants -span_status;
    use OpenTelemetry::Constants
        -trace_export => { -as => sub { shift =~ s/^TRACE_EXPORT_//r } };

=head1 DESCRIPTION

This package includes constants used by different parts of OpenTelemetry.

It uses L<Exporter::Tiny> to make it easier to export these symbols in a
way that is most helpful depending on the context. Please look at the
documentation of that module for details on what is supported.

=head1 CONSTANTS

=head2 Span Status Codes

These constants are used to specify the status of a span once it has
completed. They can be imported individually, or with the C<span_status> tag.

=over

=item SPAN_STATUS_UNSET

The status of a span when no status has been set. This is the default value.

=item SPAN_STATUS_OK

The status of a span that has been marked as having completed successfully by
an application.

=item SPAN_STATUS_ERROR

The status of a span that has been marked as not having completed successfully
by an application.

=back

=head2 Span Kinds

These constants are used to specify the type of the span. They can be imported
individually, or with the C<span_kind> tag.

=over

=item SPAN_KIND_INTERNAL

The span is internal to an application, and is not at one of its boundaries
(eg. with other applications). If no kind is specified, this is the default
value.

=item SPAN_KIND_SERVER

The span covers the server-side handling of some remote network request.

=item SPAN_KIND_CLIENT

The span describes a request to a remote service.

=item SPAN_KIND_PRODUCER

The span describes a message sent to a broker. Unlike the client and server
kinds above, the action represented by this span ends once the broker accepts
the message, even if the logical processing of that message can take longer.

=item SPAN_KIND_CONSUMER

The span describes a consumer receiving a message from a broker.

=back

=head2 Trace Export Results

These constants are used to distinguish the result of a trace export
operation. They can be imported individually, or with the C<trace_export> tag.

=over

=item TRACE_EXPORT_SUCCESS

Marks an export operation as a success.

=item TRACE_EXPORT_FAILURE

Marks an export operation as a failure.

=item TRACE_EXPORT_TIMEOUT

Marks an export operation that was interrupted because it took too long.

=back

=head2 Placeholder Invalid IDs

These constants are used as global null values for span and trace IDs.
They can be imported individually.

=over

=item INVALID_SPAN_ID

Returns a constant ID that can be used to identify an invalid span in bytes.

=item INVALID_TRACE_ID

Returns a constant ID that can be used to identify an invalid trace in bytes.

=item HEX_INVALID_SPAN_ID

Returns a constant ID that can be used to identify an invalid span as a
hexadecimal string in lowercase.

=item HEX_INVALID_TRACE_ID

Returns a constant ID that can be used to identify an invalid trace as a
hexadecimal string in lowercase.

=back

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2023 by José Joaquín Atria.

This is free software; you can redistribute it and/or modify it under the same
terms as the Perl 5 programming language system itself.
