Merge branch 'master' into regular-errors

This commit is contained in:
David Souther 2019-07-27 00:21:14 -04:00 committed by GitHub
commit cc40001714
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 261 additions and 66 deletions

View file

@ -272,6 +272,7 @@ resources.
- [Day 3 Keynote](https://youtu.be/JQPOPV_VH5w?t=815) showing Stackdriver
APM (Tracing, Code Search, Profiler, Google Cloud Build)
- [Introduction to Service Management with Istio](https://www.youtube.com/watch?v=wCJrdKdD6UM&feature=youtu.be&t=586)
- [KubeCon EU 2019 - Reinventing Networking: A Deep Dive into Istio's Multicluster Gateways - Steve Dake, Independent](https://youtu.be/-t2BfT59zJA?t=982)
---

View file

@ -1 +1 @@
{"builds":[{"imageName":"gcr.io/lesser-weevil/emailservice","tag":"gcr.io/lesser-weevil/emailservice:v0.1.0-43-ga32631d@sha256:593de0cc94b95fa033838a3d3f3dc0168cc35f736b01ace2954b3648771e1027"},{"imageName":"gcr.io/lesser-weevil/productcatalogservice","tag":"gcr.io/lesser-weevil/productcatalogservice:v0.1.0-43-ga32631d@sha256:29dc89ac7aa66dcb70fd1c9e84f422a5e0c4bcb117ed0cb29c7cd6282ab13bbe"},{"imageName":"gcr.io/lesser-weevil/recommendationservice","tag":"gcr.io/lesser-weevil/recommendationservice:v0.1.0-43-ga32631d@sha256:de6cddba59ea40a879baf25b2ae58dd06b64532d0ca52dda4c4b6d22e577f0d6"},{"imageName":"gcr.io/lesser-weevil/shippingservice","tag":"gcr.io/lesser-weevil/shippingservice:v0.1.0-43-ga32631d@sha256:0ee734d45b10760c0d01bf3ca27a85b56296337adfe540f344860b2de1eb0277"},{"imageName":"gcr.io/lesser-weevil/checkoutservice","tag":"gcr.io/lesser-weevil/checkoutservice:v0.1.0-43-ga32631d@sha256:d9b7a695508b8df8d894d4b1ea24ebc8f651c069daab64df4acb2556c72ace1d"},{"imageName":"gcr.io/lesser-weevil/paymentservice","tag":"gcr.io/lesser-weevil/paymentservice:v0.1.0-43-ga32631d-dirty@sha256:4df214a8153671eef258d9329054f2fb21eb6331d2a4b475a731d115ec16e33c"},{"imageName":"gcr.io/lesser-weevil/currencyservice","tag":"gcr.io/lesser-weevil/currencyservice:v0.1.0-43-ga32631d@sha256:7de984152d48e33d3b02f001dceb6d97f504478ac27c33dcaa27cb981c445e88"},{"imageName":"gcr.io/lesser-weevil/cartservice","tag":"gcr.io/lesser-weevil/cartservice:v0.1.0-43-ga32631d@sha256:6cc3baab0bdf2eda1ec9da076a102007c851a665c9fd8ee99d741c734c8a85fe"},{"imageName":"gcr.io/lesser-weevil/frontend","tag":"gcr.io/lesser-weevil/frontend:v0.1.0-43-ga32631d@sha256:43d6cbbfb02cb9a4435063c63127f1f4e22a8954f38cc78159c1ae7e44700bdd"},{"imageName":"gcr.io/lesser-weevil/loadgenerator","tag":"gcr.io/lesser-weevil/loadgenerator:v0.1.0-43-ga32631d-dirty@sha256:15a1adb67f03da4ef24ced791737413db372fb8eccfcc9b8155b9e1205903a97"},{"imageName":"gcr.io/lesser-weevil/adservice","tag":"gcr.io/lesser-weevil/adservice:v0.1.0-43-ga32631d@sha256:dcb2c1644648b9c18c6fc48ad7fc1a15f4dc890ad3fca531b9892d6cfdf1a305"}]}
{"builds":[{"imageName":"gcr.io/lesser-weevil/emailservice","tag":"gcr.io/lesser-weevil/emailservice:v0.1.0-53-g334f50b@sha256:b5642298862ce0852e6038cf029ed75df6a08530c3ca9b86cd2ad4b50d5cff00"},{"imageName":"gcr.io/lesser-weevil/productcatalogservice","tag":"gcr.io/lesser-weevil/productcatalogservice:v0.1.0-53-g334f50b@sha256:74288be0207731ee0f846273da3486638777cf8d4077bddd45e0aeac75bb3559"},{"imageName":"gcr.io/lesser-weevil/recommendationservice","tag":"gcr.io/lesser-weevil/recommendationservice:v0.1.0-53-g334f50b-dirty@sha256:761fcf9065618d1edf9739c5a99e0b85e85a00ea79831d9cd14ceef281bfcb96"},{"imageName":"gcr.io/lesser-weevil/shippingservice","tag":"gcr.io/lesser-weevil/shippingservice:v0.1.0-53-g334f50b@sha256:6625a1e45b63c32585248a51d32b1b5137c16c7fb0f622ee9efbd08ef0cfed42"},{"imageName":"gcr.io/lesser-weevil/checkoutservice","tag":"gcr.io/lesser-weevil/checkoutservice:v0.1.0-53-g334f50b@sha256:cab8d517f524609837c7c70d357d7ba4aeb836dc417414d726079ed811928804"},{"imageName":"gcr.io/lesser-weevil/paymentservice","tag":"gcr.io/lesser-weevil/paymentservice:v0.1.0-53-g334f50b@sha256:1d65c32c95fbf5fe7348e8d4975bf15a305279f78264f342734afc3d1273a7cb"},{"imageName":"gcr.io/lesser-weevil/currencyservice","tag":"gcr.io/lesser-weevil/currencyservice:v0.1.0-53-g334f50b@sha256:dcbf4a09a2b7961ad00496c70ebb33b125d40b3a2c28e92dc18e44ad15ff9139"},{"imageName":"gcr.io/lesser-weevil/cartservice","tag":"gcr.io/lesser-weevil/cartservice:v0.1.0-53-g334f50b@sha256:2d6b7b6422669a0850f3743c734d300cbcf247fe850127ea99f695e831e32374"},{"imageName":"gcr.io/lesser-weevil/frontend","tag":"gcr.io/lesser-weevil/frontend:v0.1.0-53-g334f50b@sha256:119a11554f457f3a4df05672de4f51050f305fba67482b242543ec6fb4ed1f05"},{"imageName":"gcr.io/lesser-weevil/loadgenerator","tag":"gcr.io/lesser-weevil/loadgenerator:v0.1.0-53-g334f50b@sha256:de90c5ce3bef7e118183a82b6a5de5f994045727b66462c2bffd4f57749f40c1"},{"imageName":"gcr.io/lesser-weevil/adservice","tag":"gcr.io/lesser-weevil/adservice:v0.1.0-53-g334f50b@sha256:39a383bafca249864cd67a8eac66e67a19dc107b46566d7e16501c4f15ee0935"},{"imageName":"gcr.io/lesser-weevil/pingjob","tag":"gcr.io/lesser-weevil/pingjob:v0.1.0-53-g334f50b-dirty@sha256:e55b195ae794a48ec045ee4652dc5feb40166c99edb58f78b7e4e59e572979af"}]}

View file

@ -17,6 +17,7 @@ kind: Deployment
metadata:
name: adservice
spec:
revisionHistoryLimit: 1
replicas: 5
selector:
matchLabels:

View file

@ -17,6 +17,8 @@ kind: Deployment
metadata:
name: cartservice
spec:
revisionHistoryLimit: 1
replicas: 10
selector:
matchLabels:
app: cartservice
@ -41,10 +43,10 @@ spec:
resources:
requests:
cpu: 200m
memory: 64Mi
memory: 128Mi
limits:
cpu: 300m
memory: 128Mi
memory: 256Mi
readinessProbe:
initialDelaySeconds: 15
exec:

View file

@ -17,6 +17,7 @@ kind: Deployment
metadata:
name: checkoutservice
spec:
revisionHistoryLimit: 1
selector:
matchLabels:
app: checkoutservice

View file

@ -17,6 +17,7 @@ kind: Deployment
metadata:
name: currencyservice
spec:
revisionHistoryLimit: 1
selector:
matchLabels:
app: currencyservice

View file

@ -17,6 +17,7 @@ kind: Deployment
metadata:
name: emailservice
spec:
revisionHistoryLimit: 1
selector:
matchLabels:
app: emailservice

View file

@ -17,6 +17,7 @@ kind: Deployment
metadata:
name: frontend-a
spec:
revisionHistoryLimit: 1
selector:
matchLabels:
app: frontend
@ -80,6 +81,7 @@ kind: Deployment
metadata:
name: frontend-b
spec:
revisionHistoryLimit: 1
selector:
matchLabels:
app: frontend

View file

@ -17,6 +17,7 @@ kind: Deployment
metadata:
name: loadgenerator
spec:
revisionHistoryLimit: 1
selector:
matchLabels:
app: loadgenerator

View file

@ -17,6 +17,7 @@ kind: Deployment
metadata:
name: paymentservice
spec:
revisionHistoryLimit: 1
selector:
matchLabels:
app: paymentservice

View file

@ -0,0 +1,23 @@
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: pinger-job
spec:
schedule: "*/5 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: main
image: pingjob
env:
- name: FRONTEND_ADDR
value: "http://35.202.74.89"
restartPolicy: OnFailure
metadata:
labels:
custom-job: pinger

View file

@ -17,6 +17,7 @@ kind: Deployment
metadata:
name: productcatalogservice
spec:
revisionHistoryLimit: 1
selector:
matchLabels:
app: productcatalogservice

View file

@ -17,6 +17,7 @@ kind: Deployment
metadata:
name: recommendationservice-v1
spec:
revisionHistoryLimit: 1
selector:
matchLabels:
app: recommendationservice
@ -99,6 +100,7 @@ spec:
limits:
cpu: 200m
memory: 450Mi
revisionHistoryLimit: 1
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService

View file

@ -17,6 +17,7 @@ kind: Deployment
metadata:
name: redis-cart
spec:
revisionHistoryLimit: 1
selector:
matchLabels:
app: redis-cart

View file

@ -17,6 +17,7 @@ kind: Deployment
metadata:
name: shippingservice
spec:
revisionHistoryLimit: 1
selector:
matchLabels:
app: shippingservice

View file

@ -48,21 +48,6 @@ spec:
number: 80
---
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: currency-provider-external
spec:
hosts:
- www.ecb.europa.eu
ports:
- number: 80
name: http
protocol: HTTP
- number: 443
name: https
protocol: HTTPS
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: frontend

View file

@ -32,9 +32,12 @@ spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: gcr.io/google-samples/microservices-demo/emailservice:v0.1.0
image: gcr.io/google-samples/microservices-demo/emailservice:v0.1.1
ports:
- containerPort: 8080
env:
- name: PORT
value: "8080"
readinessProbe:
periodSeconds: 5
exec:
@ -43,6 +46,9 @@ spec:
periodSeconds: 5
exec:
command: ["/bin/grpc_health_probe", "-addr=:8080"]
env:
- name: ENABLE_PROFILER
value: "0"
resources:
requests:
cpu: 100m
@ -79,7 +85,7 @@ spec:
spec:
containers:
- name: server
image: gcr.io/google-samples/microservices-demo/checkoutservice:v0.1.0
image: gcr.io/google-samples/microservices-demo/checkoutservice:v0.1.1
ports:
- containerPort: 5050
readinessProbe:
@ -89,6 +95,8 @@ spec:
exec:
command: ["/bin/grpc_health_probe", "-addr=:5050"]
env:
- name: PORT
value: "5050"
- name: PRODUCT_CATALOG_SERVICE_ADDR
value: "productcatalogservice:3550"
- name: SHIPPING_SERVICE_ADDR
@ -140,7 +148,7 @@ spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: gcr.io/google-samples/microservices-demo/recommendationservice:v0.1.0
image: gcr.io/google-samples/microservices-demo/recommendationservice:v0.1.1
ports:
- containerPort: 8080
readinessProbe:
@ -152,8 +160,12 @@ spec:
exec:
command: ["/bin/grpc_health_probe", "-addr=:8080"]
env:
- name: PORT
value: "8080"
- name: PRODUCT_CATALOG_SERVICE_ADDR
value: "productcatalogservice:3550"
- name: ENABLE_PROFILER
value: "0"
resources:
requests:
cpu: 100m
@ -190,7 +202,7 @@ spec:
spec:
containers:
- name: server
image: gcr.io/google-samples/microservices-demo/frontend:v0.1.0
image: gcr.io/google-samples/microservices-demo/frontend:v0.1.1
ports:
- containerPort: 8080
readinessProbe:
@ -210,6 +222,8 @@ spec:
- name: "Cookie"
value: "shop_session-id=x-liveness-probe"
env:
- name: PORT
value: "8080"
- name: PRODUCT_CATALOG_SERVICE_ADDR
value: "productcatalogservice:3550"
- name: CURRENCY_SERVICE_ADDR
@ -276,9 +290,12 @@ spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: gcr.io/google-samples/microservices-demo/paymentservice:v0.1.0
image: gcr.io/google-samples/microservices-demo/paymentservice:v0.1.1
ports:
- containerPort: 50051
env:
- name: PORT
value: "50051"
readinessProbe:
exec:
command: ["/bin/grpc_health_probe", "-addr=:50051"]
@ -322,9 +339,12 @@ spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: gcr.io/google-samples/microservices-demo/productcatalogservice:v0.1.0
image: gcr.io/google-samples/microservices-demo/productcatalogservice:v0.1.1
ports:
- containerPort: 3550
env:
- name: PORT
value: "3550"
readinessProbe:
exec:
command: ["/bin/grpc_health_probe", "-addr=:3550"]
@ -371,7 +391,7 @@ spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: gcr.io/google-samples/microservices-demo/cartservice:v0.1.0
image: gcr.io/google-samples/microservices-demo/cartservice:v0.1.1
ports:
- containerPort: 7070
env:
@ -440,7 +460,7 @@ spec:
value: "frontend:80"
containers:
- name: main
image: gcr.io/google-samples/microservices-demo/loadgenerator:v0.1.0
image: gcr.io/google-samples/microservices-demo/loadgenerator:v0.1.1
env:
- name: FRONTEND_ADDR
value: "frontend:80"
@ -470,10 +490,13 @@ spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: gcr.io/google-samples/microservices-demo/currencyservice:v0.1.0
image: gcr.io/google-samples/microservices-demo/currencyservice:v0.1.1
ports:
- name: grpc
containerPort: 7000
env:
- name: PORT
value: "7000"
readinessProbe:
exec:
command: ["/bin/grpc_health_probe", "-addr=:7000"]
@ -516,9 +539,12 @@ spec:
spec:
containers:
- name: server
image: gcr.io/google-samples/microservices-demo/shippingservice:v0.1.0
image: gcr.io/google-samples/microservices-demo/shippingservice:v0.1.1
ports:
- containerPort: 50051
env:
- name: PORT
value: "50051"
readinessProbe:
periodSeconds: 5
exec:
@ -619,7 +645,7 @@ spec:
terminationGracePeriodSeconds: 5
containers:
- name: server
image: gcr.io/google-samples/microservices-demo/adservice:v0.1.0
image: gcr.io/google-samples/microservices-demo/adservice:v0.1.1
ports:
- containerPort: 9555
env:

View file

@ -42,6 +42,8 @@ build:
context: src/loadgenerator
- image: adservice
context: src/adservice
- image: pingjob
context: src/pingjob
tagPolicy:
gitCommit: {}
deploy:

View file

@ -214,7 +214,7 @@ public final class AdService {
}
private static void initStackdriver() {
logger.info("Initialize StackDriver");
logger.info("Initialize Stackdriver");
long sleepTime = 10; /* seconds */
int maxAttempts = 5;
@ -252,7 +252,7 @@ public final class AdService {
}
}
}
logger.info("StackDriver initialization complete.");
logger.info("Stackdriver initialization complete.");
}
private static void initJaeger() {

View file

@ -131,7 +131,7 @@ func initStats(exporter *stackdriver.Exporter) {
}
}
func initStackDriverTracing() {
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++ {
@ -140,22 +140,22 @@ func initStackDriverTracing() {
log.Infof("failed to initialize stackdriver exporter: %+v", err)
} else {
trace.RegisterExporter(exporter)
log.Info("registered stackdriver tracing")
log.Info("registered Stackdriver tracing")
// Register the views to collect server stats.
initStats(exporter)
return
}
d := time.Second * 10 * time.Duration(i)
log.Infof("sleeping %v to retry initializing stackdriver exporter", d)
log.Infof("sleeping %v to retry initializing Stackdriver exporter", d)
time.Sleep(d)
}
log.Warn("could not initialize stackdriver exporter after retrying, giving up")
log.Warn("could not initialize Stackdriver exporter after retrying, giving up")
}
func initTracing() {
initJaegerTracing()
initStackDriverTracing()
initStackdriverTracing()
}
func initProfiling(service, version string) {
@ -170,14 +170,14 @@ func initProfiling(service, version string) {
}); err != nil {
log.Warnf("failed to start profiler: %+v", err)
} else {
log.Info("started stackdriver profiler")
log.Info("started Stackdriver profiler")
return
}
d := time.Second * 10 * time.Duration(i)
log.Infof("sleeping %v to retry initializing stackdriver profiler", d)
log.Infof("sleeping %v to retry initializing Stackdriver profiler", d)
time.Sleep(d)
}
log.Warn("could not initialize stackdriver profiler after retrying, giving up")
log.Warn("could not initialize Stackdriver profiler after retrying, giving up")
}
func mustMapEnv(target *string, envKey string) {

View file

@ -46,7 +46,7 @@ const request = {
};
function _moneyToString (m) {
return `${m.units}.${leftPad(m.nanos, 9, '0')} ${m.currency_code}`;
return `${m.units}.${m.nanos.toString().padStart(9, '0')} ${m.currency_code}`;
}
client.getSupportedCurrencies({}, (err, response) => {

View file

@ -16,7 +16,6 @@
"async": "^1.5.2",
"google-protobuf": "^3.0.0",
"grpc": "^1.0.0",
"left-pad": "^1.3.0",
"pino": "^5.6.2",
"request": "^2.87.0",
"xml2js": "^0.4.19"

View file

@ -191,20 +191,20 @@ func initStackdriverTracing(log logrus.FieldLogger) {
// log.Warnf is used since there are multiple backends (stackdriver & jaeger)
// to store the traces. In production setup most likely you would use only one backend.
// In that case you should use log.Fatalf.
log.Warnf("failed to initialize stackdriver exporter: %+v", err)
log.Warnf("failed to initialize Stackdriver exporter: %+v", err)
} else {
trace.RegisterExporter(exporter)
log.Info("registered stackdriver tracing")
log.Info("registered Stackdriver tracing")
// Register the views to collect server stats.
initStats(log, exporter)
return
}
d := time.Second * 20 * time.Duration(i)
log.Debugf("sleeping %v to retry initializing stackdriver exporter", d)
log.Debugf("sleeping %v to retry initializing Stackdriver exporter", d)
time.Sleep(d)
}
log.Warn("could not initialize stackdriver exporter after retrying, giving up")
log.Warn("could not initialize Stackdriver exporter after retrying, giving up")
}
func initTracing(log logrus.FieldLogger) {
@ -232,14 +232,14 @@ func initProfiling(log logrus.FieldLogger, service, version string) {
}); err != nil {
log.Warnf("warn: failed to start profiler: %+v", err)
} else {
log.Info("started stackdriver profiler")
log.Info("started Stackdriver profiler")
return
}
d := time.Second * 10 * time.Duration(i)
log.Debugf("sleeping %v to retry initializing stackdriver profiler", d)
log.Debugf("sleeping %v to retry initializing Stackdriver profiler", d)
time.Sleep(d)
}
log.Warn("warning: could not initialize stackdriver profiler after retrying, giving up")
log.Warn("warning: could not initialize Stackdriver profiler after retrying, giving up")
}
func mustMapEnv(target *string, envKey string) {

18
src/pingjob/Dockerfile Normal file
View file

@ -0,0 +1,18 @@
FROM python:3-slim as base
FROM base as builder
RUN apt-get -qq update \
&& apt-get install -y --no-install-recommends \
g++
COPY requirements.txt .
RUN pip install --install-option="--prefix=/install" -r requirements.txt
FROM base
COPY --from=builder /install /usr/local
COPY . .
ENTRYPOINT ["./pinger.sh"]

87
src/pingjob/pinger.py Normal file
View file

@ -0,0 +1,87 @@
#!/usr/bin/python
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import random
import requests
import sys
BASE = sys.argv[1]
products = [
'0PUK6V6EV0',
'1YMWWN1N4O',
'2ZYFJ3GM2N',
'66VCHSJNUP',
'6E92ZMYYFZ',
'9SIQT8TOJO',
'L9ECAV7KIM',
'LS4PSXUNUM',
'OLJCESPC7Z']
def index():
requests.get(BASE + "/")
def setCurrency():
currencies = ['EUR', 'USD', 'JPY', 'CAD']
requests.post(BASE + "/setCurrency",
{'currency_code': random.choice(currencies)})
def browseProduct():
requests.get(BASE + "/product/" + random.choice(products))
def viewCart():
requests.get(BASE + "/cart")
def addToCart():
product = random.choice(products)
requests.get(BASE + "/product/" + product)
requests.post(BASE + "/cart", {
'product_id': product,
'quantity': random.choice([1, 2, 3, 4, 5, 10])})
def checkout():
addToCart()
requests.post(BASE + "/cart/checkout", {
'email': 'someone@example.com',
'street_address': '1600 Amphitheatre Parkway',
'zip_code': '94043',
'city': 'Mountain View',
'state': 'CA',
'country': 'United States',
'credit_card_number': '4432-8015-6152-0454',
'credit_card_expiration_month': '1',
'credit_card_expiration_year': '2039',
'credit_card_cvv': '672',
})
if not BASE:
print("ERROR: no frontend address")
else:
print("pinging" + BASE)
index()
browseProduct()
addToCart()
viewCart()
checkout()
print("pinging complete")

27
src/pingjob/pinger.sh Executable file
View file

@ -0,0 +1,27 @@
#!/bin/sh -eu
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/bash
set -e
trap "exit" TERM
if [ -z "${FRONTEND_ADDR}" ]; then
echo >&2 "FRONTEND_ADDR not specified"
exit 1
fi
set -x
python pinger.py "${FRONTEND_ADDR}"

View file

@ -0,0 +1 @@
requests

View file

@ -0,0 +1,11 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file=requirements.txt requirements.in
#
certifi==2018.11.29 # via requests
chardet==3.0.4 # via requests
idna==2.8 # via requests
requests==2.21.0
urllib3==1.24.1 # via requests

View file

@ -158,32 +158,32 @@ func initStats(exporter *stackdriver.Exporter) {
}
}
func initStackDriverTracing() {
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++ {
exporter, err := stackdriver.NewExporter(stackdriver.Options{})
if err != nil {
log.Warnf("failed to initialize stackdriver exporter: %+v", err)
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")
log.Info("registered Stackdriver tracing")
// Register the views to collect server stats.
initStats(exporter)
return
}
d := time.Second * 10 * time.Duration(i)
log.Infof("sleeping %v to retry initializing stackdriver exporter", d)
log.Infof("sleeping %v to retry initializing Stackdriver exporter", d)
time.Sleep(d)
}
log.Warn("could not initialize stackdriver exporter after retrying, giving up")
log.Warn("could not initialize Stackdriver exporter after retrying, giving up")
}
func initTracing() {
initJaegerTracing()
initStackDriverTracing()
initStackdriverTracing()
}
func initProfiling(service, version string) {
@ -198,14 +198,14 @@ func initProfiling(service, version string) {
}); err != nil {
log.Warnf("failed to start profiler: %+v", err)
} else {
log.Info("started stackdriver profiler")
log.Info("started Stackdriver profiler")
return
}
d := time.Second * 10 * time.Duration(i)
log.Infof("sleeping %v to retry initializing stackdriver profiler", d)
log.Infof("sleeping %v to retry initializing Stackdriver profiler", d)
time.Sleep(d)
}
log.Warn("could not initialize stackdriver profiler after retrying, giving up")
log.Warn("could not initialize Stackdriver profiler after retrying, giving up")
}
type productCatalog struct{}

