Kernel::System::OpenTelemetry

NAME

Kernel::System::OpenTelemetry – Format performance profile in OpenTelemetry standard.

DESCRIPTION

This class provides functions to transform and export the collected performance profile in OpenTelemetry standard.

ATTRIBUTES

has Config

OpenTelemetry export configuration defined in the settings

SystemMonitoring::OpenTelemetry::Export###001-Log

Write a summary to the Mojolicious log.

SystemMonitoring::OpenTelemetry::Export###101-File

Export complete profile into compressed files. One file per web request.

SystemMonitoring::OpenTelemetry::Export###201-GrafanaTempo

Export complete profile to Grafana Tempo. Send one batch per web request.

has 'ServiceInfo'

Holds basic System Information from the System Configuration.

    my $ServiceInfo = $OpenTelemetryObject->ServiceInfo();

Returns:

    $ServiceInfo = {
        'service.name'        => 'Project Name',
        'service.instance.id' => '123',
        'service.version'     => '2025.8.x git',
    };

has 'HomeDirectory'

Directory where the application is installed.

    my HomeDirectory = $OpenTelemetryObject->HomeDirectory();

Returns:

    HomeDirectory = '/opt/otrs';

has 'LogRequestID'

Determines whether the Mojolicious Request ID should be logged.

If enabled the Mojolicious Request ID will be included in log messages.

Default: The Request ID will be included.

    $OpenTelemetryObject->LogRequestID(1);    # Include the Request ID
    $OpenTelemetryObject->LogRequestID(0);    # Do not include the Request ID

METHODS

around BUILDARGS()

Populate the configuration and service information from the System Configuration if not given.

GetServiceInformation

Collect the basic System Information from the System Configuration.

This function can be called statically

    my $ServiceInfo = GetServiceInformation();

Returns:

    $ServiceInfo = {
        'service.name'        => 'Project Name',
        'service.instance.id' => '123',
        'service.version'     => '2025.8.x git',
    };

GetSystemInformation

Read the Release Information from the RELEASE file and parse it.

This function can be called statically

    my $VersionInfo = GetSystemInformation( Location => $Kernel::OM->Get('Kernel::Config')->Get('Home') . '/RELEASE' );

Returns:

    $VersionInfo = {
        'PRODUCT' => 'OTRS',
        'VERSION' => '2025.8.x git',
    };

Exceptions:

Throws an exception if the file does not exist or is not readable.

BuildProfile()

Transform collected profile into OpenTelemetry format.

    my $OpenTelemetryProfile = $OpenTelemetryObject->BuildProfile(
        RequestID => 'lZiZq05ah0Mb',
        Service   => $SystemInfo,
        Profile   => $ProfilingData,
        Logger    => bless({}, 'Mojo::Log')
    );

BuildModuleScope()

Transform collected profile into OpenTelemetry format.

    my $ScopeData = Kernel::System::OpenTelemetry::BuildModuleScope(
        Module       => 'Kernel::System::DB',
        Profile      => $ProfilingData,
        TraceID      => '738cd60495b24a98f5c286121f16d5ee',
        ParentSpanID => '70667aef15401a5f'
    );

Exceptions:

Throws an exception if the module is not found, cannot be loaded or does not provide the method BuildOpenTelemetryScope()

ExportProfile()

Transform collected profile into OpenTelemetry format.

    my Success = $OpenTelemetryObject->ExportProfile(
        RequestID => 'lZiZq05ah0Mb',
        Service   => $SystemInfo,
        Profile   => $OpenTelemetryProfile,
        Logger    => bless({}, 'Mojo::Log')
    );

Exceptions:

Throws an exception if the module is not found, cannot be loaded or does not provide the method BuildOpenTelemetryScope()

Scroll to Top