diff --git a/.env b/.env index 955519f76e..b454a66fe2 100644 --- a/.env +++ b/.env @@ -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" diff --git a/CHANGELOG.md b/CHANGELOG.md index aa31c65f16..ce4d49ae33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,8 @@ release. ([#913](https://github.com/open-telemetry/opentelemetry-demo/pull/913)) * [loadgenerator] run load through frontend proxy (Envoy) ([#914](https://github.com/open-telemetry/opentelemetry-demo/pull/914)) +* [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 diff --git a/docker-compose.yml b/docker-compose.yml index f06380dad6..e7ff7f92b0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/kubernetes/opentelemetry-demo.yaml b/kubernetes/opentelemetry-demo.yaml index 34313a755c..8b03b7cc47 100644 --- a/kubernetes/opentelemetry-demo.yaml +++ b/kubernetes/opentelemetry-demo.yaml @@ -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: @@ -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 diff --git a/src/frontendproxy/envoy.tmpl.yaml b/src/frontendproxy/envoy.tmpl.yaml index 2eb11a5570..431f76a166 100644 --- a/src/frontendproxy/envoy.tmpl.yaml +++ b/src/frontendproxy/envoy.tmpl.yaml @@ -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: @@ -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" } @@ -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: @@ -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