add jaeger support for productcatalog and shipping. (#126)
This commit is contained in:
parent
10dfd04ab1
commit
54f0a8d058
7 changed files with 299 additions and 78 deletions
|
@ -34,6 +34,9 @@ spec:
|
|||
livenessProbe:
|
||||
exec:
|
||||
command: ["/bin/grpc_health_probe", "-addr=:3550"]
|
||||
# env:
|
||||
# - name: JAEGER_SERVICE_ADDR
|
||||
# value: "jaeger-collector:14268"
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
|
|
|
@ -34,6 +34,9 @@ spec:
|
|||
livenessProbe:
|
||||
exec:
|
||||
command: ["/bin/grpc_health_probe", "-addr=:50051"]
|
||||
# env:
|
||||
# - name: JAEGER_SERVICE_ADDR
|
||||
# value: "jaeger-collector:14268"
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
|
|
|
@ -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.
|
||||
|
|
148
src/productcatalogservice/Gopkg.lock
generated
148
src/productcatalogservice/Gopkg.lock
generated
|
@ -2,27 +2,46 @@
|
|||
|
||||
|
||||
[[projects]]
|
||||
digest = "1:467af0aad47996b25b838d6f14c8371123a8a76ec239020a6c5894e1f8f60272"
|
||||
name = "cloud.google.com/go"
|
||||
packages = [
|
||||
"compute/metadata",
|
||||
"internal/version",
|
||||
"monitoring/apiv3",
|
||||
"profiler",
|
||||
"trace/apiv2"
|
||||
"trace/apiv2",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "c728a003b238b26cef9ab6753a5dc424b331c3ad"
|
||||
version = "v0.27.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:4b96dcd8534bc6450a922bd16a76360ba3381f0d1daf40abbaec91c053fbfeb5"
|
||||
name = "contrib.go.opencensus.io/exporter/stackdriver"
|
||||
packages = [
|
||||
".",
|
||||
"propagation"
|
||||
]
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "37aa2801fbf0205003e15636096ebf0373510288"
|
||||
version = "v0.5.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:d3a57cdbaefaceca4ebe6258ed86a992bdcfc93a8442dbda5343e2d43a8f8a6a"
|
||||
name = "git.apache.org/thrift.git"
|
||||
packages = ["lib/go/thrift"]
|
||||
pruneopts = "UT"
|
||||
revision = "67df34afa782be67154034b31e4ad7cb3834fed1"
|
||||
source = "github.com/apache/thrift"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:14e66208d324c0ecb49934b5ac311c50a94e3a458e92b0026ef9e26919ac8d9d"
|
||||
name = "github.com/GoogleCloudPlatform/microservices-demo"
|
||||
packages = ["src/productcatalogservice/genproto"]
|
||||
pruneopts = "UT"
|
||||
revision = "10dfd04ab174cc680ed6ffef26cc4fb09ec40404"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:4fbf68bee2a60f6af6414572936edb295f6f26b73c6fb25ab0e7b03b013854f5"
|
||||
name = "github.com/golang/protobuf"
|
||||
packages = [
|
||||
"jsonpb",
|
||||
|
@ -34,46 +53,67 @@
|
|||
"ptypes/empty",
|
||||
"ptypes/struct",
|
||||
"ptypes/timestamp",
|
||||
"ptypes/wrappers"
|
||||
"ptypes/wrappers",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:2e3c336fc7fde5c984d2841455a658a6d626450b1754a854b3b32e7a8f49a07a"
|
||||
name = "github.com/google/go-cmp"
|
||||
packages = [
|
||||
"cmp",
|
||||
"cmp/internal/diff",
|
||||
"cmp/internal/function",
|
||||
"cmp/internal/value"
|
||||
"cmp/internal/value",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "3af367b6b30c263d47e8895973edcca9a49cf029"
|
||||
version = "v0.2.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:fc55304e290027108ae0cac675a171bcd854f9c657678c20ceea837718ea6819"
|
||||
name = "github.com/google/pprof"
|
||||
packages = ["profile"]
|
||||
revision = "e027b505a088ac3c68c339a1d7ce7724bf34538b"
|
||||
pruneopts = "UT"
|
||||
revision = "e84dfd68c163c45ea47aa24b3dc7eaa93f6675b1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:cd9864c6366515827a759931746738ede6079faa08df9c584596370d6add135c"
|
||||
name = "github.com/googleapis/gax-go"
|
||||
packages = ["."]
|
||||
revision = "317e0006254c44a0ac427cc52a0e083ff0b9622f"
|
||||
version = "v2.0.0"
|
||||
packages = [
|
||||
".",
|
||||
"v2",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "c8a15bac9b9fe955bd9f900272f9a306465d28cf"
|
||||
version = "v2.0.3"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:d867dfa6751c8d7a435821ad3b736310c2ed68945d05b50fb9d23aee0540c8cc"
|
||||
digest = "1:0a69a1c0db3591fcefb47f115b224592c8dfa4368b7ba9fae509d5e16cdc95c8"
|
||||
name = "github.com/konsorten/go-windows-terminal-sequences"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "5c8c8bd35d3832f5d134ae1e1e375b69a4d25242"
|
||||
version = "v1.0.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:87c2e02fb01c27060ccc5ba7c5a407cc91147726f8f40b70cceeedbc52b1f3a8"
|
||||
name = "github.com/sirupsen/logrus"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "3e01752db0189b9157070a0e1668a620f9a85da2"
|
||||
version = "v1.0.6"
|
||||
revision = "e1e72e9de974bd926e5c56f83753fba2df402ce5"
|
||||
version = "v1.3.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a5154dfd6b37bef5a3eab759e13296348e639dc8c7604f538368167782b08ccd"
|
||||
name = "go.opencensus.io"
|
||||
packages = [
|
||||
".",
|
||||
"exporter/jaeger",
|
||||
"exporter/jaeger/internal/gen-go/jaeger",
|
||||
"internal",
|
||||
"internal/tagencoding",
|
||||
"plugin/ocgrpc",
|
||||
|
@ -86,21 +126,23 @@
|
|||
"trace",
|
||||
"trace/internal",
|
||||
"trace/propagation",
|
||||
"trace/tracestate"
|
||||
"trace/tracestate",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "b11f239c032624b045c4c2bfd3d1287b4012ce89"
|
||||
version = "v0.16.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:3f3a05ae0b95893d90b9b3b5afdb79a9b3d96e4e36e099d841ae602e4aca0da8"
|
||||
digest = "1:38f553aff0273ad6f367cb0a0f8b6eecbaef8dc6cb8b50e57b6a81c1d5b1e332"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = ["ssh/terminal"]
|
||||
pruneopts = "UT"
|
||||
revision = "0e37d006457bf46f9e6692014ba72ef82c33022c"
|
||||
revision = "ff983b9c42bc9fbf91556e191cc8efb585c16908"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:9d2f08c64693fbe7177b5980f80c35672c80f12be79bb3bc86948b934d70e4ee"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"context",
|
||||
|
@ -110,35 +152,46 @@
|
|||
"http2/hpack",
|
||||
"idna",
|
||||
"internal/timeseries",
|
||||
"trace"
|
||||
"trace",
|
||||
]
|
||||
revision = "26e67e76b6c3f6ce91f7c52def5af501b4e0f3a2"
|
||||
pruneopts = "UT"
|
||||
revision = "ed066c81e75eba56dd9bd2139ade88125b855585"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:511a6232760c10dcb1ebf1ab83ef0291e2baf801f203ca6314759c5458b73a6a"
|
||||
name = "golang.org/x/oauth2"
|
||||
packages = [
|
||||
".",
|
||||
"google",
|
||||
"internal",
|
||||
"jws",
|
||||
"jwt"
|
||||
"jwt",
|
||||
]
|
||||
revision = "d2e6202438beef2727060aa7cabdd924d92ebfd9"
|
||||
pruneopts = "UT"
|
||||
revision = "5dab4167f31cbd76b407f1486c86b40748bc5073"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:75515eedc0dc2cb0b40372008b616fa2841d831c63eedd403285ff286c593295"
|
||||
name = "golang.org/x/sync"
|
||||
packages = ["semaphore"]
|
||||
revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
|
||||
pruneopts = "UT"
|
||||
revision = "37e7f081c4d4c64e13b10787722085407fe5d15f"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:43cde116ff48f299eddb7e6515677e6d0a2c915854bb05a333877f07c3bb3033"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix"]
|
||||
revision = "1561086e645b2809fb9f8a1e2a38160bf8d53bf4"
|
||||
packages = [
|
||||
"unix",
|
||||
"windows",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "11f53e03133963fb11ae0588e08b5e0b85be8be5"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18"
|
||||
name = "golang.org/x/text"
|
||||
packages = [
|
||||
"collate",
|
||||
|
@ -154,13 +207,15 @@
|
|||
"unicode/bidi",
|
||||
"unicode/cldr",
|
||||
"unicode/norm",
|
||||
"unicode/rangetable"
|
||||
"unicode/rangetable",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:26a71f62c83707b9952821c2a895bd041588501fa370cc267221817fcc721253"
|
||||
name = "google.golang.org/api"
|
||||
packages = [
|
||||
"googleapi/transport",
|
||||
|
@ -170,11 +225,14 @@
|
|||
"support/bundler",
|
||||
"transport",
|
||||
"transport/grpc",
|
||||
"transport/http"
|
||||
"transport/http",
|
||||
"transport/http/internal/propagation",
|
||||
]
|
||||
revision = "19ff8768a5c0b8e46ea281065664787eefc24121"
|
||||
pruneopts = "UT"
|
||||
revision = "43037ff31f6958582e5d3c19d9ac1a4d2819669c"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:c4eaa5f79d36f76ef4bd0c4f96e36bc1b7b5a359528d1267f0cb7a5d58b7b5bb"
|
||||
name = "google.golang.org/appengine"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -188,13 +246,15 @@
|
|||
"internal/socket",
|
||||
"internal/urlfetch",
|
||||
"socket",
|
||||
"urlfetch"
|
||||
"urlfetch",
|
||||
]
|
||||
revision = "ae0ab99deb4dc413a2b4bd6c8bdd0eb67f1e4d06"
|
||||
version = "v1.2.0"
|
||||
pruneopts = "UT"
|
||||
revision = "e9657d882bb81064595ca3b56cbe2546bbabf7b1"
|
||||
version = "v1.4.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:3552e7267a98c605e6cbfe6b03c34589265ab72e6078b95fb2e10e0cb44f5cc8"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = [
|
||||
"googleapis/api/annotations",
|
||||
|
@ -207,11 +267,13 @@
|
|||
"googleapis/monitoring/v3",
|
||||
"googleapis/rpc/errdetails",
|
||||
"googleapis/rpc/status",
|
||||
"protobuf/field_mask"
|
||||
"protobuf/field_mask",
|
||||
]
|
||||
revision = "c3f76f3b92d1ffa4c58a9ff842a58b8877655e0f"
|
||||
pruneopts = "UT"
|
||||
revision = "db91494dd46c1fdcbbde05e5ff5eb56df8f7d79a"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:6497ab07ec89179db8d5a563d33635be04ceffaa29007a3ae74b9f15f4d3068e"
|
||||
name = "google.golang.org/grpc"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -241,14 +303,32 @@
|
|||
"resolver/passthrough",
|
||||
"stats",
|
||||
"status",
|
||||
"tap"
|
||||
"tap",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "32fb0ac620c32ba40a4626ddf94d90d12cce3455"
|
||||
version = "v1.14.0"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "b68fd9438c2eb711d9fc51c1f23c5ca0d5169bf4022351dfc400cd35ba39dfaa"
|
||||
input-imports = [
|
||||
"cloud.google.com/go/profiler",
|
||||
"contrib.go.opencensus.io/exporter/stackdriver",
|
||||
"github.com/GoogleCloudPlatform/microservices-demo/src/productcatalogservice/genproto",
|
||||
"github.com/golang/protobuf/jsonpb",
|
||||
"github.com/golang/protobuf/proto",
|
||||
"github.com/google/go-cmp/cmp",
|
||||
"github.com/sirupsen/logrus",
|
||||
"go.opencensus.io/exporter/jaeger",
|
||||
"go.opencensus.io/plugin/ocgrpc",
|
||||
"go.opencensus.io/stats/view",
|
||||
"go.opencensus.io/trace",
|
||||
"golang.org/x/net/context",
|
||||
"google.golang.org/grpc",
|
||||
"google.golang.org/grpc/codes",
|
||||
"google.golang.org/grpc/health/grpc_health_v1",
|
||||
"google.golang.org/grpc/status",
|
||||
]
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -35,6 +35,7 @@ import (
|
|||
"contrib.go.opencensus.io/exporter/stackdriver"
|
||||
"github.com/golang/protobuf/jsonpb"
|
||||
"github.com/sirupsen/logrus"
|
||||
"go.opencensus.io/exporter/jaeger"
|
||||
"go.opencensus.io/plugin/ocgrpc"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.opencensus.io/trace"
|
||||
|
@ -110,6 +111,28 @@ func run(port int) string {
|
|||
return l.Addr().String()
|
||||
}
|
||||
|
||||
func initJaegerTracing() {
|
||||
svcAddr := os.Getenv("JAEGER_SERVICE_ADDR")
|
||||
if svcAddr == "" {
|
||||
log.Info("jaeger initialization disabled.")
|
||||
return
|
||||
}
|
||||
|
||||
// Register the Jaeger exporter to be able to retrieve
|
||||
// the collected spans.
|
||||
exporter, err := jaeger.NewExporter(jaeger.Options{
|
||||
Endpoint: fmt.Sprintf("http://%s", svcAddr),
|
||||
Process: jaeger.Process{
|
||||
ServiceName: "productcatalogservice",
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
trace.RegisterExporter(exporter)
|
||||
log.Info("jaeger initialization completed.")
|
||||
}
|
||||
|
||||
func initStats(exporter *stackdriver.Exporter) {
|
||||
view.SetReportingPeriod(60 * time.Second)
|
||||
view.RegisterExporter(exporter)
|
||||
|
@ -120,7 +143,7 @@ func initStats(exporter *stackdriver.Exporter) {
|
|||
}
|
||||
}
|
||||
|
||||
func initTracing() {
|
||||
func initStackDriverTracing() {
|
||||
// TODO(ahmetb) this method is duplicated in other microservices using Go
|
||||
// since they are not sharing packages.
|
||||
for i := 1; i <= 3; i++ {
|
||||
|
@ -143,6 +166,11 @@ func initTracing() {
|
|||
log.Warn("could not initialize stackdriver exporter after retrying, giving up")
|
||||
}
|
||||
|
||||
func initTracing() {
|
||||
initJaegerTracing()
|
||||
initStackDriverTracing()
|
||||
}
|
||||
|
||||
func initProfiling(service, version string) {
|
||||
// TODO(ahmetb) this method is duplicated in other microservices using Go
|
||||
// since they are not sharing packages.
|
||||
|
|
141
src/shippingservice/Gopkg.lock
generated
141
src/shippingservice/Gopkg.lock
generated
|
@ -2,27 +2,46 @@
|
|||
|
||||
|
||||
[[projects]]
|
||||
digest = "1:467af0aad47996b25b838d6f14c8371123a8a76ec239020a6c5894e1f8f60272"
|
||||
name = "cloud.google.com/go"
|
||||
packages = [
|
||||
"compute/metadata",
|
||||
"internal/version",
|
||||
"monitoring/apiv3",
|
||||
"profiler",
|
||||
"trace/apiv2"
|
||||
"trace/apiv2",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "c728a003b238b26cef9ab6753a5dc424b331c3ad"
|
||||
version = "v0.27.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:4b96dcd8534bc6450a922bd16a76360ba3381f0d1daf40abbaec91c053fbfeb5"
|
||||
name = "contrib.go.opencensus.io/exporter/stackdriver"
|
||||
packages = [
|
||||
".",
|
||||
"propagation"
|
||||
]
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "37aa2801fbf0205003e15636096ebf0373510288"
|
||||
version = "v0.5.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:d3a57cdbaefaceca4ebe6258ed86a992bdcfc93a8442dbda5343e2d43a8f8a6a"
|
||||
name = "git.apache.org/thrift.git"
|
||||
packages = ["lib/go/thrift"]
|
||||
pruneopts = "UT"
|
||||
revision = "67df34afa782be67154034b31e4ad7cb3834fed1"
|
||||
source = "github.com/apache/thrift"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:27490301253ac5063d502480ef3794b95222eea6cb997ae6e689a058b1cd5253"
|
||||
name = "github.com/GoogleCloudPlatform/microservices-demo"
|
||||
packages = ["src/shippingservice/genproto"]
|
||||
pruneopts = "UT"
|
||||
revision = "10dfd04ab174cc680ed6ffef26cc4fb09ec40404"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:72856926f8208767b837bf51e3373f49139f61889b67dc7fd3c2a0fd711e3f7a"
|
||||
name = "github.com/golang/protobuf"
|
||||
packages = [
|
||||
"proto",
|
||||
|
@ -33,35 +52,54 @@
|
|||
"ptypes/empty",
|
||||
"ptypes/struct",
|
||||
"ptypes/timestamp",
|
||||
"ptypes/wrappers"
|
||||
"ptypes/wrappers",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:fc55304e290027108ae0cac675a171bcd854f9c657678c20ceea837718ea6819"
|
||||
name = "github.com/google/pprof"
|
||||
packages = ["profile"]
|
||||
revision = "e027b505a088ac3c68c339a1d7ce7724bf34538b"
|
||||
pruneopts = "UT"
|
||||
revision = "e84dfd68c163c45ea47aa24b3dc7eaa93f6675b1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:cd9864c6366515827a759931746738ede6079faa08df9c584596370d6add135c"
|
||||
name = "github.com/googleapis/gax-go"
|
||||
packages = ["."]
|
||||
revision = "317e0006254c44a0ac427cc52a0e083ff0b9622f"
|
||||
version = "v2.0.0"
|
||||
packages = [
|
||||
".",
|
||||
"v2",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "c8a15bac9b9fe955bd9f900272f9a306465d28cf"
|
||||
version = "v2.0.3"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:d867dfa6751c8d7a435821ad3b736310c2ed68945d05b50fb9d23aee0540c8cc"
|
||||
digest = "1:0a69a1c0db3591fcefb47f115b224592c8dfa4368b7ba9fae509d5e16cdc95c8"
|
||||
name = "github.com/konsorten/go-windows-terminal-sequences"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "5c8c8bd35d3832f5d134ae1e1e375b69a4d25242"
|
||||
version = "v1.0.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:87c2e02fb01c27060ccc5ba7c5a407cc91147726f8f40b70cceeedbc52b1f3a8"
|
||||
name = "github.com/sirupsen/logrus"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "3e01752db0189b9157070a0e1668a620f9a85da2"
|
||||
version = "v1.0.6"
|
||||
revision = "e1e72e9de974bd926e5c56f83753fba2df402ce5"
|
||||
version = "v1.3.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a5154dfd6b37bef5a3eab759e13296348e639dc8c7604f538368167782b08ccd"
|
||||
name = "go.opencensus.io"
|
||||
packages = [
|
||||
".",
|
||||
"exporter/jaeger",
|
||||
"exporter/jaeger/internal/gen-go/jaeger",
|
||||
"internal",
|
||||
"internal/tagencoding",
|
||||
"plugin/ocgrpc",
|
||||
|
@ -74,21 +112,23 @@
|
|||
"trace",
|
||||
"trace/internal",
|
||||
"trace/propagation",
|
||||
"trace/tracestate"
|
||||
"trace/tracestate",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "b11f239c032624b045c4c2bfd3d1287b4012ce89"
|
||||
version = "v0.16.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:3f3a05ae0b95893d90b9b3b5afdb79a9b3d96e4e36e099d841ae602e4aca0da8"
|
||||
digest = "1:38f553aff0273ad6f367cb0a0f8b6eecbaef8dc6cb8b50e57b6a81c1d5b1e332"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = ["ssh/terminal"]
|
||||
pruneopts = "UT"
|
||||
revision = "0e37d006457bf46f9e6692014ba72ef82c33022c"
|
||||
revision = "ff983b9c42bc9fbf91556e191cc8efb585c16908"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:9d2f08c64693fbe7177b5980f80c35672c80f12be79bb3bc86948b934d70e4ee"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"context",
|
||||
|
@ -98,35 +138,46 @@
|
|||
"http2/hpack",
|
||||
"idna",
|
||||
"internal/timeseries",
|
||||
"trace"
|
||||
"trace",
|
||||
]
|
||||
revision = "26e67e76b6c3f6ce91f7c52def5af501b4e0f3a2"
|
||||
pruneopts = "UT"
|
||||
revision = "ed066c81e75eba56dd9bd2139ade88125b855585"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:511a6232760c10dcb1ebf1ab83ef0291e2baf801f203ca6314759c5458b73a6a"
|
||||
name = "golang.org/x/oauth2"
|
||||
packages = [
|
||||
".",
|
||||
"google",
|
||||
"internal",
|
||||
"jws",
|
||||
"jwt"
|
||||
"jwt",
|
||||
]
|
||||
revision = "d2e6202438beef2727060aa7cabdd924d92ebfd9"
|
||||
pruneopts = "UT"
|
||||
revision = "5dab4167f31cbd76b407f1486c86b40748bc5073"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:75515eedc0dc2cb0b40372008b616fa2841d831c63eedd403285ff286c593295"
|
||||
name = "golang.org/x/sync"
|
||||
packages = ["semaphore"]
|
||||
revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
|
||||
pruneopts = "UT"
|
||||
revision = "37e7f081c4d4c64e13b10787722085407fe5d15f"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:43cde116ff48f299eddb7e6515677e6d0a2c915854bb05a333877f07c3bb3033"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix"]
|
||||
revision = "1561086e645b2809fb9f8a1e2a38160bf8d53bf4"
|
||||
packages = [
|
||||
"unix",
|
||||
"windows",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "11f53e03133963fb11ae0588e08b5e0b85be8be5"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18"
|
||||
name = "golang.org/x/text"
|
||||
packages = [
|
||||
"collate",
|
||||
|
@ -142,13 +193,15 @@
|
|||
"unicode/bidi",
|
||||
"unicode/cldr",
|
||||
"unicode/norm",
|
||||
"unicode/rangetable"
|
||||
"unicode/rangetable",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:26a71f62c83707b9952821c2a895bd041588501fa370cc267221817fcc721253"
|
||||
name = "google.golang.org/api"
|
||||
packages = [
|
||||
"googleapi/transport",
|
||||
|
@ -158,11 +211,14 @@
|
|||
"support/bundler",
|
||||
"transport",
|
||||
"transport/grpc",
|
||||
"transport/http"
|
||||
"transport/http",
|
||||
"transport/http/internal/propagation",
|
||||
]
|
||||
revision = "19ff8768a5c0b8e46ea281065664787eefc24121"
|
||||
pruneopts = "UT"
|
||||
revision = "43037ff31f6958582e5d3c19d9ac1a4d2819669c"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:c4eaa5f79d36f76ef4bd0c4f96e36bc1b7b5a359528d1267f0cb7a5d58b7b5bb"
|
||||
name = "google.golang.org/appengine"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -176,13 +232,15 @@
|
|||
"internal/socket",
|
||||
"internal/urlfetch",
|
||||
"socket",
|
||||
"urlfetch"
|
||||
"urlfetch",
|
||||
]
|
||||
revision = "ae0ab99deb4dc413a2b4bd6c8bdd0eb67f1e4d06"
|
||||
version = "v1.2.0"
|
||||
pruneopts = "UT"
|
||||
revision = "e9657d882bb81064595ca3b56cbe2546bbabf7b1"
|
||||
version = "v1.4.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:3552e7267a98c605e6cbfe6b03c34589265ab72e6078b95fb2e10e0cb44f5cc8"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = [
|
||||
"googleapis/api/annotations",
|
||||
|
@ -195,11 +253,13 @@
|
|||
"googleapis/monitoring/v3",
|
||||
"googleapis/rpc/errdetails",
|
||||
"googleapis/rpc/status",
|
||||
"protobuf/field_mask"
|
||||
"protobuf/field_mask",
|
||||
]
|
||||
revision = "c3f76f3b92d1ffa4c58a9ff842a58b8877655e0f"
|
||||
pruneopts = "UT"
|
||||
revision = "db91494dd46c1fdcbbde05e5ff5eb56df8f7d79a"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:f3fea5ef1fb1f632ae0dd9a86af6aa2048f3243d1da0075706fca1def38d9fbb"
|
||||
name = "google.golang.org/grpc"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -231,14 +291,29 @@
|
|||
"resolver/passthrough",
|
||||
"stats",
|
||||
"status",
|
||||
"tap"
|
||||
"tap",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "32fb0ac620c32ba40a4626ddf94d90d12cce3455"
|
||||
version = "v1.14.0"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "5dac84cd5efcc89491aa3cda06a774c1b370c8e0cbdb99668cbfd8ba27b3e32c"
|
||||
input-imports = [
|
||||
"cloud.google.com/go/profiler",
|
||||
"contrib.go.opencensus.io/exporter/stackdriver",
|
||||
"github.com/GoogleCloudPlatform/microservices-demo/src/shippingservice/genproto",
|
||||
"github.com/golang/protobuf/proto",
|
||||
"github.com/sirupsen/logrus",
|
||||
"go.opencensus.io/exporter/jaeger",
|
||||
"go.opencensus.io/plugin/ocgrpc",
|
||||
"go.opencensus.io/stats/view",
|
||||
"go.opencensus.io/trace",
|
||||
"golang.org/x/net/context",
|
||||
"google.golang.org/grpc",
|
||||
"google.golang.org/grpc/health/grpc_health_v1",
|
||||
"google.golang.org/grpc/reflection",
|
||||
]
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -23,6 +23,7 @@ import (
|
|||
"cloud.google.com/go/profiler"
|
||||
"contrib.go.opencensus.io/exporter/stackdriver"
|
||||
"github.com/sirupsen/logrus"
|
||||
"go.opencensus.io/exporter/jaeger"
|
||||
"go.opencensus.io/plugin/ocgrpc"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.opencensus.io/trace"
|
||||
|
@ -128,6 +129,28 @@ func (s *server) ShipOrder(ctx context.Context, in *pb.ShipOrderRequest) (*pb.Sh
|
|||
}, nil
|
||||
}
|
||||
|
||||
func initJaegerTracing() {
|
||||
svcAddr := os.Getenv("JAEGER_SERVICE_ADDR")
|
||||
if svcAddr == "" {
|
||||
log.Info("jaeger initialization disabled.")
|
||||
return
|
||||
}
|
||||
|
||||
// Register the Jaeger exporter to be able to retrieve
|
||||
// the collected spans.
|
||||
exporter, err := jaeger.NewExporter(jaeger.Options{
|
||||
Endpoint: fmt.Sprintf("http://%s", svcAddr),
|
||||
Process: jaeger.Process{
|
||||
ServiceName: "shippingservice",
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
trace.RegisterExporter(exporter)
|
||||
log.Info("jaeger initialization completed.")
|
||||
}
|
||||
|
||||
func initStats(exporter *stackdriver.Exporter) {
|
||||
view.SetReportingPeriod(60 * time.Second)
|
||||
view.RegisterExporter(exporter)
|
||||
|
@ -138,7 +161,7 @@ func initStats(exporter *stackdriver.Exporter) {
|
|||
}
|
||||
}
|
||||
|
||||
func initTracing() {
|
||||
func initStackDriverTracing() {
|
||||
// TODO(ahmetb) this method is duplicated in other microservices using Go
|
||||
// since they are not sharing packages.
|
||||
for i := 1; i <= 3; i++ {
|
||||
|
@ -161,6 +184,11 @@ func initTracing() {
|
|||
log.Warn("could not initialize stackdriver exporter after retrying, giving up")
|
||||
}
|
||||
|
||||
func initTracing() {
|
||||
initJaegerTracing()
|
||||
initStackDriverTracing()
|
||||
}
|
||||
|
||||
func initProfiling(service, version string) {
|
||||
// TODO(ahmetb) this method is duplicated in other microservices using Go
|
||||
// since they are not sharing packages.
|
||||
|
|
Loading…
Reference in a new issue