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

OpenTelemetry::Integration::namespace - OpenTelemetry integration for a namespace

SYNOPSIS

    # This integration is EXPERIMENTAL

    use OpenTelemetry::Integration 'namespace' => {
        include => {
            paths => [(
                lib/Local
            )],
        },
        exclude => {
            paths => [qw(
                lib/Local/Secret
            )],
            subroutines => {
                'Some::Package' => [qw(
                    low_level
                )],
            },
        },
    };

DESCRIPTION

See OpenTelemetry::Integration for more details.

Since this is a core module, it's included in the OpenTelemetry core distribution as well.

CONFIGURATION

include / exclude

The include and exclude sections control the package and subroutines that are considered to be relevant by the monitoring code. Fields in the exclude section take precedence.

paths

This field should be set to list of literal paths or path segments. Any code that is loaded from those paths will be included or excluded depending on what section this was under.

For example:

    include => {
        paths => [qw(
            lib/Local
            lib/Test
        )],
    },
    exclude => {
        paths => [qw(
            lib/Local/Secret
        )],
    },

would make all the code that is loaded from lib/Local and lib/Test, except the code loaded from lib/Local/Secret, relevant for monitoring.

subpackages

Perl allows multiple packages to be defined inside the same file, so that importing one file makes all of those packages available, without the subpackages ever being explicitly loaded. Under normal circumstances, this makes these packages invisible to the approach in this integration.

This key makes it possible to specify packages that should be wrapped for monitoring whenever we detect another packages being loaded.

This field should be set to a hash where the keys are package names and the values are lists of packages to be wrapped whenever the parent is.

For example:

    include => {
        subpackages => {
            'Local::Foo' => [qw(
                Local::Foo::Bar
            )],
        },
    },

This mapping has no meaning under exclude, and is ignored in that case.

subroutines

In some cases, some specific subroutines are of interest even though they are defined in packages that would otherwise not be eligible for reporting.

This field makes it possible to mark those subroutines as explicitly relevant or irrelevant depending on the section this is under. If under include, these subroutines will always be wrapped; while under exclude they will never be.

This field should be set to a hash where the keys are package names and the values are lists of subroutine names.

For example:

    include => {
        subroutines => {
            'Local::Splines' => [qw(
                reticulate
            )],
        },
    },
    exclude => {
        subroutines => {
            'Local::Splines' => [qw(
                frobligate
            )],
        },
    },

This would make Local::Splines::reticulate always be wrapped, even if Local::Splines was loaded from a path that was not otherwise specified as relevant. Likewise, Local::Splines::frobligate would never be wrapped, even if Local::Splines was marked as relevant through some other method.

COPYRIGHT

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.