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::Integration::System - support tracing system calls

SYNOPSIS

To create trace each time a system is called:

  use OpenTracing::Any qw($tracer);
  use OpenTracing::Integration qw(System);
  system("ls");

Additionally, this modules supports span context propagation using the OPENTRACING_CONTEXT environment variable. Any call to system will fill the environment variable OPENTRACING_CONTEXT=<traceid>:<id> in order to propagate down the context to other programs.

Of course, this requires that the child process implements extracting the span from that variable. Luckily, this perl module can do that for you using:

  use OpenTracing::Any qw($tracer);
  use OpenTracing::Integration qw(System);

  my $span_context = OpenTracing::Integration::System->extract_context();
  my $span;
  if ($span_context)
  {
    $span = $tracer->span(operation_name => 'main', references => [$tracer->child_of($span_context)]);
  }
  else
  {
    $span = $tracer->span(operation_name => 'main');
  }

DESCRIPTION

See OpenTracing::Integration for more details.

AUTHOR

Francis Tremblay francis.tremblay@unity3d.com

LICENSE

Copyright Unity 2021. Licensed under the same terms as Perl itself.