* feat(integrations): new version of backend integrations * feat(integrations): added ingress rule * feat(integrations): fixed a port number * feat(integrations): enabled ingress in values.yaml * feat(integrations): added startup log * feat(integrations): added extra logger for 3 of 4 backend logs integrations. * feat(integrations): removed a logs loop call * feat(integrations): fixed a table name * feat(integrations): disabled extra logger * feat(integrations): made extra logger as an option * feat(integrations): changed contentType for logs file * feat(integrations): bug fix * feat(integrations): struct/string config support for datadog provider * feat(integrations): map config support for datadog provider * feat(integrations): removed unnecessary transformation * feat(integrations): fixed datadog and sentry response format * feat(integrations): added correct creds parser for sentry provider * feat(integrations): removed unnecessary return statement * feat(integrations): added correct creds parser for elastic search * feat(integrations): changed elastic to elasticsearch * feat(integrations): added correct creds parser for dynatrace * feat(integrations): fixed an issue in query request for elasticsearch provider * feat(integrations): made extra logger configurable by env var * feat(integrations): removed debug logs
66 lines
1.7 KiB
Go
66 lines
1.7 KiB
Go
package heuristics
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"openreplay/backend/pkg/metrics/common"
|
|
"strconv"
|
|
)
|
|
|
|
var heuristicsTotalEvents = prometheus.NewCounterVec(
|
|
prometheus.CounterOpts{
|
|
Namespace: "heuristics",
|
|
Name: "events_total",
|
|
Help: "A counter displaying the number of all processed events",
|
|
},
|
|
[]string{"type"},
|
|
)
|
|
|
|
func IncreaseTotalEvents(eventType string) {
|
|
heuristicsTotalEvents.WithLabelValues(eventType).Inc()
|
|
}
|
|
|
|
var heuristicsRequestSize = prometheus.NewHistogramVec(
|
|
prometheus.HistogramOpts{
|
|
Namespace: "heuristics",
|
|
Name: "request_size_bytes",
|
|
Help: "A histogram displaying the size of each HTTP request in bytes.",
|
|
Buckets: common.DefaultSizeBuckets,
|
|
},
|
|
[]string{"url", "response_code"},
|
|
)
|
|
|
|
func RecordRequestSize(size float64, url string, code int) {
|
|
heuristicsRequestSize.WithLabelValues(url, strconv.Itoa(code)).Observe(size)
|
|
}
|
|
|
|
var heuristicsRequestDuration = prometheus.NewHistogramVec(
|
|
prometheus.HistogramOpts{
|
|
Namespace: "heuristics",
|
|
Name: "request_duration_seconds",
|
|
Help: "A histogram displaying the duration of each HTTP request in seconds.",
|
|
Buckets: common.DefaultDurationBuckets,
|
|
},
|
|
[]string{"url", "response_code"},
|
|
)
|
|
|
|
func RecordRequestDuration(durMillis float64, url string, code int) {
|
|
heuristicsRequestDuration.WithLabelValues(url, strconv.Itoa(code)).Observe(durMillis / 1000.0)
|
|
}
|
|
|
|
var heuristicsTotalRequests = prometheus.NewCounter(
|
|
prometheus.CounterOpts{
|
|
Namespace: "heuristics",
|
|
Name: "requests_total",
|
|
Help: "A counter displaying the number all HTTP requests.",
|
|
},
|
|
)
|
|
|
|
func IncreaseTotalRequests() {
|
|
heuristicsTotalRequests.Inc()
|
|
}
|
|
|
|
func List() []prometheus.Collector {
|
|
return []prometheus.Collector{
|
|
heuristicsTotalEvents,
|
|
}
|
|
}
|