Skip to content

Commit 876bf9b

Browse files
Add Grafana, Load Generator, Jaeger to Envoy (#513)
* add loadgen and grafana endpoints * update docs * update changelog * fix lint rules * add jaeger * fix jaeger datasource * update locust
1 parent 98f8bf5 commit 876bf9b

File tree

10 files changed

+152
-91
lines changed

10 files changed

+152
-91
lines changed

.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,20 @@ FEATURE_FLAG_GRPC_SERVICE_ADDR=featureflagservice:${FEATURE_FLAG_GRPC_SERVICE_PO
6464
LOCUST_WEB_PORT=8089
6565
LOCUST_USERS=10
6666
LOCUST_HOST=http://${FRONTEND_ADDR}
67+
LOCUST_WEB_HOST=loadgenerator
6768
LOCUST_AUTOSTART=true
6869
LOCUST_HEADLESS=false
6970

7071
# Prometheus
7172
PROMETHEUS_SERVICE_PORT=9090
73+
PROMETHEUS_SERVICE_HOST=prometheus
7274

7375
# Grafana
7476
GRAFANA_SERVICE_PORT=3000
77+
GRAFANA_SERVICE_HOST=grafana
78+
79+
# Jaeger
80+
JAEGER_SERVICE_PORT=16686
81+
JAEGER_SERVICE_HOST=jaeger
7582

7683
ENV_PLATFORM=local

.yamllint

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ rules:
1313
brackets:
1414
max-spaces-inside: 1
1515
max-spaces-inside-empty: 0
16+
braces:
17+
max-spaces-inside: 1
18+
max-spaces-inside-empty: 0

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,5 +126,7 @@ significant modifications will be credited to OpenTelemetry Authors.
126126
([#439](https://github.com/open-telemetry/opentelemetry-demo/pull/439))
127127
* Add Envoy as reverse proxy for all user-facing services
128128
([#508](https://github.com/open-telemetry/opentelemetry-demo/pull/508))
129+
* Envoy: Grafana, Load Generator, Jaeger exposed.
130+
([#513](https://github.com/open-telemetry/opentelemetry-demo/pull/513))
129131
* Added frontend instrumentation exporter custom url
130132
([#512](https://github.com/open-telemetry/opentelemetry-demo/pull/512))

docker-compose.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,20 +217,30 @@ services:
217217
dockerfile: ./src/frontendProxy/Dockerfile
218218
container_name: frontend-proxy
219219
volumes:
220-
- ./src/frontendproxy/envoy.yaml.tmpl:/etc/envoy/envoy.yaml.tmpl
220+
- ./src/frontendproxy/envoy.tmpl.yaml:/etc/envoy/envoy.tmpl.yaml
221221
ports:
222222
- "${ENVOY_PORT}:${ENVOY_PORT}"
223+
- 10000:10000
223224
environment:
224225
- PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
225226
- FRONTEND_PORT
226227
- FRONTEND_HOST
227228
- FEATURE_FLAG_SERVICE_PORT
228229
- FEATURE_FLAG_SERVICE_HOST
230+
- LOCUST_WEB_HOST
231+
- LOCUST_WEB_PORT
232+
- GRAFANA_SERVICE_PORT
233+
- GRAFANA_SERVICE_HOST
234+
- JAEGER_SERVICE_PORT
235+
- JAEGER_SERVICE_HOST
229236
- ENVOY_PORT
230237
- ENVOY_UID=0
231238
depends_on:
232239
- frontend
233-
command: /bin/sh -c "envsubst < /etc/envoy/envoy.yaml.tmpl > /etc/envoy/envoy.yaml && envoy -c /etc/envoy/envoy.yaml;"
240+
- featureflagservice
241+
- loadgenerator
242+
- grafana
243+
command: /bin/sh -c "envsubst < /etc/envoy/envoy.tmpl.yaml > /etc/envoy/envoy.yaml && envoy -c /etc/envoy/envoy.yaml;"
234244

235245
loadgenerator:
236246
image: ${IMAGE_NAME}:${IMAGE_VERSION}-loadgenerator
@@ -246,7 +256,7 @@ services:
246256
memory: 120M
247257
restart: always
248258
ports:
249-
- "${LOCUST_WEB_PORT}:${LOCUST_WEB_PORT}"
259+
- "${LOCUST_WEB_PORT}"
250260
environment:
251261
- LOCUST_WEB_PORT
252262
- LOCUST_USERS
@@ -450,14 +460,14 @@ services:
450460
jaeger:
451461
image: jaegertracing/all-in-one
452462
container_name: jaeger
453-
command: ["--memory.max-traces", "10000"]
463+
command: ["--memory.max-traces", "10000", "--query.base-path", "/jaeger/ui"]
454464
deploy:
455465
resources:
456466
limits:
457467
memory: 275M
458468
restart: always
459469
ports:
460-
- "16686:16686" # Jaeger UI
470+
- "${JAEGER_SERVICE_PORT}" # Jaeger UI
461471
- "4317" # OTLP gRPC default port
462472
environment:
463473
- COLLECTOR_OTLP_ENABLED=true
@@ -471,7 +481,7 @@ services:
471481
- ./src/grafana/grafana.ini:/etc/grafana/grafana.ini
472482
- ./src/grafana/provisioning/:/etc/grafana/provisioning/
473483
ports:
474-
- "${GRAFANA_SERVICE_PORT}:${GRAFANA_SERVICE_PORT}"
484+
- "${GRAFANA_SERVICE_PORT}"
475485
logging: *logging
476486

477487
# OpenTelemetry Collector

docs/docker_deployment.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ source. It may take more than 20 minutes to build if the flag is omitted.
4040
Once the images are built and containers are started you can access:
4141

4242
- Webstore: <http://localhost/>
43-
- Jaeger: <http://localhost:16686/>
44-
- Prometheus: <http://localhost:9090/>
45-
- Grafana: <http://localhost:3000/>
43+
- Grafana: <http://localhost/grafana/>
4644
- Feature Flags UI: <http://localhost/feature/>
47-
- Load Generator UI: <http://localhost:8089/>
45+
- Load Generator UI: <http://localhost/loadgen/>
46+
- Jaeger UI: <http://localhost/jaeger/ui/>
4847

4948
## Bring your own backend
5049

src/frontendProxy/envoy.tmpl.yaml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
static_resources:
2+
listeners:
3+
- address:
4+
socket_address:
5+
address: 0.0.0.0
6+
port_value: ${ENVOY_PORT}
7+
filter_chains:
8+
- filters:
9+
- name: envoy.filters.network.http_connection_manager
10+
typed_config:
11+
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
12+
codec_type: AUTO
13+
stat_prefix: ingress_http
14+
route_config:
15+
name: local_route
16+
virtual_hosts:
17+
- name: frontend
18+
domains:
19+
- "*"
20+
routes:
21+
- match: { prefix: "/feature" }
22+
route: { cluster: featureflag, prefix_rewrite: "/" }
23+
- match: { prefix: "/loadgen" }
24+
route: { cluster: loadgen, prefix_rewrite: "/" }
25+
- match: { prefix: "/jaeger" }
26+
route: { cluster: jaeger }
27+
- match: { prefix: "/grafana" }
28+
route: { cluster: grafana }
29+
- match: { prefix: "/" }
30+
route: { cluster: frontend }
31+
response_headers_to_add:
32+
- header:
33+
key: "Set-Cookie"
34+
value: "otelCollectorUrl=${PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT};"
35+
http_filters:
36+
- name: envoy.filters.http.router
37+
typed_config:
38+
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
39+
40+
clusters:
41+
- name: frontend
42+
type: STRICT_DNS
43+
lb_policy: ROUND_ROBIN
44+
load_assignment:
45+
cluster_name: frontend
46+
endpoints:
47+
- lb_endpoints:
48+
- endpoint:
49+
address:
50+
socket_address:
51+
address: ${FRONTEND_HOST}
52+
port_value: ${FRONTEND_PORT}
53+
- name: featureflag
54+
type: STRICT_DNS
55+
lb_policy: ROUND_ROBIN
56+
load_assignment:
57+
cluster_name: featureflag
58+
endpoints:
59+
- lb_endpoints:
60+
- endpoint:
61+
address:
62+
socket_address:
63+
address: ${FEATURE_FLAG_SERVICE_HOST}
64+
port_value: ${FEATURE_FLAG_SERVICE_PORT}
65+
- name: loadgen
66+
type: STRICT_DNS
67+
lb_policy: ROUND_ROBIN
68+
load_assignment:
69+
cluster_name: loadgen
70+
endpoints:
71+
- lb_endpoints:
72+
- endpoint:
73+
address:
74+
socket_address:
75+
address: ${LOCUST_WEB_HOST}
76+
port_value: ${LOCUST_WEB_PORT}
77+
- name: grafana
78+
type: STRICT_DNS
79+
lb_policy: ROUND_ROBIN
80+
load_assignment:
81+
cluster_name: grafana
82+
endpoints:
83+
- lb_endpoints:
84+
- endpoint:
85+
address:
86+
socket_address:
87+
address: ${GRAFANA_SERVICE_HOST}
88+
port_value: ${GRAFANA_SERVICE_PORT}
89+
- name: jaeger
90+
type: STRICT_DNS
91+
lb_policy: ROUND_ROBIN
92+
load_assignment:
93+
cluster_name: jaeger
94+
endpoints:
95+
- lb_endpoints:
96+
- endpoint:
97+
address:
98+
socket_address:
99+
address: ${JAEGER_SERVICE_HOST}
100+
port_value: ${JAEGER_SERVICE_PORT}
101+
admin:
102+
address:
103+
socket_address:
104+
address: 0.0.0.0
105+
port_value: 10000
106+
layered_runtime:
107+
layers:
108+
- name: static_layer_0
109+
static_layer:
110+
envoy:
111+
resource_limits:
112+
listener:
113+
example_listener_name:
114+
connection_limit: 10000

src/frontendProxy/envoy.yaml.tmpl

Lines changed: 0 additions & 74 deletions
This file was deleted.

src/grafana/grafana.ini

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,27 @@ provisioning = /etc/grafana/provisioning
3232
#################################### Server ####################################
3333
[server]
3434
# Protocol (http, https, h2, socket)
35-
;protocol = http
35+
protocol = http
3636

3737
# The ip address to bind to, empty will bind to all interfaces
3838
;http_addr =
3939

4040
# The http port to use
41-
;http_port = 3000
41+
http_port = 3000
4242

4343
# The public facing domain name used to access grafana from a browser
44-
;domain = localhost
44+
domain = localhost
4545

4646
# Redirect to correct domain if host header does not match domain
4747
# Prevents DNS rebinding attacks
4848
;enforce_domain = false
4949

5050
# The full public facing url you use in browser, used for redirects and emails
5151
# If you use reverse proxy and sub path specify full url (with sub path)
52-
;root_url = %(protocol)s://%(domain)s:%(http_port)s/
52+
root_url = %(protocol)s://%(domain)s/grafana/
5353

5454
# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons.
55-
;serve_from_sub_path = false
55+
serve_from_sub_path = true
5656

5757
# Log web requests
5858
;router_logging = false

src/grafana/provisioning/datasources/jaeger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ datasources:
44
- name: Jaeger
55
uid: webstore-traces
66
type: jaeger
7-
url: http://jaeger:16686
7+
url: http://jaeger/jaeger/ui:16686
88
editable: true
99
isDefault: false

src/loadgenerator/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ idna==3.4
1818
importlib-metadata==4.12.0
1919
itsdangerous==2.1.2
2020
Jinja2==3.1.2
21-
locust==2.6.1
21+
locust==2.12.2
2222
MarkupSafe==2.1.1
2323
msgpack==1.0.4
2424
mypy-extensions==0.4.3

0 commit comments

Comments
 (0)