View file

@ -161,32 +161,32 @@ func initStats(exporter *stackdriver.Exporter) {
}
}
func initStackDriverTracing() {
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++ {
exporter, err := stackdriver.NewExporter(stackdriver.Options{})
if err != nil {
log.Warnf("failed to initialize stackdriver exporter: %+v", err)
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")
log.Info("registered Stackdriver tracing")
// Register the views to collect server stats.
initStats(exporter)
return
}
d := time.Second * 10 * time.Duration(i)
log.Infof("sleeping %v to retry initializing stackdriver exporter", d)
log.Infof("sleeping %v to retry initializing Stackdriver exporter", d)
time.Sleep(d)
}
log.Warn("could not initialize stackdriver exporter after retrying, giving up")
log.Warn("could not initialize Stackdriver exporter after retrying, giving up")
}
func initTracing() {
initJaegerTracing()
initStackDriverTracing()
initStackdriverTracing()
}
func initProfiling(service, version string) {
@ -201,12 +201,12 @@ func initProfiling(service, version string) {
}); err != nil {
log.Warnf("failed to start profiler: %+v", err)
} else {
log.Info("started stackdriver profiler")
log.Info("started Stackdriver profiler")
return
}
d := time.Second * 10 * time.Duration(i)
log.Infof("sleeping %v to retry initializing stackdriver profiler", d)
log.Infof("sleeping %v to retry initializing Stackdriver profiler", d)
time.Sleep(d)
}
log.Warn("could not initialize stackdriver profiler after retrying, giving up")
log.Warn("could not initialize Stackdriver profiler after retrying, giving up")
}