Skip to content

Commit

Permalink
[FrontendProxy] Add tracing to Envoy (open-telemetry#613)
Browse files Browse the repository at this point in the history
* Add tracing to Envoy

* Changelog

* yamllint

* lint

* Add doc

* Add note to doc

* Move env var definition
  • Loading branch information
julianocosta89 committed Dec 7, 2022
1 parent 7212399 commit 057d1c6
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ IMAGE_VERSION=v1.1.0
IMAGE_NAME=ghcr.io/open-telemetry/demo

# Collector
OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol:4317
OTEL_COLLECTOR_HOST=otelcol
OTEL_COLLECTOR_PORT=4317
OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT}
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT}
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT}
PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4318/v1/traces
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,5 @@ significant modifications will be credited to OpenTelemetry Authors.
([#512](https://github.com/open-telemetry/opentelemetry-demo/pull/457))
* Added support for non-root containers
([#615](https://github.com/open-telemetry/opentelemetry-demo/pull/615))
* Add tracing to Envoy (frontend-proxy)
([#613](https://github.com/open-telemetry/opentelemetry-demo/pull/613))
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ services:
- GRAFANA_SERVICE_HOST
- JAEGER_SERVICE_PORT
- JAEGER_SERVICE_HOST
- OTEL_COLLECTOR_HOST
- OTEL_COLLECTOR_PORT
- ENVOY_PORT
depends_on:
- frontend
Expand Down
60 changes: 60 additions & 0 deletions docs/services/frontendproxy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Frontend Proxy(Envoy)

The frontend proxy is used as a reverse proxy for user-facing web
interfaces such as the frontend, Jaeger, Grafana, load generator,
and feature flag service.

## Enabling OpenTelemetry

**NOTE: Only non-synthetic requests will trigger the envoy tracing.**

In order to enable Envoy to produce spans whenever receiving a request,
the following configuration is required:

```yaml
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
tracing:
provider:
name: envoy.tracers.opentelemetry
typed_config:
"@type": type.googleapis.com/envoy.config.trace.v3.OpenTelemetryConfig
grpc_service:
envoy_grpc:
cluster_name: opentelemetry_collector
timeout: 0.250s
service_name: frontend-proxy

clusters:
- name: opentelemetry_collector
type: STRICT_DNS
lb_policy: ROUND_ROBIN
typed_extension_protocol_options:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
"@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
explicit_http_config:
http2_protocol_options: {}
load_assignment:
cluster_name: opentelemetry_collector
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: ${OTEL_COLLECTOR_HOST}
port_value: ${OTEL_COLLECTOR_PORT}
```

Where `OTEL_COLLECTOR_HOST` and `OTEL_COLLECTOR_PORT` are passed via
environment variables.
27 changes: 27 additions & 0 deletions src/frontendproxy/envoy.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ static_resources:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
codec_type: AUTO
stat_prefix: ingress_http
tracing:
provider:
name: envoy.tracers.opentelemetry
typed_config:
"@type": type.googleapis.com/envoy.config.trace.v3.OpenTelemetryConfig
grpc_service:
envoy_grpc:
cluster_name: opentelemetry_collector
timeout: 0.250s
service_name: frontend-proxy
route_config:
name: local_route
virtual_hosts:
Expand Down Expand Up @@ -38,6 +48,23 @@ static_resources:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router

clusters:
- name: opentelemetry_collector
type: STRICT_DNS
lb_policy: ROUND_ROBIN
typed_extension_protocol_options:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
"@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
explicit_http_config:
http2_protocol_options: {}
load_assignment:
cluster_name: opentelemetry_collector
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: ${OTEL_COLLECTOR_HOST}
port_value: ${OTEL_COLLECTOR_PORT}
- name: frontend
type: STRICT_DNS
lb_policy: ROUND_ROBIN
Expand Down

0 comments on commit 057d1c6

Please sign in to comment.