Instrumented everything but Python

This commit is contained in:
morganmclean 2018-07-16 11:25:10 -07:00
parent 11e68b3733
commit 99ce1f84c2
19 changed files with 952 additions and 24 deletions

View file

@ -9,11 +9,12 @@ RUN go get -d github.com/google/uuid \
google.golang.org/grpc/status \
go.opencensus.io/plugin/ocgrpc \
go.opencensus.io/exporter/stackdriver \
go.opencensus.io/trace
go.opencensus.io/trace \
cloud.google.com/go/profiler
COPY . .
# get remaining dependencies
RUN go get -d ./...
RUN go build -o /checkoutservice .
RUN go build -gcflags='-N -l' -o /checkoutservice .
FROM alpine as release
RUN apk add --no-cache ca-certificates

View file

@ -18,6 +18,8 @@ import (
pb "checkoutservice/genproto"
money "checkoutservice/money"
"cloud.google.com/go/profiler"
)
const (
@ -35,6 +37,15 @@ type checkoutService struct {
}
func main() {
if err := profiler.Start(profiler.Config{
Service: "cartservice",
ServiceVersion: "1.0.0",
// ProjectID must be set if not running on GCP.
// ProjectID: "my-project",
}); err != nil {
// TODO: Handle error.
}
port := listenPort
if os.Getenv("PORT") != "" {
port = os.Getenv("PORT")