Skip to content

Commit

Permalink
Add Grafana, Load Generator, Jaeger to Envoy (open-telemetry#513)
Browse files Browse the repository at this point in the history
* add loadgen and grafana endpoints

* update docs

* update changelog

* fix lint rules

* add jaeger

* fix jaeger datasource

* update locust
  • Loading branch information
austinlparker authored Oct 22, 2022
1 parent d1399bd commit 715d08b
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 91 deletions.
7 changes: 7 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,20 @@ FEATURE_FLAG_GRPC_SERVICE_ADDR=featureflagservice:${FEATURE_FLAG_GRPC_SERVICE_PO
LOCUST_WEB_PORT=8089
LOCUST_USERS=10
LOCUST_HOST=http://${FRONTEND_ADDR}
LOCUST_WEB_HOST=loadgenerator
LOCUST_AUTOSTART=true
LOCUST_HEADLESS=false

# Prometheus
PROMETHEUS_SERVICE_PORT=9090
PROMETHEUS_SERVICE_HOST=prometheus

# Grafana
GRAFANA_SERVICE_PORT=3000
GRAFANA_SERVICE_HOST=grafana

# Jaeger
JAEGER_SERVICE_PORT=16686
JAEGER_SERVICE_HOST=jaeger

ENV_PLATFORM=local
3 changes: 3 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ rules:
brackets:
max-spaces-inside: 1
max-spaces-inside-empty: 0
braces:
max-spaces-inside: 1
max-spaces-inside-empty: 0
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,7 @@ significant modifications will be credited to OpenTelemetry Authors.
([#439](https://github.com/open-telemetry/opentelemetry-demo/pull/439))
* Add Envoy as reverse proxy for all user-facing services
([#508](https://github.com/open-telemetry/opentelemetry-demo/pull/508))
* Envoy: Grafana, Load Generator, Jaeger exposed.
([#513](https://github.com/open-telemetry/opentelemetry-demo/pull/513))
* Added frontend instrumentation exporter custom url
([#512](https://github.com/open-telemetry/opentelemetry-demo/pull/512))
22 changes: 16 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,20 +217,30 @@ services:
dockerfile: ./src/frontendProxy/Dockerfile
container_name: frontend-proxy
volumes:
- ./src/frontendproxy/envoy.yaml.tmpl:/etc/envoy/envoy.yaml.tmpl
- ./src/frontendproxy/envoy.tmpl.yaml:/etc/envoy/envoy.tmpl.yaml
ports:
- "${ENVOY_PORT}:${ENVOY_PORT}"
- 10000:10000
environment:
- PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- FRONTEND_PORT
- FRONTEND_HOST
- FEATURE_FLAG_SERVICE_PORT
- FEATURE_FLAG_SERVICE_HOST
- LOCUST_WEB_HOST
- LOCUST_WEB_PORT
- GRAFANA_SERVICE_PORT
- GRAFANA_SERVICE_HOST
- JAEGER_SERVICE_PORT
- JAEGER_SERVICE_HOST
- ENVOY_PORT
- ENVOY_UID=0
depends_on:
- frontend
command: /bin/sh -c "envsubst < /etc/envoy/envoy.yaml.tmpl > /etc/envoy/envoy.yaml && envoy -c /etc/envoy/envoy.yaml;"
- featureflagservice
- loadgenerator
- grafana
command: /bin/sh -c "envsubst < /etc/envoy/envoy.tmpl.yaml > /etc/envoy/envoy.yaml && envoy -c /etc/envoy/envoy.yaml;"

loadgenerator:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-loadgenerator
Expand All @@ -246,7 +256,7 @@ services:
memory: 120M
restart: always
ports:
- "${LOCUST_WEB_PORT}:${LOCUST_WEB_PORT}"
- "${LOCUST_WEB_PORT}"
environment:
- LOCUST_WEB_PORT
- LOCUST_USERS
Expand Down Expand Up @@ -450,14 +460,14 @@ services:
jaeger:
image: jaegertracing/all-in-one
container_name: jaeger
command: ["--memory.max-traces", "10000"]
command: ["--memory.max-traces", "10000", "--query.base-path", "/jaeger/ui"]
deploy:
resources:
limits:
memory: 275M
restart: always
ports:
- "16686:16686" # Jaeger UI
- "${JAEGER_SERVICE_PORT}" # Jaeger UI
- "4317" # OTLP gRPC default port
environment:
- COLLECTOR_OTLP_ENABLED=true
Expand All @@ -471,7 +481,7 @@ services:
- ./src/grafana/grafana.ini:/etc/grafana/grafana.ini
- ./src/grafana/provisioning/:/etc/grafana/provisioning/
ports:
- "${GRAFANA_SERVICE_PORT}:${GRAFANA_SERVICE_PORT}"
- "${GRAFANA_SERVICE_PORT}"
logging: *logging

# OpenTelemetry Collector
Expand Down
7 changes: 3 additions & 4 deletions docs/docker_deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ source. It may take more than 20 minutes to build if the flag is omitted.
Once the images are built and containers are started you can access:

- Webstore: <http://localhost/>
- Jaeger: <http://localhost:16686/>
- Prometheus: <http://localhost:9090/>
- Grafana: <http://localhost:3000/>
- Grafana: <http://localhost/grafana/>
- Feature Flags UI: <http://localhost/feature/>
- Load Generator UI: <http://localhost:8089/>
- Load Generator UI: <http://localhost/loadgen/>
- Jaeger UI: <http://localhost/jaeger/ui/>

## Bring your own backend

Expand Down
114 changes: 114 additions & 0 deletions src/frontendProxy/envoy.tmpl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
static_resources:
listeners:
- address:
socket_address:
address: 0.0.0.0
port_value: ${ENVOY_PORT}
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
codec_type: AUTO
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: frontend
domains:
- "*"
routes:
- match: { prefix: "/feature" }
route: { cluster: featureflag, prefix_rewrite: "/" }
- match: { prefix: "/loadgen" }
route: { cluster: loadgen, prefix_rewrite: "/" }
- match: { prefix: "/jaeger" }
route: { cluster: jaeger }
- match: { prefix: "/grafana" }
route: { cluster: grafana }
- match: { prefix: "/" }
route: { cluster: frontend }
response_headers_to_add:
- header:
key: "Set-Cookie"
value: "otelCollectorUrl=${PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT};"
http_filters:
- name: envoy.filters.http.router
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router

clusters:
- name: frontend
type: STRICT_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: frontend
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: ${FRONTEND_HOST}
port_value: ${FRONTEND_PORT}
- name: featureflag
type: STRICT_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: featureflag
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: ${FEATURE_FLAG_SERVICE_HOST}
port_value: ${FEATURE_FLAG_SERVICE_PORT}
- name: loadgen
type: STRICT_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: loadgen
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: ${LOCUST_WEB_HOST}
port_value: ${LOCUST_WEB_PORT}
- name: grafana
type: STRICT_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: grafana
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: ${GRAFANA_SERVICE_HOST}
port_value: ${GRAFANA_SERVICE_PORT}
- name: jaeger
type: STRICT_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: jaeger
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: ${JAEGER_SERVICE_HOST}
port_value: ${JAEGER_SERVICE_PORT}
admin:
address:
socket_address:
address: 0.0.0.0
port_value: 10000
layered_runtime:
layers:
- name: static_layer_0
static_layer:
envoy:
resource_limits:
listener:
example_listener_name:
connection_limit: 10000
74 changes: 0 additions & 74 deletions src/frontendProxy/envoy.yaml.tmpl

This file was deleted.

10 changes: 5 additions & 5 deletions src/grafana/grafana.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ provisioning = /etc/grafana/provisioning
#################################### Server ####################################
[server]
# Protocol (http, https, h2, socket)
;protocol = http
protocol = http

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

# The http port to use
;http_port = 3000
http_port = 3000

# The public facing domain name used to access grafana from a browser
;domain = localhost
domain = localhost

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

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

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

# Log web requests
;router_logging = false
Expand Down
2 changes: 1 addition & 1 deletion src/grafana/provisioning/datasources/jaeger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ datasources:
- name: Jaeger
uid: webstore-traces
type: jaeger
url: http://jaeger:16686
url: http://jaeger/jaeger/ui:16686
editable: true
isDefault: false
2 changes: 1 addition & 1 deletion src/loadgenerator/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ idna==3.4
importlib-metadata==4.12.0
itsdangerous==2.1.2
Jinja2==3.1.2
locust==2.6.1
locust==2.12.2
MarkupSafe==2.1.1
msgpack==1.0.4
mypy-extensions==0.4.3
Expand Down

0 comments on commit 715d08b

Please sign in to comment.