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

Function track_request_influxdb

api/app_analytics/track.py:86–113  ·  view source on GitHub ↗

Sends API event data to InfluxDB :param request: (HttpRequest) the request being made

(
    resource: Resource,
    host: str,
    environment: "Environment",
    count: int,
    labels: Labels,
)

Source from the content-addressed store, hash-verified

84
85
86def track_request_influxdb(
87 resource: Resource,
88 host: str,
89 environment: "Environment",
90 count: int,
91 labels: Labels,
92) -> None:
93 """
94 Sends API event data to InfluxDB
95
96 :param request: (HttpRequest) the request being made
97 """
98 if resource.is_tracked:
99 tags: dict[str, str | int | float] = {
100 "resource": resource.resource_name,
101 "organisation": environment.project.organisation.get_unique_slug(),
102 "organisation_id": environment.project.organisation_id,
103 "project": environment.project.name,
104 "project_id": environment.project_id,
105 "environment": environment.name,
106 "environment_id": environment.id,
107 "host": host,
108 **map_labels_to_influx_record_values(labels),
109 }
110
111 influxdb = InfluxDBWrapper("api_call") # type: ignore[no-untyped-call]
112 influxdb.add_data_point("request_count", count, tags=tags)
113 influxdb.write()
114
115
116def track_feature_evaluation_influxdb(

Calls 5

add_data_pointMethod · 0.95
writeMethod · 0.95
InfluxDBWrapperClass · 0.90
get_unique_slugMethod · 0.80

Used in the wild real call sites across dependent graphs

searching dependent graphs…