Unify jaeger enabling method for adservice. (#115)

This commit is contained in:
rghetia 2019-01-09 05:42:54 -08:00 committed by GitHub
parent 85c7131d43
commit 33ca3b63d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View file

@ -31,8 +31,8 @@ spec:
env:
- name: PORT
value: "9555"
- name: JAEGER_ENABLED
value: "false"
#- name: JAEGER_SERVICE_ADDR
# value: "jaeger-collector:14268"
resources:
requests:
cpu: 200m
@ -42,12 +42,12 @@ spec:
memory: 300Mi
readinessProbe:
initialDelaySeconds: 20
periodSeconds: 5
periodSeconds: 15
exec:
command: ["/bin/grpc_health_probe", "-addr=:9555"]
livenessProbe:
initialDelaySeconds: 20
periodSeconds: 5
periodSeconds: 15
exec:
command: ["/bin/grpc_health_probe", "-addr=:9555"]
---

View file

@ -238,10 +238,11 @@ public class AdService {
}
static void initJaeger() {
boolean enabled = Boolean.parseBoolean(System.getenv("JAEGER_ENABLED"));
if (enabled) {
String jaegerAddr = System.getenv("JAEGER_SERVICE_ADDR");
if (jaegerAddr != null && !jaegerAddr.isEmpty()) {
String jaegerUrl = String.format("http://%s/api/traces", jaegerAddr);
// Register Jaeger Tracing.
JaegerTraceExporter.createAndRegister("http://jaeger-collector:14268/api/traces", "adservice");
JaegerTraceExporter.createAndRegister(jaegerUrl, "adservice");
logger.info("Jaeger initialization complete.");
} else {
logger.info("Jaeger initialization disabled.");