#110 Add periodical monitoring events.

This commit is contained in:
Maximilian Paß
2022-08-17 12:45:31 +02:00
parent c3460317a4
commit 5590c50e14
9 changed files with 74 additions and 26 deletions

View File

@ -4,6 +4,7 @@ import (
"encoding/json"
"github.com/influxdata/influxdb-client-go/v2/api/write"
"github.com/openHPI/poseidon/pkg/dto"
"github.com/openHPI/poseidon/pkg/storage"
"strconv"
)
@ -51,8 +52,8 @@ type ExecutionEnvironment interface {
}
// monitorEnvironmentData passes the configuration of the environment e into the monitoring Point p.
func monitorEnvironmentData(p *write.Point, e ExecutionEnvironment, isDeletion bool) {
if !isDeletion && e != nil {
func monitorEnvironmentData(p *write.Point, e ExecutionEnvironment, eventType storage.EventType) {
if eventType == storage.Creation && e != nil {
p.AddTag("image", e.Image())
p.AddTag("cpu_limit", strconv.Itoa(int(e.CPULimit())))
p.AddTag("memory_limit", strconv.Itoa(int(e.MemoryLimit())))