Skip to content

Commit

Permalink
[frontendproxy] Add opentelemetry_collector_http to envoy's cluster a…
Browse files Browse the repository at this point in the history
…nd expose /oltp-http/ endpoint to frontendproxy (open-telemetry#938)

Co-authored-by: Austin Parker <austin@ap2.io>
  • Loading branch information
chigia001 and austinlparker committed Jul 10, 2023
1 parent 51dcd8b commit c1e66b8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
7 changes: 4 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ ENV_PLATFORM=local

# OpenTelemetry Collector
OTEL_COLLECTOR_HOST=otelcol
OTEL_COLLECTOR_PORT=4317
OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT}
PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4318/v1/traces
OTEL_COLLECTOR_PORT_GRPC=4317
OTEL_COLLECTOR_PORT_HTTP=4318
OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC}
PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:8080/oltp-http/v1/traces

# OpenTelemetry Resource Definitions
OTEL_RESOURCE_ATTRIBUTES="service.namespace=opentelemetry-demo"
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ release.
([#935](https://github.com/open-telemetry/opentelemetry-demo/pull/935))
* [cartservice] update service to .NET 7
([#942](https://github.com/open-telemetry/opentelemetry-demo/pull/942))
* [frontendproxy]Envoy expose a route for the collector to route frontend spans
([#938](https://github.com/open-telemetry/opentelemetry-demo/pull/938))

## 1.4.0

Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ services:
- JAEGER_SERVICE_PORT
- JAEGER_SERVICE_HOST
- OTEL_COLLECTOR_HOST
- OTEL_COLLECTOR_PORT
- OTEL_COLLECTOR_PORT_GRPC
- OTEL_COLLECTOR_PORT_HTTP
- ENVOY_PORT
depends_on:
- frontend
Expand Down
6 changes: 4 additions & 2 deletions kubernetes/opentelemetry-demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7761,7 +7761,7 @@ spec:
- name: WEB_OTEL_SERVICE_NAME
value: frontend-web
- name: PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
value: http://localhost:4318/v1/traces
value: http://localhost:8080/oltp-http/v1/traces
- name: OTEL_RESOURCE_ATTRIBUTES
value: service.name=$(OTEL_SERVICE_NAME),service.instance.id=$(OTEL_K8S_POD_UID),service.namespace=opentelemetry-demo,k8s.namespace.name=$(OTEL_K8S_NAMESPACE),k8s.node.name=$(OTEL_K8S_NODE_NAME),k8s.pod.name=$(OTEL_K8S_POD_NAME)
resources:
Expand Down Expand Up @@ -7860,8 +7860,10 @@ spec:
value: "16686"
- name: JAEGER_SERVICE_HOST
value: 'opentelemetry-demo-jaeger-query'
- name: OTEL_COLLECTOR_PORT
- name: OTEL_COLLECTOR_PORT_GRPC
value: "4317"
- name: OTEL_COLLECTOR_PORT_HTTP
value: "4318"
- name: OTEL_COLLECTOR_HOST
value: $(OTEL_COLLECTOR_NAME)
- name: OTEL_RESOURCE_ATTRIBUTES
Expand Down
22 changes: 18 additions & 4 deletions src/frontendproxy/envoy.tmpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static_resources:
"@type": type.googleapis.com/envoy.config.trace.v3.OpenTelemetryConfig
grpc_service:
envoy_grpc:
cluster_name: opentelemetry_collector
cluster_name: opentelemetry_collector_grpc
timeout: 0.250s
service_name: frontend-proxy
route_config:
Expand All @@ -36,6 +36,8 @@ static_resources:
route: { cluster: featureflag, prefix_rewrite: "/" }
- match: { prefix: "/loadgen" }
route: { cluster: loadgen, prefix_rewrite: "/" }
- match: { prefix: "/oltp-http/" }
route: { cluster: opentelemetry_collector_http, prefix_rewrite: "/" }
- match: { prefix: "/jaeger" }
route: { cluster: jaeger }
- match: { prefix: "/grafana" }
Expand All @@ -48,7 +50,7 @@ static_resources:
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router

clusters:
- name: opentelemetry_collector
- name: opentelemetry_collector_grpc
type: STRICT_DNS
lb_policy: ROUND_ROBIN
typed_extension_protocol_options:
Expand All @@ -57,14 +59,26 @@ static_resources:
explicit_http_config:
http2_protocol_options: {}
load_assignment:
cluster_name: opentelemetry_collector
cluster_name: opentelemetry_collector_grpc
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: ${OTEL_COLLECTOR_HOST}
port_value: ${OTEL_COLLECTOR_PORT}
port_value: ${OTEL_COLLECTOR_PORT_GRPC}
- name: opentelemetry_collector_http
type: STRICT_DNS
lb_policy: ROUND_ROBIN
load_assignment:
cluster_name: opentelemetry_collector_http
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: ${OTEL_COLLECTOR_HOST}
port_value: ${OTEL_COLLECTOR_PORT_HTTP}
- name: frontend
type: STRICT_DNS
lb_policy: ROUND_ROBIN
Expand Down

0 comments on commit c1e66b8

Please sign in to comment.