Instrument Go service with Stats and monitored resources. (#30)
added default views for stats for http and grpc in Go services only. added monitored resources for go.
This commit is contained in:
parent
04c3876e94
commit
7f2ecfea9e
13 changed files with 608 additions and 100 deletions
153
src/checkoutservice/Gopkg.lock
generated
153
src/checkoutservice/Gopkg.lock
generated
|
@ -2,27 +2,88 @@
|
|||
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8bd3661b916f063159bb7b069be282d3df5b08e09ae12bb0a04d4df2ebf41eb5"
|
||||
name = "cloud.google.com/go"
|
||||
packages = [
|
||||
"compute/metadata",
|
||||
"internal/version",
|
||||
"monitoring/apiv3",
|
||||
"profiler",
|
||||
"trace/apiv2"
|
||||
"trace/apiv2",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "aad3f485ee528456e0768f20397b4d9dd941e755"
|
||||
version = "v0.25.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:45381144fe0fc2ed4d9687c424e13695ac1aa1614031608f823f93b8fd1bf3bc"
|
||||
name = "contrib.go.opencensus.io/exporter/stackdriver"
|
||||
packages = [
|
||||
".",
|
||||
"propagation"
|
||||
"monitoredresource",
|
||||
"propagation",
|
||||
]
|
||||
revision = "37aa2801fbf0205003e15636096ebf0373510288"
|
||||
version = "v0.5.0"
|
||||
pruneopts = "UT"
|
||||
revision = "2b93072101d466aa4120b3c23c2e1b08af01541c"
|
||||
version = "v0.6.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:f5961cd4f136ee9f3a80ca62a05ecc4fb60107d6a323ae258a1c732b76861809"
|
||||
name = "github.com/GoogleCloudPlatform/microservices-demo"
|
||||
packages = [
|
||||
"src/checkoutservice/genproto",
|
||||
"src/checkoutservice/money",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "04c3876e94d0cce27004c8f8677f32fd959f91ff"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a24422d56c82fea7f62704054e89223d603895650a2039b076c5cd84e4d97b56"
|
||||
name = "github.com/aws/aws-sdk-go"
|
||||
packages = [
|
||||
"aws",
|
||||
"aws/awserr",
|
||||
"aws/awsutil",
|
||||
"aws/client",
|
||||
"aws/client/metadata",
|
||||
"aws/corehandlers",
|
||||
"aws/credentials",
|
||||
"aws/credentials/ec2rolecreds",
|
||||
"aws/credentials/endpointcreds",
|
||||
"aws/credentials/stscreds",
|
||||
"aws/csm",
|
||||
"aws/defaults",
|
||||
"aws/ec2metadata",
|
||||
"aws/endpoints",
|
||||
"aws/request",
|
||||
"aws/session",
|
||||
"aws/signer/v4",
|
||||
"internal/sdkio",
|
||||
"internal/sdkrand",
|
||||
"internal/sdkuri",
|
||||
"internal/shareddefaults",
|
||||
"private/protocol",
|
||||
"private/protocol/query",
|
||||
"private/protocol/query/queryutil",
|
||||
"private/protocol/rest",
|
||||
"private/protocol/xml/xmlutil",
|
||||
"service/sts",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "ea2d2b9a8808d0c390d966daf855a7b3b74bc44e"
|
||||
version = "v1.15.19"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:5abd6a22805b1919f6a6bca0ae58b13cef1f3412812f38569978f43ef02743d4"
|
||||
name = "github.com/go-ini/ini"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "5cf292cae48347c2490ac1a58fe36735fb78df7e"
|
||||
version = "v1.38.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:72856926f8208767b837bf51e3373f49139f61889b67dc7fd3c2a0fd711e3f7a"
|
||||
name = "github.com/golang/protobuf"
|
||||
packages = [
|
||||
"proto",
|
||||
|
@ -33,30 +94,45 @@
|
|||
"ptypes/empty",
|
||||
"ptypes/struct",
|
||||
"ptypes/timestamp",
|
||||
"ptypes/wrappers"
|
||||
"ptypes/wrappers",
|
||||
]
|
||||
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
|
||||
version = "v1.1.0"
|
||||
pruneopts = "UT"
|
||||
revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:089d56c0adb79140365b5c86815ce97233986da6f3a525c6b706773e4b83876f"
|
||||
name = "github.com/google/pprof"
|
||||
packages = ["profile"]
|
||||
revision = "ef437552946f69f7e3bdf1fd81c385c29530944d"
|
||||
pruneopts = "UT"
|
||||
revision = "bfbbd91e3edf426f0cd4b17cd64aab7c6d58e283"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8f8811f9be822914c3a25c6a071e93beb4c805d7b026cbf298bc577bc1cc945b"
|
||||
name = "github.com/google/uuid"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "064e2069ce9c359c118179501254f67d7d37ba24"
|
||||
version = "0.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e145e9710a10bc114a6d3e2738aadf8de146adaa031854ffdf7bbfe15da85e63"
|
||||
name = "github.com/googleapis/gax-go"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "317e0006254c44a0ac427cc52a0e083ff0b9622f"
|
||||
version = "v2.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e22af8c7518e1eab6f2eab2b7d7558927f816262586cd6ed9f349c97a6c285c4"
|
||||
name = "github.com/jmespath/go-jmespath"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "0b12d6b5"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8aeeec4536b28cd5e66dcdf935be7e15b661feb04402bb173c32c736aa59325b"
|
||||
name = "go.opencensus.io"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -71,13 +147,15 @@
|
|||
"tag",
|
||||
"trace",
|
||||
"trace/internal",
|
||||
"trace/propagation"
|
||||
"trace/propagation",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "e262766cd0d230a1bb7c37281e345e465f19b41b"
|
||||
version = "v0.14.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:1c14517b2f106c61d75006199b46a46576058661d469658cb0f90739919641d2"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"context",
|
||||
|
@ -87,35 +165,43 @@
|
|||
"http2/hpack",
|
||||
"idna",
|
||||
"internal/timeseries",
|
||||
"trace"
|
||||
"trace",
|
||||
]
|
||||
revision = "f4c29de78a2a91c00474a2e689954305c350adf9"
|
||||
pruneopts = "UT"
|
||||
revision = "faa378e6dbaed88bd8100f8bcf09939375c6e8fa"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:f645667d687fc8bf228865a2c5455824ef05bad08841e673673ef2bb89ac5b90"
|
||||
name = "golang.org/x/oauth2"
|
||||
packages = [
|
||||
".",
|
||||
"google",
|
||||
"internal",
|
||||
"jws",
|
||||
"jwt"
|
||||
"jwt",
|
||||
]
|
||||
revision = "3d292e4d0cdc3a0113e6d207bb137145ef1de42f"
|
||||
pruneopts = "UT"
|
||||
revision = "d2e6202438beef2727060aa7cabdd924d92ebfd9"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:e0140c0c868c6e0f01c0380865194592c011fe521d6e12d78bfd33e756fe018a"
|
||||
name = "golang.org/x/sync"
|
||||
packages = ["semaphore"]
|
||||
pruneopts = "UT"
|
||||
revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:4dcdb3f7c22f5f048de7c7ad5b72c4547d63bfb4923da15538d0051d553b2ef8"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix"]
|
||||
revision = "0ffbfd41fbef8ffcf9b62b0b0aa3a5873ed7a4fe"
|
||||
pruneopts = "UT"
|
||||
revision = "11551d06cbcc94edc80a0facaccbda56473c19c1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18"
|
||||
name = "golang.org/x/text"
|
||||
packages = [
|
||||
"collate",
|
||||
|
@ -131,13 +217,15 @@
|
|||
"unicode/bidi",
|
||||
"unicode/cldr",
|
||||
"unicode/norm",
|
||||
"unicode/rangetable"
|
||||
"unicode/rangetable",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:e9e388241f9f0f02000dddaeeb91153d53f0cd09dcec33879cc7e043a2e65d75"
|
||||
name = "google.golang.org/api"
|
||||
packages = [
|
||||
"googleapi/transport",
|
||||
|
@ -147,11 +235,13 @@
|
|||
"support/bundler",
|
||||
"transport",
|
||||
"transport/grpc",
|
||||
"transport/http"
|
||||
"transport/http",
|
||||
]
|
||||
revision = "f6d94689cbd71030af1108ddac733886fcae1d75"
|
||||
pruneopts = "UT"
|
||||
revision = "943e5aafc110feadee8cf71cde31afa0d1bab9f8"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:26619fcd2452b4044174d26acd8b09c09dffee9a1c3a22d2383b873aa9a0131f"
|
||||
name = "google.golang.org/appengine"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -165,13 +255,15 @@
|
|||
"internal/socket",
|
||||
"internal/urlfetch",
|
||||
"socket",
|
||||
"urlfetch"
|
||||
"urlfetch",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "b1f26356af11148e710935ed1ac8a7f5702c7612"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:a2a11aadbc22b026b529560357052e194c58120ed1cf11ab52cd6b5303eb23f3"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = [
|
||||
"googleapis/api/annotations",
|
||||
|
@ -184,11 +276,13 @@
|
|||
"googleapis/monitoring/v3",
|
||||
"googleapis/rpc/errdetails",
|
||||
"googleapis/rpc/status",
|
||||
"protobuf/field_mask"
|
||||
"protobuf/field_mask",
|
||||
]
|
||||
revision = "daca94659cb50e9f37c1b834680f2e46358f10b0"
|
||||
pruneopts = "UT"
|
||||
revision = "c66870c02cf823ceb633bcd05be3c7cda29976f4"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:f4fdb603068ae856b9eb05772787bf4966b1fabd3b074e3f840aab417bd992c3"
|
||||
name = "google.golang.org/grpc"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -217,14 +311,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 = "54254ec0ccf29fb2b490b54b12e5f3eb752ab9b8f9d4f5ab097d60f96eeed9d9"
|
||||
input-imports = [
|
||||
"cloud.google.com/go/profiler",
|
||||
"contrib.go.opencensus.io/exporter/stackdriver",
|
||||
"contrib.go.opencensus.io/exporter/stackdriver/monitoredresource",
|
||||
"github.com/GoogleCloudPlatform/microservices-demo/src/checkoutservice/genproto",
|
||||
"github.com/GoogleCloudPlatform/microservices-demo/src/checkoutservice/money",
|
||||
"github.com/golang/protobuf/proto",
|
||||
"github.com/google/uuid",
|
||||
"go.opencensus.io/plugin/ocgrpc",
|
||||
"go.opencensus.io/trace",
|
||||
"golang.org/x/net/context",
|
||||
"google.golang.org/grpc",
|
||||
"google.golang.org/grpc/codes",
|
||||
"google.golang.org/grpc/status",
|
||||
]
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
[[constraint]]
|
||||
name = "contrib.go.opencensus.io/exporter/stackdriver"
|
||||
version = "0.5.0"
|
||||
version = "0.6.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/golang/protobuf"
|
||||
|
|
|
@ -26,11 +26,13 @@ import (
|
|||
"contrib.go.opencensus.io/exporter/stackdriver"
|
||||
"github.com/google/uuid"
|
||||
"go.opencensus.io/plugin/ocgrpc"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
|
||||
"contrib.go.opencensus.io/exporter/stackdriver/monitoredresource"
|
||||
pb "github.com/GoogleCloudPlatform/microservices-demo/src/checkoutservice/genproto"
|
||||
money "github.com/GoogleCloudPlatform/microservices-demo/src/checkoutservice/money"
|
||||
)
|
||||
|
@ -78,17 +80,31 @@ func main() {
|
|||
log.Fatal(srv.Serve(lis))
|
||||
}
|
||||
|
||||
func initStats(exporter *stackdriver.Exporter) {
|
||||
view.RegisterExporter(exporter)
|
||||
if err := view.Register(ocgrpc.DefaultServerViews...); err != nil {
|
||||
log.Printf("Error registering default server views")
|
||||
} else {
|
||||
log.Printf("Registered default server views");
|
||||
}
|
||||
}
|
||||
|
||||
func initTracing() {
|
||||
// TODO(ahmetb) this method is duplicated in other microservices using Go
|
||||
// since they are not sharing packages.
|
||||
for i := 1; i <= 3; i++ {
|
||||
exporter, err := stackdriver.NewExporter(stackdriver.Options{})
|
||||
exporter, err := stackdriver.NewExporter(stackdriver.Options{
|
||||
MonitoredResource: monitoredresource.Autodetect(),
|
||||
})
|
||||
if err != nil {
|
||||
log.Printf("info: failed to initialize stackdriver exporter: %+v", err)
|
||||
} else {
|
||||
trace.RegisterExporter(exporter)
|
||||
trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()})
|
||||
log.Print("registered stackdriver tracing")
|
||||
|
||||
// Register the views to collect server stats.
|
||||
initStats(exporter)
|
||||
return
|
||||
}
|
||||
d := time.Second * 10 * time.Duration(i)
|
||||
|
|
170
src/frontend/Gopkg.lock
generated
170
src/frontend/Gopkg.lock
generated
|
@ -2,27 +2,88 @@
|
|||
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8bd3661b916f063159bb7b069be282d3df5b08e09ae12bb0a04d4df2ebf41eb5"
|
||||
name = "cloud.google.com/go"
|
||||
packages = [
|
||||
"compute/metadata",
|
||||
"internal/version",
|
||||
"monitoring/apiv3",
|
||||
"profiler",
|
||||
"trace/apiv2"
|
||||
"trace/apiv2",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "aad3f485ee528456e0768f20397b4d9dd941e755"
|
||||
version = "v0.25.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:45381144fe0fc2ed4d9687c424e13695ac1aa1614031608f823f93b8fd1bf3bc"
|
||||
name = "contrib.go.opencensus.io/exporter/stackdriver"
|
||||
packages = [
|
||||
".",
|
||||
"propagation"
|
||||
"monitoredresource",
|
||||
"propagation",
|
||||
]
|
||||
revision = "37aa2801fbf0205003e15636096ebf0373510288"
|
||||
version = "v0.5.0"
|
||||
pruneopts = "UT"
|
||||
revision = "2b93072101d466aa4120b3c23c2e1b08af01541c"
|
||||
version = "v0.6.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:3ef905a7059a17712b7b27315692992f84f356e828d38f6ff0624e04103ec675"
|
||||
name = "github.com/GoogleCloudPlatform/microservices-demo"
|
||||
packages = [
|
||||
"src/frontend/genproto",
|
||||
"src/frontend/money",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "04c3876e94d0cce27004c8f8677f32fd959f91ff"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a24422d56c82fea7f62704054e89223d603895650a2039b076c5cd84e4d97b56"
|
||||
name = "github.com/aws/aws-sdk-go"
|
||||
packages = [
|
||||
"aws",
|
||||
"aws/awserr",
|
||||
"aws/awsutil",
|
||||
"aws/client",
|
||||
"aws/client/metadata",
|
||||
"aws/corehandlers",
|
||||
"aws/credentials",
|
||||
"aws/credentials/ec2rolecreds",
|
||||
"aws/credentials/endpointcreds",
|
||||
"aws/credentials/stscreds",
|
||||
"aws/csm",
|
||||
"aws/defaults",
|
||||
"aws/ec2metadata",
|
||||
"aws/endpoints",
|
||||
"aws/request",
|
||||
"aws/session",
|
||||
"aws/signer/v4",
|
||||
"internal/sdkio",
|
||||
"internal/sdkrand",
|
||||
"internal/sdkuri",
|
||||
"internal/shareddefaults",
|
||||
"private/protocol",
|
||||
"private/protocol/query",
|
||||
"private/protocol/query/queryutil",
|
||||
"private/protocol/rest",
|
||||
"private/protocol/xml/xmlutil",
|
||||
"service/sts",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "ea2d2b9a8808d0c390d966daf855a7b3b74bc44e"
|
||||
version = "v1.15.19"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:5abd6a22805b1919f6a6bca0ae58b13cef1f3412812f38569978f43ef02743d4"
|
||||
name = "github.com/go-ini/ini"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "5cf292cae48347c2490ac1a58fe36735fb78df7e"
|
||||
version = "v1.38.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:72856926f8208767b837bf51e3373f49139f61889b67dc7fd3c2a0fd711e3f7a"
|
||||
name = "github.com/golang/protobuf"
|
||||
packages = [
|
||||
"proto",
|
||||
|
@ -33,54 +94,77 @@
|
|||
"ptypes/empty",
|
||||
"ptypes/struct",
|
||||
"ptypes/timestamp",
|
||||
"ptypes/wrappers"
|
||||
"ptypes/wrappers",
|
||||
]
|
||||
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
|
||||
version = "v1.1.0"
|
||||
pruneopts = "UT"
|
||||
revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:089d56c0adb79140365b5c86815ce97233986da6f3a525c6b706773e4b83876f"
|
||||
name = "github.com/google/pprof"
|
||||
packages = ["profile"]
|
||||
revision = "ef437552946f69f7e3bdf1fd81c385c29530944d"
|
||||
pruneopts = "UT"
|
||||
revision = "bfbbd91e3edf426f0cd4b17cd64aab7c6d58e283"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8f8811f9be822914c3a25c6a071e93beb4c805d7b026cbf298bc577bc1cc945b"
|
||||
name = "github.com/google/uuid"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "064e2069ce9c359c118179501254f67d7d37ba24"
|
||||
version = "0.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e145e9710a10bc114a6d3e2738aadf8de146adaa031854ffdf7bbfe15da85e63"
|
||||
name = "github.com/googleapis/gax-go"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "317e0006254c44a0ac427cc52a0e083ff0b9622f"
|
||||
version = "v2.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:c79fb010be38a59d657c48c6ba1d003a8aa651fa56b579d959d74573b7dff8e1"
|
||||
name = "github.com/gorilla/context"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "08b5f424b9271eedf6f9f0ce86cb9396ed337a42"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e73f5b0152105f18bc131fba127d9949305c8693f8a762588a82a48f61756f5f"
|
||||
name = "github.com/gorilla/mux"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "e3702bed27f0d39777b0b37b664b6280e8ef8fbf"
|
||||
version = "v1.6.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e22af8c7518e1eab6f2eab2b7d7558927f816262586cd6ed9f349c97a6c285c4"
|
||||
name = "github.com/jmespath/go-jmespath"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "0b12d6b5"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:40e195917a951a8bf867cd05de2a46aaf1806c50cf92eebf4c16f78cd196f747"
|
||||
name = "github.com/pkg/errors"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
|
||||
version = "v0.8.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:d867dfa6751c8d7a435821ad3b736310c2ed68945d05b50fb9d23aee0540c8cc"
|
||||
name = "github.com/sirupsen/logrus"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "3e01752db0189b9157070a0e1668a620f9a85da2"
|
||||
version = "v1.0.6"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8aeeec4536b28cd5e66dcdf935be7e15b661feb04402bb173c32c736aa59325b"
|
||||
name = "go.opencensus.io"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -95,19 +179,23 @@
|
|||
"tag",
|
||||
"trace",
|
||||
"trace/internal",
|
||||
"trace/propagation"
|
||||
"trace/propagation",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "e262766cd0d230a1bb7c37281e345e465f19b41b"
|
||||
version = "v0.14.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:3f3a05ae0b95893d90b9b3b5afdb79a9b3d96e4e36e099d841ae602e4aca0da8"
|
||||
name = "golang.org/x/crypto"
|
||||
packages = ["ssh/terminal"]
|
||||
revision = "56440b844dfe139a8ac053f4ecac0b20b79058f4"
|
||||
pruneopts = "UT"
|
||||
revision = "614d502a4dac94afa3a6ce146bd1736da82514c6"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:1c14517b2f106c61d75006199b46a46576058661d469658cb0f90739919641d2"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"context",
|
||||
|
@ -117,38 +205,46 @@
|
|||
"http2/hpack",
|
||||
"idna",
|
||||
"internal/timeseries",
|
||||
"trace"
|
||||
"trace",
|
||||
]
|
||||
revision = "f4c29de78a2a91c00474a2e689954305c350adf9"
|
||||
pruneopts = "UT"
|
||||
revision = "faa378e6dbaed88bd8100f8bcf09939375c6e8fa"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:f645667d687fc8bf228865a2c5455824ef05bad08841e673673ef2bb89ac5b90"
|
||||
name = "golang.org/x/oauth2"
|
||||
packages = [
|
||||
".",
|
||||
"google",
|
||||
"internal",
|
||||
"jws",
|
||||
"jwt"
|
||||
"jwt",
|
||||
]
|
||||
revision = "3d292e4d0cdc3a0113e6d207bb137145ef1de42f"
|
||||
pruneopts = "UT"
|
||||
revision = "d2e6202438beef2727060aa7cabdd924d92ebfd9"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:e0140c0c868c6e0f01c0380865194592c011fe521d6e12d78bfd33e756fe018a"
|
||||
name = "golang.org/x/sync"
|
||||
packages = ["semaphore"]
|
||||
pruneopts = "UT"
|
||||
revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:7710ea76bd73d3154e86eaf2db8b36a6dffbd6114e4e37b516f1d232c03ddd8d"
|
||||
name = "golang.org/x/sys"
|
||||
packages = [
|
||||
"unix",
|
||||
"windows"
|
||||
"windows",
|
||||
]
|
||||
revision = "0ffbfd41fbef8ffcf9b62b0b0aa3a5873ed7a4fe"
|
||||
pruneopts = "UT"
|
||||
revision = "11551d06cbcc94edc80a0facaccbda56473c19c1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18"
|
||||
name = "golang.org/x/text"
|
||||
packages = [
|
||||
"collate",
|
||||
|
@ -164,13 +260,15 @@
|
|||
"unicode/bidi",
|
||||
"unicode/cldr",
|
||||
"unicode/norm",
|
||||
"unicode/rangetable"
|
||||
"unicode/rangetable",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:e9e388241f9f0f02000dddaeeb91153d53f0cd09dcec33879cc7e043a2e65d75"
|
||||
name = "google.golang.org/api"
|
||||
packages = [
|
||||
"googleapi/transport",
|
||||
|
@ -180,11 +278,13 @@
|
|||
"support/bundler",
|
||||
"transport",
|
||||
"transport/grpc",
|
||||
"transport/http"
|
||||
"transport/http",
|
||||
]
|
||||
revision = "f6d94689cbd71030af1108ddac733886fcae1d75"
|
||||
pruneopts = "UT"
|
||||
revision = "943e5aafc110feadee8cf71cde31afa0d1bab9f8"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:26619fcd2452b4044174d26acd8b09c09dffee9a1c3a22d2383b873aa9a0131f"
|
||||
name = "google.golang.org/appengine"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -198,13 +298,15 @@
|
|||
"internal/socket",
|
||||
"internal/urlfetch",
|
||||
"socket",
|
||||
"urlfetch"
|
||||
"urlfetch",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "b1f26356af11148e710935ed1ac8a7f5702c7612"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:a2a11aadbc22b026b529560357052e194c58120ed1cf11ab52cd6b5303eb23f3"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = [
|
||||
"googleapis/api/annotations",
|
||||
|
@ -217,11 +319,13 @@
|
|||
"googleapis/monitoring/v3",
|
||||
"googleapis/rpc/errdetails",
|
||||
"googleapis/rpc/status",
|
||||
"protobuf/field_mask"
|
||||
"protobuf/field_mask",
|
||||
]
|
||||
revision = "daca94659cb50e9f37c1b834680f2e46358f10b0"
|
||||
pruneopts = "UT"
|
||||
revision = "c66870c02cf823ceb633bcd05be3c7cda29976f4"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:f4fdb603068ae856b9eb05772787bf4966b1fabd3b074e3f840aab417bd992c3"
|
||||
name = "google.golang.org/grpc"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -250,14 +354,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 = "806889b149b944cab2216a1769d221df9ca18b3b62fb5040e40737fd0550084c"
|
||||
input-imports = [
|
||||
"cloud.google.com/go/profiler",
|
||||
"contrib.go.opencensus.io/exporter/stackdriver",
|
||||
"contrib.go.opencensus.io/exporter/stackdriver/monitoredresource",
|
||||
"github.com/GoogleCloudPlatform/microservices-demo/src/frontend/genproto",
|
||||
"github.com/GoogleCloudPlatform/microservices-demo/src/frontend/money",
|
||||
"github.com/golang/protobuf/proto",
|
||||
"github.com/google/uuid",
|
||||
"github.com/gorilla/mux",
|
||||
"github.com/pkg/errors",
|
||||
"github.com/sirupsen/logrus",
|
||||
"go.opencensus.io/plugin/ocgrpc",
|
||||
"go.opencensus.io/plugin/ochttp",
|
||||
"go.opencensus.io/plugin/ochttp/propagation/b3",
|
||||
"go.opencensus.io/trace",
|
||||
"golang.org/x/net/context",
|
||||
"google.golang.org/grpc",
|
||||
]
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
[[constraint]]
|
||||
name = "contrib.go.opencensus.io/exporter/stackdriver"
|
||||
version = "0.5.0"
|
||||
version = "0.6.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/golang/protobuf"
|
||||
|
|
|
@ -80,7 +80,7 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) {
|
|||
"products": ps,
|
||||
"cart_size": len(cart),
|
||||
"banner_color": os.Getenv("BANNER_COLOR"), // illustrates canary deployments
|
||||
"ad": fe.chooseAd(r.Context(), log),
|
||||
"ad": fe.chooseAd(r.Context(), log),
|
||||
}); err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
|
|
|
@ -17,18 +17,21 @@ package main
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"cloud.google.com/go/profiler"
|
||||
"contrib.go.opencensus.io/exporter/stackdriver"
|
||||
"contrib.go.opencensus.io/exporter/stackdriver/monitoredresource"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"go.opencensus.io/plugin/ocgrpc"
|
||||
"go.opencensus.io/plugin/ochttp"
|
||||
"go.opencensus.io/plugin/ochttp/propagation/b3"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
@ -132,18 +135,37 @@ func main() {
|
|||
log.Fatal(http.ListenAndServe(addr+":"+srvPort, handler))
|
||||
}
|
||||
|
||||
func initStats(log logrus.FieldLogger, exporter *stackdriver.Exporter) {
|
||||
view.RegisterExporter(exporter)
|
||||
if err := view.Register(ochttp.DefaultServerViews...); err != nil {
|
||||
log.Warn("Error registering http default server views")
|
||||
} else {
|
||||
log.Info("Registered http default server views");
|
||||
}
|
||||
if err := view.Register(ocgrpc.DefaultClientViews...); err != nil {
|
||||
log.Warn("Error registering grpc default client views")
|
||||
} else {
|
||||
log.Info("Registered grpc default client views");
|
||||
}
|
||||
}
|
||||
|
||||
func initTracing(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++ {
|
||||
log = log.WithField("retry", i)
|
||||
exporter, err := stackdriver.NewExporter(stackdriver.Options{})
|
||||
exporter, err := stackdriver.NewExporter(stackdriver.Options{
|
||||
MonitoredResource: monitoredresource.Autodetect(),
|
||||
})
|
||||
if err != nil {
|
||||
log.Warnf("failed to initialize stackdriver exporter: %+v", err)
|
||||
} else {
|
||||
trace.RegisterExporter(exporter)
|
||||
trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()})
|
||||
log.Info("registered stackdriver tracing")
|
||||
|
||||
// Register the views to collect server stats.
|
||||
initStats(exporter)
|
||||
return
|
||||
}
|
||||
d := time.Second * 20 * time.Duration(i)
|
||||
|
|
152
src/productcatalogservice/Gopkg.lock
generated
152
src/productcatalogservice/Gopkg.lock
generated
|
@ -2,27 +2,85 @@
|
|||
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8bd3661b916f063159bb7b069be282d3df5b08e09ae12bb0a04d4df2ebf41eb5"
|
||||
name = "cloud.google.com/go"
|
||||
packages = [
|
||||
"compute/metadata",
|
||||
"internal/version",
|
||||
"monitoring/apiv3",
|
||||
"profiler",
|
||||
"trace/apiv2"
|
||||
"trace/apiv2",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "aad3f485ee528456e0768f20397b4d9dd941e755"
|
||||
version = "v0.25.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:45381144fe0fc2ed4d9687c424e13695ac1aa1614031608f823f93b8fd1bf3bc"
|
||||
name = "contrib.go.opencensus.io/exporter/stackdriver"
|
||||
packages = [
|
||||
".",
|
||||
"propagation"
|
||||
"monitoredresource",
|
||||
"propagation",
|
||||
]
|
||||
revision = "37aa2801fbf0205003e15636096ebf0373510288"
|
||||
version = "v0.5.0"
|
||||
pruneopts = "UT"
|
||||
revision = "2b93072101d466aa4120b3c23c2e1b08af01541c"
|
||||
version = "v0.6.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:c82c943645b21ca2fd3f9d248df1ca5f9055fb5fea5cf4145472163f198ed5df"
|
||||
name = "github.com/GoogleCloudPlatform/microservices-demo"
|
||||
packages = ["src/productcatalogservice/genproto"]
|
||||
pruneopts = "UT"
|
||||
revision = "04c3876e94d0cce27004c8f8677f32fd959f91ff"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a24422d56c82fea7f62704054e89223d603895650a2039b076c5cd84e4d97b56"
|
||||
name = "github.com/aws/aws-sdk-go"
|
||||
packages = [
|
||||
"aws",
|
||||
"aws/awserr",
|
||||
"aws/awsutil",
|
||||
"aws/client",
|
||||
"aws/client/metadata",
|
||||
"aws/corehandlers",
|
||||
"aws/credentials",
|
||||
"aws/credentials/ec2rolecreds",
|
||||
"aws/credentials/endpointcreds",
|
||||
"aws/credentials/stscreds",
|
||||
"aws/csm",
|
||||
"aws/defaults",
|
||||
"aws/ec2metadata",
|
||||
"aws/endpoints",
|
||||
"aws/request",
|
||||
"aws/session",
|
||||
"aws/signer/v4",
|
||||
"internal/sdkio",
|
||||
"internal/sdkrand",
|
||||
"internal/sdkuri",
|
||||
"internal/shareddefaults",
|
||||
"private/protocol",
|
||||
"private/protocol/query",
|
||||
"private/protocol/query/queryutil",
|
||||
"private/protocol/rest",
|
||||
"private/protocol/xml/xmlutil",
|
||||
"service/sts",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "ea2d2b9a8808d0c390d966daf855a7b3b74bc44e"
|
||||
version = "v1.15.19"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:5abd6a22805b1919f6a6bca0ae58b13cef1f3412812f38569978f43ef02743d4"
|
||||
name = "github.com/go-ini/ini"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "5cf292cae48347c2490ac1a58fe36735fb78df7e"
|
||||
version = "v1.38.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:4fbf68bee2a60f6af6414572936edb295f6f26b73c6fb25ab0e7b03b013854f5"
|
||||
name = "github.com/golang/protobuf"
|
||||
packages = [
|
||||
"jsonpb",
|
||||
|
@ -34,35 +92,50 @@
|
|||
"ptypes/empty",
|
||||
"ptypes/struct",
|
||||
"ptypes/timestamp",
|
||||
"ptypes/wrappers"
|
||||
"ptypes/wrappers",
|
||||
]
|
||||
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
|
||||
version = "v1.1.0"
|
||||
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:089d56c0adb79140365b5c86815ce97233986da6f3a525c6b706773e4b83876f"
|
||||
name = "github.com/google/pprof"
|
||||
packages = ["profile"]
|
||||
revision = "ef437552946f69f7e3bdf1fd81c385c29530944d"
|
||||
pruneopts = "UT"
|
||||
revision = "bfbbd91e3edf426f0cd4b17cd64aab7c6d58e283"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e145e9710a10bc114a6d3e2738aadf8de146adaa031854ffdf7bbfe15da85e63"
|
||||
name = "github.com/googleapis/gax-go"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "317e0006254c44a0ac427cc52a0e083ff0b9622f"
|
||||
version = "v2.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e22af8c7518e1eab6f2eab2b7d7558927f816262586cd6ed9f349c97a6c285c4"
|
||||
name = "github.com/jmespath/go-jmespath"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "0b12d6b5"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8aeeec4536b28cd5e66dcdf935be7e15b661feb04402bb173c32c736aa59325b"
|
||||
name = "go.opencensus.io"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -77,13 +150,15 @@
|
|||
"tag",
|
||||
"trace",
|
||||
"trace/internal",
|
||||
"trace/propagation"
|
||||
"trace/propagation",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "e262766cd0d230a1bb7c37281e345e465f19b41b"
|
||||
version = "v0.14.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:1c14517b2f106c61d75006199b46a46576058661d469658cb0f90739919641d2"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"context",
|
||||
|
@ -93,35 +168,43 @@
|
|||
"http2/hpack",
|
||||
"idna",
|
||||
"internal/timeseries",
|
||||
"trace"
|
||||
"trace",
|
||||
]
|
||||
revision = "f4c29de78a2a91c00474a2e689954305c350adf9"
|
||||
pruneopts = "UT"
|
||||
revision = "faa378e6dbaed88bd8100f8bcf09939375c6e8fa"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:f645667d687fc8bf228865a2c5455824ef05bad08841e673673ef2bb89ac5b90"
|
||||
name = "golang.org/x/oauth2"
|
||||
packages = [
|
||||
".",
|
||||
"google",
|
||||
"internal",
|
||||
"jws",
|
||||
"jwt"
|
||||
"jwt",
|
||||
]
|
||||
revision = "3d292e4d0cdc3a0113e6d207bb137145ef1de42f"
|
||||
pruneopts = "UT"
|
||||
revision = "d2e6202438beef2727060aa7cabdd924d92ebfd9"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:e0140c0c868c6e0f01c0380865194592c011fe521d6e12d78bfd33e756fe018a"
|
||||
name = "golang.org/x/sync"
|
||||
packages = ["semaphore"]
|
||||
pruneopts = "UT"
|
||||
revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:4dcdb3f7c22f5f048de7c7ad5b72c4547d63bfb4923da15538d0051d553b2ef8"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix"]
|
||||
revision = "0ffbfd41fbef8ffcf9b62b0b0aa3a5873ed7a4fe"
|
||||
pruneopts = "UT"
|
||||
revision = "11551d06cbcc94edc80a0facaccbda56473c19c1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18"
|
||||
name = "golang.org/x/text"
|
||||
packages = [
|
||||
"collate",
|
||||
|
@ -137,13 +220,15 @@
|
|||
"unicode/bidi",
|
||||
"unicode/cldr",
|
||||
"unicode/norm",
|
||||
"unicode/rangetable"
|
||||
"unicode/rangetable",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:e9e388241f9f0f02000dddaeeb91153d53f0cd09dcec33879cc7e043a2e65d75"
|
||||
name = "google.golang.org/api"
|
||||
packages = [
|
||||
"googleapi/transport",
|
||||
|
@ -153,11 +238,13 @@
|
|||
"support/bundler",
|
||||
"transport",
|
||||
"transport/grpc",
|
||||
"transport/http"
|
||||
"transport/http",
|
||||
]
|
||||
revision = "f6d94689cbd71030af1108ddac733886fcae1d75"
|
||||
pruneopts = "UT"
|
||||
revision = "943e5aafc110feadee8cf71cde31afa0d1bab9f8"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:26619fcd2452b4044174d26acd8b09c09dffee9a1c3a22d2383b873aa9a0131f"
|
||||
name = "google.golang.org/appengine"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -171,13 +258,15 @@
|
|||
"internal/socket",
|
||||
"internal/urlfetch",
|
||||
"socket",
|
||||
"urlfetch"
|
||||
"urlfetch",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "b1f26356af11148e710935ed1ac8a7f5702c7612"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:a2a11aadbc22b026b529560357052e194c58120ed1cf11ab52cd6b5303eb23f3"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = [
|
||||
"googleapis/api/annotations",
|
||||
|
@ -190,11 +279,13 @@
|
|||
"googleapis/monitoring/v3",
|
||||
"googleapis/rpc/errdetails",
|
||||
"googleapis/rpc/status",
|
||||
"protobuf/field_mask"
|
||||
"protobuf/field_mask",
|
||||
]
|
||||
revision = "daca94659cb50e9f37c1b834680f2e46358f10b0"
|
||||
pruneopts = "UT"
|
||||
revision = "c66870c02cf823ceb633bcd05be3c7cda29976f4"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:f4fdb603068ae856b9eb05772787bf4966b1fabd3b074e3f840aab417bd992c3"
|
||||
name = "google.golang.org/grpc"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -223,14 +314,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 = "c8e8e119ed16d97490ab7d949aa70654738f91a59da70583dfed22ee44661a1b"
|
||||
input-imports = [
|
||||
"cloud.google.com/go/profiler",
|
||||
"contrib.go.opencensus.io/exporter/stackdriver",
|
||||
"contrib.go.opencensus.io/exporter/stackdriver/monitoredresource",
|
||||
"github.com/GoogleCloudPlatform/microservices-demo/src/productcatalogservice/genproto",
|
||||
"github.com/golang/protobuf/jsonpb",
|
||||
"github.com/golang/protobuf/proto",
|
||||
"github.com/google/go-cmp/cmp",
|
||||
"go.opencensus.io/plugin/ocgrpc",
|
||||
"go.opencensus.io/trace",
|
||||
"golang.org/x/net/context",
|
||||
"google.golang.org/grpc",
|
||||
"google.golang.org/grpc/codes",
|
||||
"google.golang.org/grpc/status",
|
||||
]
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
[[constraint]]
|
||||
name = "contrib.go.opencensus.io/exporter/stackdriver"
|
||||
version = "0.5.0"
|
||||
version = "0.6.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/golang/protobuf"
|
||||
|
|
|
@ -29,8 +29,10 @@ import (
|
|||
|
||||
"cloud.google.com/go/profiler"
|
||||
"contrib.go.opencensus.io/exporter/stackdriver"
|
||||
"contrib.go.opencensus.io/exporter/stackdriver/monitoredresource"
|
||||
"github.com/golang/protobuf/jsonpb"
|
||||
"go.opencensus.io/plugin/ocgrpc"
|
||||
"go.opencensus.io/stats/view"
|
||||
"go.opencensus.io/trace"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
|
@ -73,17 +75,31 @@ func run(port int) string {
|
|||
return l.Addr().String()
|
||||
}
|
||||
|
||||
func initStats(exporter *stackdriver.Exporter) {
|
||||
view.RegisterExporter(exporter)
|
||||
if err := view.Register(ocgrpc.DefaultServerViews...); err != nil {
|
||||
log.Printf("Error registering default server views")
|
||||
} else {
|
||||
log.Printf("Registered default server views");
|
||||
}
|
||||
}
|
||||
|
||||
func initTracing() {
|
||||
// TODO(ahmetb) this method is duplicated in other microservices using Go
|
||||
// since they are not sharing packages.
|
||||
for i := 1; i <= 3; i++ {
|
||||
exporter, err := stackdriver.NewExporter(stackdriver.Options{})
|
||||
exporter, err := stackdriver.NewExporter(stackdriver.Options{
|
||||
MonitoredResource: monitoredresource.Autodetect(),
|
||||
})
|
||||
if err != nil {
|
||||
log.Printf("info: failed to initialize stackdriver exporter: %+v", err)
|
||||
} else {
|
||||
trace.RegisterExporter(exporter)
|
||||
trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()})
|
||||
log.Print("registered stackdriver tracing")
|
||||
|
||||
// Register the views to collect server stats.
|
||||
initStats(exporter)
|
||||
return
|
||||
}
|
||||
d := time.Second * 10 * time.Duration(i)
|
||||
|
|
145
src/shippingservice/Gopkg.lock
generated
145
src/shippingservice/Gopkg.lock
generated
|
@ -2,27 +2,85 @@
|
|||
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8bd3661b916f063159bb7b069be282d3df5b08e09ae12bb0a04d4df2ebf41eb5"
|
||||
name = "cloud.google.com/go"
|
||||
packages = [
|
||||
"compute/metadata",
|
||||
"internal/version",
|
||||
"monitoring/apiv3",
|
||||
"profiler",
|
||||
"trace/apiv2"
|
||||
"trace/apiv2",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "aad3f485ee528456e0768f20397b4d9dd941e755"
|
||||
version = "v0.25.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:45381144fe0fc2ed4d9687c424e13695ac1aa1614031608f823f93b8fd1bf3bc"
|
||||
name = "contrib.go.opencensus.io/exporter/stackdriver"
|
||||
packages = [
|
||||
".",
|
||||
"propagation"
|
||||
"monitoredresource",
|
||||
"propagation",
|
||||
]
|
||||
revision = "37aa2801fbf0205003e15636096ebf0373510288"
|
||||
version = "v0.5.0"
|
||||
pruneopts = "UT"
|
||||
revision = "2b93072101d466aa4120b3c23c2e1b08af01541c"
|
||||
version = "v0.6.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:57b417980654aa49be2ff6a1ee6498a412ab253930dd95f1e1f27a9bbf2e1081"
|
||||
name = "github.com/GoogleCloudPlatform/microservices-demo"
|
||||
packages = ["src/shippingservice/genproto"]
|
||||
pruneopts = "UT"
|
||||
revision = "04c3876e94d0cce27004c8f8677f32fd959f91ff"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a24422d56c82fea7f62704054e89223d603895650a2039b076c5cd84e4d97b56"
|
||||
name = "github.com/aws/aws-sdk-go"
|
||||
packages = [
|
||||
"aws",
|
||||
"aws/awserr",
|
||||
"aws/awsutil",
|
||||
"aws/client",
|
||||
"aws/client/metadata",
|
||||
"aws/corehandlers",
|
||||
"aws/credentials",
|
||||
"aws/credentials/ec2rolecreds",
|
||||
"aws/credentials/endpointcreds",
|
||||
"aws/credentials/stscreds",
|
||||
"aws/csm",
|
||||
"aws/defaults",
|
||||
"aws/ec2metadata",
|
||||
"aws/endpoints",
|
||||
"aws/request",
|
||||
"aws/session",
|
||||
"aws/signer/v4",
|
||||
"internal/sdkio",
|
||||
"internal/sdkrand",
|
||||
"internal/sdkuri",
|
||||
"internal/shareddefaults",
|
||||
"private/protocol",
|
||||
"private/protocol/query",
|
||||
"private/protocol/query/queryutil",
|
||||
"private/protocol/rest",
|
||||
"private/protocol/xml/xmlutil",
|
||||
"service/sts",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "ea2d2b9a8808d0c390d966daf855a7b3b74bc44e"
|
||||
version = "v1.15.19"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:5abd6a22805b1919f6a6bca0ae58b13cef1f3412812f38569978f43ef02743d4"
|
||||
name = "github.com/go-ini/ini"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "5cf292cae48347c2490ac1a58fe36735fb78df7e"
|
||||
version = "v1.38.2"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:72856926f8208767b837bf51e3373f49139f61889b67dc7fd3c2a0fd711e3f7a"
|
||||
name = "github.com/golang/protobuf"
|
||||
packages = [
|
||||
"proto",
|
||||
|
@ -33,24 +91,37 @@
|
|||
"ptypes/empty",
|
||||
"ptypes/struct",
|
||||
"ptypes/timestamp",
|
||||
"ptypes/wrappers"
|
||||
"ptypes/wrappers",
|
||||
]
|
||||
revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265"
|
||||
version = "v1.1.0"
|
||||
pruneopts = "UT"
|
||||
revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
|
||||
version = "v1.2.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:089d56c0adb79140365b5c86815ce97233986da6f3a525c6b706773e4b83876f"
|
||||
name = "github.com/google/pprof"
|
||||
packages = ["profile"]
|
||||
revision = "ef437552946f69f7e3bdf1fd81c385c29530944d"
|
||||
pruneopts = "UT"
|
||||
revision = "bfbbd91e3edf426f0cd4b17cd64aab7c6d58e283"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e145e9710a10bc114a6d3e2738aadf8de146adaa031854ffdf7bbfe15da85e63"
|
||||
name = "github.com/googleapis/gax-go"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "317e0006254c44a0ac427cc52a0e083ff0b9622f"
|
||||
version = "v2.0.0"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:e22af8c7518e1eab6f2eab2b7d7558927f816262586cd6ed9f349c97a6c285c4"
|
||||
name = "github.com/jmespath/go-jmespath"
|
||||
packages = ["."]
|
||||
pruneopts = "UT"
|
||||
revision = "0b12d6b5"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:8aeeec4536b28cd5e66dcdf935be7e15b661feb04402bb173c32c736aa59325b"
|
||||
name = "go.opencensus.io"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -65,13 +136,15 @@
|
|||
"tag",
|
||||
"trace",
|
||||
"trace/internal",
|
||||
"trace/propagation"
|
||||
"trace/propagation",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "e262766cd0d230a1bb7c37281e345e465f19b41b"
|
||||
version = "v0.14.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:1c14517b2f106c61d75006199b46a46576058661d469658cb0f90739919641d2"
|
||||
name = "golang.org/x/net"
|
||||
packages = [
|
||||
"context",
|
||||
|
@ -81,35 +154,43 @@
|
|||
"http2/hpack",
|
||||
"idna",
|
||||
"internal/timeseries",
|
||||
"trace"
|
||||
"trace",
|
||||
]
|
||||
revision = "f4c29de78a2a91c00474a2e689954305c350adf9"
|
||||
pruneopts = "UT"
|
||||
revision = "faa378e6dbaed88bd8100f8bcf09939375c6e8fa"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:f645667d687fc8bf228865a2c5455824ef05bad08841e673673ef2bb89ac5b90"
|
||||
name = "golang.org/x/oauth2"
|
||||
packages = [
|
||||
".",
|
||||
"google",
|
||||
"internal",
|
||||
"jws",
|
||||
"jwt"
|
||||
"jwt",
|
||||
]
|
||||
revision = "3d292e4d0cdc3a0113e6d207bb137145ef1de42f"
|
||||
pruneopts = "UT"
|
||||
revision = "d2e6202438beef2727060aa7cabdd924d92ebfd9"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:e0140c0c868c6e0f01c0380865194592c011fe521d6e12d78bfd33e756fe018a"
|
||||
name = "golang.org/x/sync"
|
||||
packages = ["semaphore"]
|
||||
pruneopts = "UT"
|
||||
revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:4dcdb3f7c22f5f048de7c7ad5b72c4547d63bfb4923da15538d0051d553b2ef8"
|
||||
name = "golang.org/x/sys"
|
||||
packages = ["unix"]
|
||||
revision = "0ffbfd41fbef8ffcf9b62b0b0aa3a5873ed7a4fe"
|
||||
pruneopts = "UT"
|
||||
revision = "11551d06cbcc94edc80a0facaccbda56473c19c1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18"
|
||||
name = "golang.org/x/text"
|
||||
packages = [
|
||||
"collate",
|
||||
|
@ -125,13 +206,15 @@
|
|||
"unicode/bidi",
|
||||
"unicode/cldr",
|
||||
"unicode/norm",
|
||||
"unicode/rangetable"
|
||||
"unicode/rangetable",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
|
||||
version = "v0.3.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:e9e388241f9f0f02000dddaeeb91153d53f0cd09dcec33879cc7e043a2e65d75"
|
||||
name = "google.golang.org/api"
|
||||
packages = [
|
||||
"googleapi/transport",
|
||||
|
@ -141,11 +224,13 @@
|
|||
"support/bundler",
|
||||
"transport",
|
||||
"transport/grpc",
|
||||
"transport/http"
|
||||
"transport/http",
|
||||
]
|
||||
revision = "f6d94689cbd71030af1108ddac733886fcae1d75"
|
||||
pruneopts = "UT"
|
||||
revision = "943e5aafc110feadee8cf71cde31afa0d1bab9f8"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:26619fcd2452b4044174d26acd8b09c09dffee9a1c3a22d2383b873aa9a0131f"
|
||||
name = "google.golang.org/appengine"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -159,13 +244,15 @@
|
|||
"internal/socket",
|
||||
"internal/urlfetch",
|
||||
"socket",
|
||||
"urlfetch"
|
||||
"urlfetch",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "b1f26356af11148e710935ed1ac8a7f5702c7612"
|
||||
version = "v1.1.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
digest = "1:a2a11aadbc22b026b529560357052e194c58120ed1cf11ab52cd6b5303eb23f3"
|
||||
name = "google.golang.org/genproto"
|
||||
packages = [
|
||||
"googleapis/api/annotations",
|
||||
|
@ -178,11 +265,13 @@
|
|||
"googleapis/monitoring/v3",
|
||||
"googleapis/rpc/errdetails",
|
||||
"googleapis/rpc/status",
|
||||
"protobuf/field_mask"
|
||||
"protobuf/field_mask",
|
||||
]
|
||||
revision = "daca94659cb50e9f37c1b834680f2e46358f10b0"
|
||||
pruneopts = "UT"
|
||||
revision = "c66870c02cf823ceb633bcd05be3c7cda29976f4"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:a42d0221ccaaca8ece1d8d062da147bfa658c9221fd0e7edeb96e550c0093b39"
|
||||
name = "google.golang.org/grpc"
|
||||
packages = [
|
||||
".",
|
||||
|
@ -213,14 +302,26 @@
|
|||
"resolver/passthrough",
|
||||
"stats",
|
||||
"status",
|
||||
"tap"
|
||||
"tap",
|
||||
]
|
||||
pruneopts = "UT"
|
||||
revision = "32fb0ac620c32ba40a4626ddf94d90d12cce3455"
|
||||
version = "v1.14.0"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "3f4776192cec97ef87c4d20a52c9752d106a298befc139e5bca176bf915ed63b"
|
||||
input-imports = [
|
||||
"cloud.google.com/go/profiler",
|
||||
"contrib.go.opencensus.io/exporter/stackdriver",
|
||||
"contrib.go.opencensus.io/exporter/stackdriver/monitoredresource",
|
||||
"github.com/GoogleCloudPlatform/microservices-demo/src/shippingservice/genproto",
|
||||
"github.com/golang/protobuf/proto",
|
||||
"go.opencensus.io/plugin/ocgrpc",
|
||||
"go.opencensus.io/trace",
|
||||
"golang.org/x/net/context",
|
||||
"google.golang.org/grpc",
|
||||
"google.golang.org/grpc/reflection",
|
||||
]
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
[[constraint]]
|
||||
name = "contrib.go.opencensus.io/exporter/stackdriver"
|
||||
version = "0.5.0"
|
||||
version = "0.6.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/golang/protobuf"
|
||||
|
|
|
@ -24,11 +24,13 @@ import (
|
|||
"cloud.google.com/go/profiler"
|
||||
"contrib.go.opencensus.io/exporter/stackdriver"
|
||||
"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/reflection"
|
||||
|
||||
"contrib.go.opencensus.io/exporter/stackdriver/monitoredresource"
|
||||
pb "github.com/GoogleCloudPlatform/microservices-demo/src/shippingservice/genproto"
|
||||
)
|
||||
|
||||
|
@ -103,17 +105,31 @@ func (s *server) ShipOrder(ctx context.Context, in *pb.ShipOrderRequest) (*pb.Sh
|
|||
}, nil
|
||||
}
|
||||
|
||||
func initStats(exporter *stackdriver.Exporter) {
|
||||
view.RegisterExporter(exporter)
|
||||
if err := view.Register(ocgrpc.DefaultServerViews...); err != nil {
|
||||
log.Printf("Error registering default server views")
|
||||
} else {
|
||||
log.Printf("Registered default server views");
|
||||
}
|
||||
}
|
||||
|
||||
func initTracing() {
|
||||
// TODO(ahmetb) this method is duplicated in other microservices using Go
|
||||
// since they are not sharing packages.
|
||||
for i := 1; i <= 3; i++ {
|
||||
exporter, err := stackdriver.NewExporter(stackdriver.Options{})
|
||||
exporter, err := stackdriver.NewExporter(stackdriver.Options{
|
||||
MonitoredResource: monitoredresource.Autodetect(),
|
||||
})
|
||||
if err != nil {
|
||||
log.Printf("info: failed to initialize stackdriver exporter: %+v", err)
|
||||
} else {
|
||||
trace.RegisterExporter(exporter)
|
||||
trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()})
|
||||
log.Print("registered stackdriver tracing")
|
||||
|
||||
// Register the views to collect server stats.
|
||||
initStats(exporter)
|
||||
return
|
||||
}
|
||||
d := time.Second * 10 * time.Duration(i)
|
||||
|
|
Loading…
Reference in a new issue