MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / track_feature_evaluation_influxdb

Function track_feature_evaluation_influxdb

api/app_analytics/track.py:116–140  ·  view source on GitHub ↗

Sends Feature analytics event data to InfluxDB :param environment_id: (int) the id of the environment the feature is being evaluated within :param feature_evaluations: (dict) A collection of key id / evaluation counts

(
    environment_id: int,
    feature_evaluations: list[TrackFeatureEvaluationsByEnvironmentData],
)

Source from the content-addressed store, hash-verified

114
115
116def track_feature_evaluation_influxdb(
117 environment_id: int,
118 feature_evaluations: list[TrackFeatureEvaluationsByEnvironmentData],
119) -> None:
120 """
121 Sends Feature analytics event data to InfluxDB
122
123 :param environment_id: (int) the id of the environment the feature is being evaluated within
124 :param feature_evaluations: (dict) A collection of key id / evaluation counts
125 """
126 influxdb = InfluxDBWrapper("feature_evaluation") # type: ignore[no-untyped-call]
127
128 for feature_evaluation in feature_evaluations:
129 tags: dict[str | Label, str | int] = {
130 "feature_id": feature_evaluation["feature_name"],
131 "environment_id": environment_id,
132 **map_labels_to_influx_record_values(feature_evaluation["labels"]),
133 }
134 influxdb.add_data_point(
135 "request_count",
136 feature_evaluation["evaluation_count"],
137 tags=tags,
138 )
139
140 influxdb.write()
141
142
143def track_feature_evaluation_influxdb_v2(

Calls 4

add_data_pointMethod · 0.95
writeMethod · 0.95
InfluxDBWrapperClass · 0.90

Used in the wild real call sites across dependent graphs

searching dependent graphs…