| 1 | 4 | ▶ | use Object::Pad ':experimental(init_expr)'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | # ABSTRACT: Represents an OpenTelemetry log entry | ||||||||||
| 3 | |||||||||||
| 4 | package OpenTelemetry::SDK::Logs::LogRecord; | ||||||||||
| 5 | |||||||||||
| 6 | 4 | our $VERSION = '0.101'; | |||||||||
| 7 | |||||||||||
| 8 | class OpenTelemetry::SDK::Logs::LogRecord { | ||||||||||
| 9 | 4 | ▶ | use Ref::Util 'is_ref'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 4 | ▶ | use Storable 'dclone'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 4 | ▶ | use Time::HiRes 'time'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 4 | ▶ | use OpenTelemetry::Trace; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | field $attributes :param //= {}; | ||||||||||
| 15 | 4 | field $timestamp :param :reader = undef; | |||||||||
| 16 | 2 | ▶ | field $observed_timestamp :param :reader //= time; | ||||||||
|
Subroutine
timestamp: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 17 | 3 | ▶ | field $context :param = undef; | ||||||||
|
Subroutine
observed_timestamp: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 18 | 2 | ▶ | field $severity_text :param :reader; | ||||||||
|
Subroutine
severity_text: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 19 | 2 | ▶ | field $severity_number :param :reader; | ||||||||
|
Subroutine
severity_number: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 20 | 2 | ▶ | field $resource :param :reader; | ||||||||
|
Subroutine
resource: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 21 | 4 | ▶ | field $instrumentation_scope :param :reader; | ||||||||
|
Subroutine
instrumentation_scope: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 22 | 4 | field $body :param; | |||||||||
| 23 | |||||||||||
| 24 | ADJUSTPARAMS ($params) { | ||||||||||
| 25 | $attributes = dclone $attributes; | ||||||||||
| 26 | $body = is_ref $body ? dclone $body : $body; | ||||||||||
| 27 | |||||||||||
| 28 | # The constructor accepts an OpenTelemetry::Context | ||||||||||
| 29 | # but we only store the SpanContext internally | ||||||||||
| 30 | $context = OpenTelemetry::Trace | ||||||||||
| 31 | ->span_from_context($context)->context; | ||||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 6 | ▶ | method body { is_ref $body ? dclone $body : $body } | ||||||||
|
Subroutine
body: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||
| 35 | |||||||||||
| 36 | # TODO: We don't currently restrict LogRecord attributes | ||||||||||
| 37 | # The spec is a little vague on exactly how the attribute | ||||||||||
| 38 | # restrictions work for LogRecord objects, but a reasonable | ||||||||||
| 39 | # interpretation would be that the normal restrictions apply | ||||||||||
| 40 | # _except_ the one that states that values can be either | ||||||||||
| 41 | # nuclear types, or arrays of nuclear types. The ability | ||||||||||
| 42 | # to set attributes that are nested arbitrarily deep is | ||||||||||
| 43 | # needed to support existing loggers in the wild, and this | ||||||||||
| 44 | # is not currently supported by OpenTelemetry::Attributes. | ||||||||||
| 45 | # If we want to add it we'd probably need some way to | ||||||||||
| 46 | # opt-in to the lax behaviour, probably like we used to do | ||||||||||
| 47 | # for read-write attributes, which was removed in | ||||||||||
| 48 | # 66ff6a4d83afdeb99882e524f7e37261fe337304. | ||||||||||
| 49 | # Alternatively, we can expose the attribute validation | ||||||||||
| 50 | # logic so we can call it from here, but that'd be more | ||||||||||
| 51 | # awkward, because it relies on knowing what the limits | ||||||||||
| 52 | # are. Let's not even get into the name of the SpanLimits | ||||||||||
| 53 | # class, which would now apply to more than just spans... | ||||||||||
| 54 | 2 | ▶ | method dropped_attributes () { 0 } | ||||||||
|
Subroutine
dropped_attributes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 55 | 5 | ▶ | method attributes { dclone $attributes } | ||||||||
|
Subroutine
attributes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 56 | |||||||||||
| 57 | 2 | ▶ | method trace_flags () { $context->trace_flags } | ||||||||
|
Subroutine
trace_flags: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 58 | 1 | ▶ | method trace_state () { $context->trace_state } | ||||||||
|
Subroutine
trace_state: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 59 | 1 | ▶ | method trace_id () { $context->trace_id } | ||||||||
|
Subroutine
trace_id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 60 | 2 | ▶ | method hex_trace_id () { $context->hex_trace_id } | ||||||||
|
Subroutine
hex_trace_id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 61 | 1 | ▶ | method span_id () { $context->span_id } | ||||||||
|
Subroutine
span_id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 62 | 2 | ▶ | method hex_span_id () { $context->hex_span_id } | ||||||||
|
Subroutine
hex_span_id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 63 | 4 | } | |||||||||