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

View file

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