Redis::OpenTracing - Wrap Redis inside OpenTracing
package My::Awesome::Module; use strict; use warnings; use Redis use Redis::OpenTracing; my $redis = Redis::OpenTracing->new( redis => Redis->new( ), tags => { 'peer.address' => '127.0.0.1:6379' }, ); my $value = $redis->get( 'my-key' ); 1;
The example above will use the default Redis server (from $ENV{REDIS_SERVER}) and the Global Tracer (from $ENV{OPENTRACING_IMPLEMENTATION}.
$ENV{REDIS_SERVER}
$ENV{OPENTRACING_IMPLEMENTATION}
It will create span with the name Redis::GET, enriched with package / subroutine name and line number for easy debugging.
Redis::GET
new
Creates a new Redis::OpenTracing client.
Redis::OpenTracing
my $redis = Redis::OpenTracing->new( redis => Redis::Fast->new, tags => { 'component' => 'Perl5 Redis::Fast 0.31', 'peer.address' => '127.0.0.1:6379', } );
redis
Object
A (existing) Redis client. This must be something like an instance of Redis, and implement its methods to work properly.
tags
HashRef[Values]
A hash reference that can hold tags being used for span enrichment. OpenTracing expects the following tags: component, db.statement, db.type, span.kind, and peer.address. The component can be set, but defaults to the classname of the redis client. It is strongly advised to provide a the peer.addres, which can not be easily extracted at a reliable way. The other tags can not be changed and are hard coded.
component
db.statement
db.type
span.kind
peer.address
peer.addres
Theo van Hoesel <tvanhoesel@perceptyx.com>
The people listed below have helped to improve the quality of the code and fixed issues. Your work and effort is very much appreciated.
Szymon Nieznanski <s.nez@member.fsf.org>
Redis::OpenTracing is Copyright (C) 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 library 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.
To install Redis::OpenTracing, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Redis::OpenTracing
CPAN shell
perl -MCPAN -e shell install Redis::OpenTracing
For more information on module installation, please visit the detailed CPAN module installation guide.