|
C++ Server-Side SDK
LaunchDarkly SDK
|
#include <hook.hpp>
Public Member Functions | |
| TrackSeriesContext (Context const &context, std::string key, std::optional< double > metric_value, std::optional< std::reference_wrapper< Value const >> data, HookContext const &hook_context, std::optional< std::string > environment_id) | |
| Context const & | TrackContext () const |
| std::string_view | Key () const |
| std::optional< double > | MetricValue () const |
| std::optional< std::reference_wrapper< Value const > > | Data () const |
| std::optional< std::string_view > | EnvironmentId () const |
| HookContext const & | HookCtx () const |
Context for track series handlers. Provides readonly information about the track call being performed.
Lifetime: Objects of this type are valid only during the execution of a hook stage. Do not store references, pointers, or string_views from this context. If you need any data beyond the stage execution, copy it to owned types (e.g., std::string, Value).
| launchdarkly::server_side::hooks::TrackSeriesContext::TrackSeriesContext | ( | Context const & | context, |
| std::string | key, | ||
| std::optional< double > | metric_value, | ||
| std::optional< std::reference_wrapper< Value const >> | data, | ||
| HookContext const & | hook_context, | ||
| std::optional< std::string > | environment_id | ||
| ) |
Constructs a track series context.
| context | The context associated with the track call. |
| key | The event key. |
| metric_value | Optional metric value. |
| data | Optional reference to application-specified data. |
| hook_context | Additional context data provided by the caller. |
| environment_id | Optional environment ID. |
| std::optional< std::reference_wrapper< Value const > > launchdarkly::server_side::hooks::TrackSeriesContext::Data | ( | ) | const |
Returns the application-specified data associated with the track call.
Lifetime: The returned reference (if present) is valid only during the execution of the current hook stage. If you need the value beyond this call, make a copy.
| std::optional< std::string_view > launchdarkly::server_side::hooks::TrackSeriesContext::EnvironmentId | ( | ) | const |
Returns the environment ID if available. Only available once initialization has completed.
Lifetime: If present, the returned string_view is valid only during the execution of the current hook stage. If you need the environment ID beyond this call, copy it to a std::string.
| HookContext const & launchdarkly::server_side::hooks::TrackSeriesContext::HookCtx | ( | ) | const |
Returns the hook context provided by the caller.
This contains arbitrary data that the caller wants to pass through to hooks, such as OpenTelemetry span parents.
Lifetime: The returned reference is valid only during the execution of the current hook stage.
| std::string_view launchdarkly::server_side::hooks::TrackSeriesContext::Key | ( | ) | const |
Returns the key associated with the track call.
Lifetime: The returned string_view is valid only during the execution of the current hook stage. If you need the key beyond this call, copy it to a std::string.
| std::optional< double > launchdarkly::server_side::hooks::TrackSeriesContext::MetricValue | ( | ) | const |
Returns the optional metric value associated with the track call.
| Context const & launchdarkly::server_side::hooks::TrackSeriesContext::TrackContext | ( | ) | const |
Returns the context associated with the track call.
Lifetime: The returned Context reference is valid only during the execution of the current hook stage. If you need context data beyond this call, copy the necessary fields.