mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-10-22 06:38:13 +00:00
Make sure that pod name is included in metrics.
This commit is contained in:
@@ -2,16 +2,22 @@ package libpack_monitoring
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
libpack_config "github.com/lukaszraczylo/graphql-monitoring-proxy/config"
|
libpack_config "github.com/lukaszraczylo/graphql-monitoring-proxy/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (ms *MetricsSetup) get_metrics_name(name string, labels map[string]string) (complete_name string) {
|
func (ms *MetricsSetup) get_metrics_name(name string, labels map[string]string) (complete_name string) {
|
||||||
|
var err error
|
||||||
if labels == nil {
|
if labels == nil {
|
||||||
labels = make(map[string]string)
|
labels = make(map[string]string)
|
||||||
}
|
}
|
||||||
labels["microservice"] = libpack_config.PKG_NAME
|
labels["microservice"] = libpack_config.PKG_NAME
|
||||||
|
labels["pod"], err = os.Hostname()
|
||||||
|
if err != nil {
|
||||||
|
labels["pod"] = "unknown"
|
||||||
|
}
|
||||||
|
|
||||||
if ms.metrics_prefix != "" {
|
if ms.metrics_prefix != "" {
|
||||||
complete_name = ms.metrics_prefix + "_" + name
|
complete_name = ms.metrics_prefix + "_" + name
|
||||||
|
|||||||
Reference in New Issue
Block a user