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 {
|
||||
|
||||
2
go.mod
2
go.mod
@ -11,7 +11,7 @@ require (
|
||||
golang.org/x/text v0.10.0
|
||||
google.golang.org/grpc v1.56.0
|
||||
google.golang.org/protobuf v1.31.0
|
||||
repositories.action2quare.com/ayo/gocommon v0.0.0-20240213060646-bef684b3fe34
|
||||
repositories.action2quare.com/ayo/gocommon v0.0.0-20240215030631-0c5ddac9f55f
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
4
go.sum
4
go.sum
@ -173,5 +173,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM=
|
||||
howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g=
|
||||
repositories.action2quare.com/ayo/gocommon v0.0.0-20240213060646-bef684b3fe34 h1:BmcAbve3Ep6FPrdo3XXaIsQlBGt8kAMepmZqrCKkrGw=
|
||||
repositories.action2quare.com/ayo/gocommon v0.0.0-20240213060646-bef684b3fe34/go.mod h1:Gb418rT96M3K7L/XMPzp8IJj4UXVunq7dZzrxsMBz/8=
|
||||
repositories.action2quare.com/ayo/gocommon v0.0.0-20240215030631-0c5ddac9f55f h1:ZIDd5JCXlPCVj2656Bqm/yiI0cZzgIa51IOs5AljEAA=
|
||||
repositories.action2quare.com/ayo/gocommon v0.0.0-20240215030631-0c5ddac9f55f/go.mod h1:Gb418rT96M3K7L/XMPzp8IJj4UXVunq7dZzrxsMBz/8=
|
||||
|
||||
Reference in New Issue
Block a user