Add the Environment ID to the influxdb data.

Also move the interface of an execution environment into its own file, execution_environment.go.
This commit is contained in:
Maximilian Paß
2022-04-10 23:02:33 +02:00
parent b7a20e3114
commit eabe3a1b27
7 changed files with 85 additions and 57 deletions

View File

@ -50,12 +50,30 @@ func AddEnvironmentID(r *http.Request, id dto.EnvironmentID) {
p.AddTag("environment_id", strconv.Itoa(int(id)))
}
// AddEnvironmentType adds the type of the used environment to the influxdb data point.
func AddEnvironmentType(r *http.Request, t string) {
p := pointFromContext(r.Context())
p.AddTag("environment_type", t)
}
// AddRunnerID adds the runner id to the influx data point for the current request.
func AddRunnerID(r *http.Request, id string) {
p := pointFromContext(r.Context())
p.AddTag("runner_id", id)
}
// AddIdleRunner adds the count of idle runners of the used environment to the influxdb data point.
func AddIdleRunner(r *http.Request, count int) {
p := pointFromContext(r.Context())
p.AddField("idle_runner", strconv.Itoa(count))
}
// AddPrewarmingPoolSize adds the prewarming pool size of the used environment to the influxdb data point.
func AddPrewarmingPoolSize(r *http.Request, count uint) {
p := pointFromContext(r.Context())
p.AddField("prewarming_pool_size", strconv.Itoa(int(count)))
}
// AddRequestSize adds the size of the request body to the influx data point for the current request.
func AddRequestSize(r *http.Request) {
body, err := io.ReadAll(r.Body)