Sends API event data to InfluxDB :param request: (HttpRequest) the request being made
(
resource: Resource,
host: str,
environment: "Environment",
count: int,
labels: Labels,
)
| 84 | |
| 85 | |
| 86 | def 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 | |
| 116 | def track_feature_evaluation_influxdb( |
searching dependent graphs…