line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenTracing::Implementation::DataDog::ID; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
OpenTracing::Implementation::DataDog::ID - 64bit integers for DataDog |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use OpenTracing::Implementation::DataDog::ID qw/random_datadog_id/; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $data_struct = { |
12
|
|
|
|
|
|
|
some_id => random_datadog_id(); |
13
|
|
|
|
|
|
|
}; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
and later: |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
print $data_struct->{some_id}->TO_JSON; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
This package ensures nice 64bit integers, as expected by DataDog. However, some |
26
|
|
|
|
|
|
|
architectures do not support 64bit ints, and only go for 4 bytes. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Under the hood, this is just a nice abstract way to deal with a C<Math::BigInt>. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
our $VERSION = 'v0.46.1'; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
26
|
|
|
26
|
|
4315
|
use parent 'Math::BigInt'; |
|
26
|
|
|
|
|
3009
|
|
|
26
|
|
|
|
|
197
|
|
38
|
26
|
|
|
26
|
|
732366
|
use Math::BigInt::Random::OO; |
|
26
|
|
|
|
|
656743
|
|
|
26
|
|
|
|
|
1438
|
|
39
|
|
|
|
|
|
|
# |
40
|
|
|
|
|
|
|
# $random |
41
|
|
|
|
|
|
|
# |
42
|
|
|
|
|
|
|
# our internal BigInt::Random generator, we only instantiate once |
43
|
|
|
|
|
|
|
# |
44
|
|
|
|
|
|
|
my $random = Math::BigInt::Random::OO->new( length_bin => 63 ); |
45
|
|
|
|
|
|
|
|
46
|
26
|
|
|
26
|
|
284
|
use Exporter qw/import/; |
|
26
|
|
|
|
|
96
|
|
|
26
|
|
|
|
|
3339
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
our @EXPORT_OK = qw/random_datadog_id/; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 EXPORTS OK |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
The following subroutines can be imported into your namespance: |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 random_datadog_id |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Generates a 64bit integer (or actually a 63bit) |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
82
|
|
|
82
|
1
|
408
|
sub random_datadog_id { bless $random->generate() } |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
17
|
|
|
17
|
0
|
578
|
sub TO_JSON { $_[0]->bstr() }; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 SEE ALSO |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=over |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item L<OpenTracing::Implementation::DataDog> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Sending traces to DataDog using Agent. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=back |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item L<Trace and Span ID Formats|https://docs.datadoghq.com/tracing/guide/span_and_trace_id_format/> |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
If you write code that interacts directly with Datadog tracing spans and traces, |
86
|
|
|
|
|
|
|
here’s what you need to know about how span IDs and trace IDs are generated and |
87
|
|
|
|
|
|
|
accepted by Datadog tracing libraries. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=back |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHOR |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Theo van Hoesel <tvanhoesel@perceptyx.com> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
'OpenTracing::Implementation::DataDog' |
101
|
|
|
|
|
|
|
is Copyright (C) 2019 .. 2023, Perceptyx Inc |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under |
104
|
|
|
|
|
|
|
the terms of the Artistic License 2.0. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This package is distributed in the hope that it will be useful, but it is |
107
|
|
|
|
|
|
|
provided "as is" and without any express or implied warranties. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
For details, see the full text of the license in the file LICENSE. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
1; |