Class: Datadog::OpenFeature::Hooks::EvaluationTelemetryOptOutHook
- Inherits:
-
Object
- Object
- Datadog::OpenFeature::Hooks::EvaluationTelemetryOptOutHook
- Defined in:
- lib/datadog/open_feature/hooks/evaluation_telemetry_opt_out_hook.rb
Constant Summary collapse
- PARAMETER =
"dd_evaluation_telemetry_opt_out"
Class Method Summary collapse
Instance Method Summary collapse
- #finally(hook_context:, evaluation_details:, **options) ⇒ Object
-
#initialize(hook) ⇒ EvaluationTelemetryOptOutHook
constructor
A new instance of EvaluationTelemetryOptOutHook.
Constructor Details
#initialize(hook) ⇒ EvaluationTelemetryOptOutHook
Returns a new instance of EvaluationTelemetryOptOutHook.
13 14 15 |
# File 'lib/datadog/open_feature/hooks/evaluation_telemetry_opt_out_hook.rb', line 13 def initialize(hook) @hook = hook end |
Class Method Details
.opted_out?(evaluation_context) ⇒ Boolean
9 10 11 |
# File 'lib/datadog/open_feature/hooks/evaluation_telemetry_opt_out_hook.rb', line 9 def self.opted_out?(evaluation_context) evaluation_context&.fields&.[](PARAMETER).equal?(true) end |
Instance Method Details
#finally(hook_context:, evaluation_details:, **options) ⇒ Object
17 18 19 20 21 |
# File 'lib/datadog/open_feature/hooks/evaluation_telemetry_opt_out_hook.rb', line 17 def finally(hook_context:, evaluation_details:, **) return if self.class.opted_out?(hook_context.evaluation_context) @hook.finally(hook_context: hook_context, evaluation_details: evaluation_details, **) end |