houston에 constlabel 설정 가능
This commit is contained in:
@ -32,10 +32,11 @@ import (
|
||||
)
|
||||
|
||||
type clientConfig struct {
|
||||
GrpcAddress string `json:"grpc_server_address"`
|
||||
HttpAddress string `json:"http_server_address"`
|
||||
StorageRoot string `json:"storage_path"`
|
||||
MetricNamespace string `json:"metric_namespace"`
|
||||
GrpcAddress string `json:"grpc_server_address"`
|
||||
HttpAddress string `json:"http_server_address"`
|
||||
StorageRoot string `json:"storage_path"`
|
||||
MetricNamespace string `json:"metric_namespace"`
|
||||
ConstLabels map[string]string `json:"metric_const_labels"`
|
||||
}
|
||||
|
||||
func loadClientConfig() (clientConfig, error) {
|
||||
@ -157,7 +158,7 @@ func gatherDeployedPrograms(storageRoot, name string) (out []*protos.VersionAndA
|
||||
sort.Slice(rawvers, func(i, j int) bool {
|
||||
return rawvers[i].modTime.After(rawvers[j].modTime)
|
||||
})
|
||||
|
||||
|
||||
for _, v := range rawvers {
|
||||
out = append(out, v.VersionAndArgs)
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ func (hc *houstonClient) launch(meta *procmeta) error {
|
||||
return err
|
||||
}
|
||||
|
||||
stdReader := func(childProcName string, r io.ReadCloser, index int) {
|
||||
stdReader := func(jobName string, r io.ReadCloser, index int) {
|
||||
defer func() {
|
||||
reco := recover()
|
||||
if reco != nil {
|
||||
@ -308,7 +308,12 @@ func (hc *houstonClient) launch(meta *procmeta) error {
|
||||
if desc.ConstLabels == nil {
|
||||
desc.ConstLabels = make(map[string]string)
|
||||
}
|
||||
desc.ConstLabels["index"] = fmt.Sprintf("%d", index)
|
||||
|
||||
for k, v := range hc.config.ConstLabels {
|
||||
desc.ConstLabels[k] = v
|
||||
}
|
||||
|
||||
desc.ConstLabels["job"] = jobName
|
||||
|
||||
metricExporter.RegisterMetric(&desc)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user