add jaeger support for productcatalog and shipping. (#126)

This commit is contained in:
rghetia 2019-01-22 09:56:39 -08:00 committed by Ahmet Alp Balkan
parent 10dfd04ab1
commit 54f0a8d058
7 changed files with 299 additions and 78 deletions

View file

@ -181,15 +181,7 @@ func initStats(log logrus.FieldLogger, exporter *stackdriver.Exporter) {
}
}
func initTracing(log logrus.FieldLogger) {
// This is a demo app with low QPS. trace.AlwaysSample() is used here
// to make sure traces are available for observation and analysis.
// In a production environment or high QPS setup please use
// trace.ProbabilitySampler set at the desired probability.
trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()})
initJaegerTracing(log)
func initStackDriverTracing(log logrus.FieldLogger) {
// TODO(ahmetb) this method is duplicated in other microservices using Go
// since they are not sharing packages.
for i := 1; i <= 3; i++ {
@ -215,6 +207,18 @@ func initTracing(log logrus.FieldLogger) {
log.Warn("could not initialize stackdriver exporter after retrying, giving up")
}
func initTracing(log logrus.FieldLogger) {
// This is a demo app with low QPS. trace.AlwaysSample() is used here
// to make sure traces are available for observation and analysis.
// In a production environment or high QPS setup please use
// trace.ProbabilitySampler set at the desired probability.
trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()})
initJaegerTracing(log)
initStackDriverTracing(log)
}
func initProfiling(log logrus.FieldLogger, service, version string) {
// TODO(ahmetb) this method is duplicated in other microservices using Go
// since they are not sharing packages.