C++ Server-Side SDK
LaunchDarkly SDK
Typedefs | Functions
track_series_context.h File Reference

C bindings for read-only track context passed to afterTrack hooks. More...

#include <launchdarkly/bindings/c/export.h>
#include <launchdarkly/server_side/bindings/c/hook_context.h>
#include <launchdarkly/bindings/c/value.h>
#include <launchdarkly/bindings/c/context.h>
#include <stdbool.h>
Include dependency graph for track_series_context.h:

Go to the source code of this file.

Typedefs

typedef struct p_LDServerSDKTrackSeriesContext * LDServerSDKTrackSeriesContext
 

Functions

 LDTrackSeriesContext_Key (LDServerSDKTrackSeriesContext track_context)
 Get the event key for the track call. More...
 
 LDTrackSeriesContext_Context (LDServerSDKTrackSeriesContext track_context)
 Get the context (user/organization) associated with the track call. More...
 
 LDTrackSeriesContext_Data (LDServerSDKTrackSeriesContext track_context, LDValue *out_data)
 Get the application-specified data for the track call, if any. More...
 
 LDTrackSeriesContext_MetricValue (LDServerSDKTrackSeriesContext track_context, double *out_metric_value)
 Get the metric value for the track call, if any. More...
 
 LDTrackSeriesContext_HookContext (LDServerSDKTrackSeriesContext track_context)
 Get the hook context provided by the caller. More...
 
 LDTrackSeriesContext_EnvironmentId (LDServerSDKTrackSeriesContext track_context)
 Get the environment ID, if available. More...
 

Detailed Description

C bindings for read-only track context passed to afterTrack hooks.

TrackSeriesContext provides information about a track event to hook callbacks. Most data is read-only and valid only during the callback execution.

LIFETIME AND OWNERSHIP:

Function Documentation

◆ LDTrackSeriesContext_Context()

LDTrackSeriesContext_Context ( LDServerSDKTrackSeriesContext  track_context)

Get the context (user/organization) associated with the track call.

Parameters
track_contextTrack context. Must not be NULL.
Returns
Context object. Valid only during the callback execution. Must not be freed. Do not call LDContext_Free() on this.

◆ LDTrackSeriesContext_Data()

LDTrackSeriesContext_Data ( LDServerSDKTrackSeriesContext  track_context,
LDValue out_data 
)

Get the application-specified data for the track call, if any.

LIFETIME: Returns a temporary value valid only during the callback. Do not call LDValue_Free() on the returned value.

USAGE:

LDValue data;
if (LDTrackSeriesContext_Data(track_context, &data)) {
// Use data (valid only during callback)
char const* str = LDValue_GetString(data);
// Do NOT call LDValue_Free(data)
}
LDTrackSeriesContext_Data(LDServerSDKTrackSeriesContext track_context, LDValue *out_data)
Get the application-specified data for the track call, if any.
Definition: track_series_context.cpp:33
LDValue_GetString(LDValue val)
struct _LDValue * LDValue
Definition: value.h:64
Parameters
track_contextTrack context. Must not be NULL.
out_dataPointer to receive the data value. Must not be NULL. Set to a temporary LDValue (valid only during callback). Do not call LDValue_Free() on this value. Set to NULL if no data was provided.
Returns
true if data was provided, false if no data.

◆ LDTrackSeriesContext_EnvironmentId()

LDTrackSeriesContext_EnvironmentId ( LDServerSDKTrackSeriesContext  track_context)

Get the environment ID, if available.

The environment ID is only available after SDK initialization completes. Returns NULL if not yet available.

Parameters
track_contextTrack context. Must not be NULL.
Returns
Environment ID as null-terminated UTF-8 string, or NULL if not available. Valid only during the callback execution. Must not be freed.

◆ LDTrackSeriesContext_HookContext()

LDTrackSeriesContext_HookContext ( LDServerSDKTrackSeriesContext  track_context)

Get the hook context provided by the caller.

This contains application-specific data passed to the track call, such as OpenTelemetry span parents.

Parameters
track_contextTrack context. Must not be NULL.
Returns
Hook context. Valid only during the callback execution. Must not be freed. Do not call LDHookContext_Free() on this.

◆ LDTrackSeriesContext_Key()

LDTrackSeriesContext_Key ( LDServerSDKTrackSeriesContext  track_context)

Get the event key for the track call.

Parameters
track_contextTrack context. Must not be NULL.
Returns
Event key as null-terminated UTF-8 string. Valid only during the callback execution. Must not be freed.

◆ LDTrackSeriesContext_MetricValue()

LDTrackSeriesContext_MetricValue ( LDServerSDKTrackSeriesContext  track_context,
double *  out_metric_value 
)

Get the metric value for the track call, if any.

Parameters
track_contextTrack context. Must not be NULL.
out_metric_valuePointer to receive the metric value. Must not be NULL. Only set if a metric value was provided.
Returns
true if a metric value was provided, false otherwise.