Merge pull request #680 from ipfs/fix/tracing-service-name

make tracing service name unique
This commit is contained in:
Hector Sanjuan 2019-02-20 10:26:48 +00:00 committed by GitHub
commit d125f697bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -95,6 +95,8 @@ func propagateTracingConfig(cfgs *cfgs, tracingFlag bool) *cfgs {
tracingValue = cfgs.tracingCfg.EnableTracing
}
// propagate to any other interested configuration
cfgs.tracingCfg.ClusterID = cfgs.clusterCfg.ID.Pretty()
cfgs.tracingCfg.ClusterPeername = cfgs.clusterCfg.Peername
cfgs.tracingCfg.EnableTracing = tracingValue
cfgs.clusterCfg.Tracing = tracingValue
cfgs.consensusCfg.Tracing = tracingValue

View File

@ -8,8 +8,9 @@ import (
"github.com/kelseyhightower/envconfig"
"github.com/ipfs/ipfs-cluster/config"
ma "github.com/multiformats/go-multiaddr"
"github.com/ipfs/ipfs-cluster/config"
)
const metricsConfigKey = "metrics"
@ -151,6 +152,8 @@ type TracingConfig struct {
JaegerAgentEndpoint ma.Multiaddr
SamplingProb float64
ServiceName string
ClusterID string
ClusterPeername string
}
type jsonTracingConfig struct {

View File

@ -142,7 +142,10 @@ func setupTracing(cfg *TracingConfig) (*jaeger.Exporter, error) {
je, err := jaeger.NewExporter(jaeger.Options{
AgentEndpoint: agentAddr,
Process: jaeger.Process{
ServiceName: cfg.ServiceName,
ServiceName: cfg.ServiceName + "-" + cfg.ClusterPeername,
Tags: []jaeger.Tag{
jaeger.StringTag("cluster_id", cfg.ClusterID),
},
},
})
if err != nil {