The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

OpenTracing::Implementation::DataDog - Sending traces to DataDog using Agent

VERSION

This is version 'v0.47.0'

WARNING

This version is for

OpenTracing::Interface version v0.204.x
OpenTracing::Role vesion v0.81.2

SYNOPSIS

    use aliased "OpenTracing::Implementation::DataDog", 'Implementation';
    
    my $tracer = Implementation->bootstrap_tracer(
        agent => {
            host            => 'localhost',
            port            => '8126',
            path            => 'v0.3/traces',
        },
        default_service_name    => 'MyService',
        default_service_type    => 'web',
        default_resource_name   => 'my_cgi_endpoint',
        default_hostname        => 'my.host.123',
        default_environment     => 'staging',
    );

DESCRIPTION

This `DataDog` implementation for 'OpenTracing' is fully compliant with the open source definition of OpenTracing::Interface.

This implementation connects to the localhost installed agent by default, that listens to port 8126. It recieves traces at the /v0.3/traces endpoint.

CLASS METHODS

bootstrap_tracer

    my $tracer = OpenTracing::Implementation::DataDog->bootstrap_tracer( );

Returns a OpenTracing::Interface::Tracer compliant tracer, using the OpenTracing::Implementation::NoOp::Tracer implementation.

named paramters

agent

A hasreference with instantiation options for OpenTracing::Implementation::DataDog::Client.

default_context

A hasreference with instantiation options for OpenTracing::Implementation::DataDog::SpanContext. This will be used if no context can be found for <$tracer-extract_context>>.

ENVIRONMENT VARIABLES

For configuring DataDog Tracing there is support for the folllowing environment variables:

DD_AGENT_HOST

Hostname for where to send traces to. If using a containerized environment, configure this to be the host IP.

default: localhost

DD_TRACE_AGENT_PORT

The port number the Agent is listening on for configured host. If the Agent configuration sets receiver_port or DD_APM_RECEIVER_PORT to something other than the default 8126, then DD_TRACE_AGENT_PORT or DD_TRACE_AGENT_URL must match it.

default: 8126

DD_TRACE_AGENT_URL

The URL to send traces to. If the Agent configuration sets receiver_port or DD_APM_RECEIVER_PORT to something other than the default 8126, then DD_TRACE_AGENT_PORT or DD_TRACE_AGENT_URL must match it. The URL value can start with http:// to connect using HTTP or with unix:// to use a Unix Domain Socket.

When set this takes precedence over DD_AGENT_HOST and DD_TRACE_AGENT_PORT.

CAVEATE: the unix: scheme is non-exisitent, and is not supported with the DataDog::Client.

DD_TRACE_PARTIAL_FLUSH_MIN_SPANS

Set a number of partial spans to flush on. Useful to reduce memory overhead when dealing with heavy traffic or long running traces.

default: 100

DD_SERVICE_NAME

The name of a set of processes that do the same job. Used for grouping stats for your application.

default: none

DD_ENV

Your application environment (for example, production, staging).

default: none

DD_HOSTNAME

Manually set the hostname to use for metrics if autodetection fails, or when running the Datadog Cluster Agent.

DD_VERSION

Your application version (for example, 2.5, 202003181415, 1.3-alpha).

default: none

DD_TRACE_PROPAGATION_STYLE

Comma separated list of propagation styles used for extracting trace context from inbound request headers and injecting trace context into outbound request headers.

Overridden by DD_TRACE_PROPAGATION_STYLE_EXTRACT for extraction.

Overridden by DD_TRACE_PROPAGATION_STYLE_INJECT for injection.

The supported values are:

datadog

DataDog native headers, x-datadog-trace-id and x-datadog-parent-id.

b3multi

https://github.com/openzipkin/b3-propagation#multiple-headers

b3 single header

https://github.com/openzipkin/b3-propagation#single-header

tracecontext

https://www.w3.org/TR/trace-context/

none

Propagation disabled.

When checking inbound request headers we will take the first valid trace context in the order provided.

When none is the only propagator listed, propagation is disabled.

All provided styles are injected into the headers of outbound requests.

Example: DD_TRACE_PROPAGATION_STYLE="datadog,b3multi" to check for both x-datadog-* and x-b3-* headers when parsing incoming request headers for a trace context. In addition, to inject both x-datadog-* and x-b3-* headers into outbound requests.

default: datadog

DD_TRACE_PROPAGATION_STYLE_EXTRACT

Override the propagation style for extraction only, see DD_TRACE_PROPAGATION_STYLE for supported values.

DD_TRACE_PROPAGATION_STYLE_INJECT

Override the propagation style for injection only, see DD_TRACE_PROPAGATION_STYLE for supported values.

STRICT

STRICT on itself not a environment variable, but a boolean constant from Devel::StrictMode that uses the following set of environment variables:

PERL_STRICT

EXTENDED_TESTING

AUTHOR_TESTING

RELEASE_TESTING

When any of those are set, tests are run using type constraints and parameter checks are performed, as well as return objects or values. During production it is recommended to keep these switched off for performance improvements.

AUTHOR

Theo van Hoesel <tvanhoesel@perceptyx.com>

COPYRIGHT AND LICENSE

'OpenTracing::Implementation::DataDog' is Copyright (C) 2019 .. 2021, Perceptyx Inc

This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.

This package is distributed in the hope that it will be useful, but it is provided "as is" and without any express or implied warranties.

For details, see the full text of the license in the file LICENSE.