#148 Add stage to influx monitoring.
This commit is contained in:
@ -81,3 +81,5 @@ influxdb:
|
|||||||
organization: PoseidonOrg
|
organization: PoseidonOrg
|
||||||
# The influxdb bucket to store the data in.
|
# The influxdb bucket to store the data in.
|
||||||
bucket: poseidon
|
bucket: poseidon
|
||||||
|
# The stage to be sent with events.
|
||||||
|
# stage: staging
|
||||||
|
Submodule deploy/ansible-deployment updated: 14862204a4...421f591bc1
@ -58,6 +58,7 @@ var (
|
|||||||
Token: "",
|
Token: "",
|
||||||
Organization: "",
|
Organization: "",
|
||||||
Bucket: "",
|
Bucket: "",
|
||||||
|
Stage: "",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
configurationFilePath = "./configuration.yaml"
|
configurationFilePath = "./configuration.yaml"
|
||||||
@ -127,6 +128,7 @@ type InfluxDB struct {
|
|||||||
Token string
|
Token string
|
||||||
Organization string
|
Organization string
|
||||||
Bucket string
|
Bucket string
|
||||||
|
Stage string
|
||||||
}
|
}
|
||||||
|
|
||||||
// configuration contains the complete configuration of Poseidon.
|
// configuration contains the complete configuration of Poseidon.
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
|
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
|
||||||
influxdb2API "github.com/influxdata/influxdb-client-go/v2/api"
|
influxdb2API "github.com/influxdata/influxdb-client-go/v2/api"
|
||||||
"github.com/influxdata/influxdb-client-go/v2/api/write"
|
"github.com/influxdata/influxdb-client-go/v2/api/write"
|
||||||
|
"github.com/openHPI/poseidon/internal/config"
|
||||||
"github.com/openHPI/poseidon/internal/environment"
|
"github.com/openHPI/poseidon/internal/environment"
|
||||||
"github.com/openHPI/poseidon/internal/runner"
|
"github.com/openHPI/poseidon/internal/runner"
|
||||||
"github.com/openHPI/poseidon/pkg/dto"
|
"github.com/openHPI/poseidon/pkg/dto"
|
||||||
@ -41,6 +42,7 @@ func InfluxDB2Middleware(influxClient influxdb2API.WriteAPI, manager environment
|
|||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
route := mux.CurrentRoute(r).GetName()
|
route := mux.CurrentRoute(r).GetName()
|
||||||
p := influxdb2.NewPointWithMeasurement(influxdbMeasurementPrefix + route)
|
p := influxdb2.NewPointWithMeasurement(influxdbMeasurementPrefix + route)
|
||||||
|
p.AddTag("stage", config.Config.InfluxDB.Stage)
|
||||||
|
|
||||||
start := time.Now().UTC()
|
start := time.Now().UTC()
|
||||||
p.SetTime(time.Now())
|
p.SetTime(time.Now())
|
||||||
|
Reference in New Issue
Block a user