Class: Datadog::DI::Context Private
- Inherits:
-
Object
- Object
- Datadog::DI::Context
- Defined in:
- lib/datadog/di/context.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Contains local and instance variables used when evaluating expressions in DI Expression Language.
Instance Attribute Summary collapse
-
#admission_span ⇒ Datadog::Tracing::SpanOperation?
readonly
private
The APM span active when the probe's hit was admitted by the sampling gate, for a method probe; nil when the hit carried no admission span.
-
#admission_trace ⇒ Datadog::Tracing::TraceOperation?
readonly
private
The APM trace active when the probe's hit was admitted by the sampling gate, for a method probe; nil when the hit carried no admission trace.
-
#caller_locations ⇒ Object
readonly
private
TODO check how many stack frames we should be keeping/sending, this should be all frames for enriched probes and no frames for non-enriched probes?.
-
#duration ⇒ Object
readonly
private
How long the method took to execute, for a method probe.
- #entry_capture_evaluation_errors ⇒ Object readonly private
- #entry_capture_expressions ⇒ Object readonly private
-
#exception ⇒ Object
readonly
private
Exception raised by the method, if any, for a method probe.
- #locals ⇒ Object readonly private
-
#path ⇒ Object
readonly
private
Actual path of the instrumented file.
- #probe ⇒ Object readonly private
-
#return_value ⇒ Object
readonly
private
Return value for the method, for a method probe.
- #serialized_entry_args ⇒ Object readonly private
- #serializer ⇒ Object readonly private
- #settings ⇒ Object readonly private
- #target_self ⇒ Object readonly private
Instance Method Summary collapse
- #fetch(var_name) ⇒ Object private
- #fetch_ivar(var_name) ⇒ Object private
-
#initialize(probe:, settings:, serializer:, locals: nil, target_self: nil, path: nil, caller_locations: nil, serialized_entry_args: nil, entry_capture_expressions: nil, entry_capture_evaluation_errors: nil, admission_trace: nil, admission_span: nil, return_value: nil, duration: nil, exception: nil) ⇒ void
constructor
private
Initializes the context with the probe hit's state.
-
#serialized_locals(serialization_deadline:) ⇒ Hash{Symbol => Hash}?
private
Returns the locals captured at the probe hit in serialized form, or nil when no locals were captured.
Constructor Details
#initialize(probe:, settings:, serializer:, locals: nil, target_self: nil, path: nil, caller_locations: nil, serialized_entry_args: nil, entry_capture_expressions: nil, entry_capture_evaluation_errors: nil, admission_trace: nil, admission_span: nil, return_value: nil, duration: nil, exception: nil) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes the context with the probe hit's state.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/datadog/di/context.rb', line 42 def initialize(probe:, settings:, serializer:, locals: nil, # In Ruby everything is a method, therefore we should always have # a target self. However, if we are not capturing a snapshot, # there is no need to pass in the target self. target_self: nil, path: nil, caller_locations: nil, serialized_entry_args: nil, entry_capture_expressions: nil, entry_capture_evaluation_errors: nil, admission_trace: nil, admission_span: nil, return_value: nil, duration: nil, exception: nil) @probe = probe @settings = settings @serializer = serializer @locals = locals @target_self = target_self @path = path @caller_locations = caller_locations @serialized_entry_args = serialized_entry_args @entry_capture_expressions = entry_capture_expressions @entry_capture_evaluation_errors = entry_capture_evaluation_errors @admission_trace = admission_trace @admission_span = admission_span @return_value = return_value @duration = duration @exception = exception end |
Instance Attribute Details
#admission_span ⇒ Datadog::Tracing::SpanOperation? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The APM span active when the probe's hit was admitted by the sampling gate, for a method probe; nil when the hit carried no admission span.
103 104 105 |
# File 'lib/datadog/di/context.rb', line 103 def admission_span @admission_span end |
#admission_trace ⇒ Datadog::Tracing::TraceOperation? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The APM trace active when the probe's hit was admitted by the sampling gate, for a method probe; nil when the hit carried no admission trace.
96 97 98 |
# File 'lib/datadog/di/context.rb', line 96 def admission_trace @admission_trace end |
#caller_locations ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO check how many stack frames we should be keeping/sending, this should be all frames for enriched probes and no frames for non-enriched probes?
83 84 85 |
# File 'lib/datadog/di/context.rb', line 83 def caller_locations @caller_locations end |
#duration ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
How long the method took to execute, for a method probe
109 110 111 |
# File 'lib/datadog/di/context.rb', line 109 def duration @duration end |
#entry_capture_evaluation_errors ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
89 90 91 |
# File 'lib/datadog/di/context.rb', line 89 def entry_capture_evaluation_errors @entry_capture_evaluation_errors end |
#entry_capture_expressions ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
87 88 89 |
# File 'lib/datadog/di/context.rb', line 87 def entry_capture_expressions @entry_capture_expressions end |
#exception ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Exception raised by the method, if any, for a method probe
112 113 114 |
# File 'lib/datadog/di/context.rb', line 112 def exception @exception end |
#locals ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
74 75 76 |
# File 'lib/datadog/di/context.rb', line 74 def locals @locals end |
#path ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Actual path of the instrumented file.
78 79 80 |
# File 'lib/datadog/di/context.rb', line 78 def path @path end |
#probe ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
71 72 73 |
# File 'lib/datadog/di/context.rb', line 71 def probe @probe end |
#return_value ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return value for the method, for a method probe
106 107 108 |
# File 'lib/datadog/di/context.rb', line 106 def return_value @return_value end |
#serialized_entry_args ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
85 86 87 |
# File 'lib/datadog/di/context.rb', line 85 def serialized_entry_args @serialized_entry_args end |
#serializer ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
73 74 75 |
# File 'lib/datadog/di/context.rb', line 73 def serializer @serializer end |
#settings ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
72 73 74 |
# File 'lib/datadog/di/context.rb', line 72 def settings @settings end |
#target_self ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
75 76 77 |
# File 'lib/datadog/di/context.rb', line 75 def target_self @target_self end |
Instance Method Details
#fetch(var_name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
124 125 126 127 128 129 130 |
# File 'lib/datadog/di/context.rb', line 124 def fetch(var_name) unless locals # TODO return "undefined" instead? return nil end locals[var_name.to_sym] end |
#fetch_ivar(var_name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
132 133 134 |
# File 'lib/datadog/di/context.rb', line 132 def fetch_ivar(var_name) target_self.instance_variable_get(var_name) end |
#serialized_locals(serialization_deadline:) ⇒ Hash{Symbol => Hash}?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the locals captured at the probe hit in serialized form, or nil when no locals were captured.
119 120 121 122 |
# File 'lib/datadog/di/context.rb', line 119 def serialized_locals(serialization_deadline:) # TODO cache? locals && serializer.serialize_vars(locals, deadline: serialization_deadline, **probe.snapshot_serializer_limits(settings)) end |