Skip to content

Commit

Permalink
use opentelemetry (#127)
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Paskal <[email protected]>
  • Loading branch information
maksim-paskal authored Nov 15, 2023
1 parent c888b40 commit 764ae32
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 26 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ containers:
apiVersion: v1
fieldPath: metadata.namespace
# this will be send all traces to jaeger agent (daemonset)
- name: JAEGER_AGENT_HOST
- name: OTLP_COLLECTOR_HOST
valueFrom:
fieldRef:
apiVersion: v1
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ services:
- ./certs/:/certs:ro
environment:
- ENVOY_SERVICE_NAME=test1-id
- JAEGER_AGENT_HOST=jaeger
- OTLP_COLLECTOR_HOST=jaeger
command:
- /bin/sh
- -c
Expand All @@ -87,7 +87,7 @@ services:
context: .
environment:
- ENVOY_SERVICE_NAME=test2-id
- JAEGER_AGENT_HOST=jaeger
- OTLP_COLLECTOR_HOST=jaeger
command:
- /usr/local/bin/envoy
- --config-path /etc/envoy/envoy.yaml
Expand All @@ -107,7 +107,7 @@ services:
context: .
environment:
- ENVOY_SERVICE_NAME=test2-id
- JAEGER_AGENT_HOST=jaeger
- OTLP_COLLECTOR_HOST=jaeger
command:
- /usr/local/bin/envoy
- --config-path /etc/envoy/envoy.yaml
Expand Down
9 changes: 5 additions & 4 deletions envoy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ FROM $base
ARG TARGETARCH

ADD --chown=envoy:envoy https://github.com/maksim-paskal/go-template/releases/download/v0.1.2/go-template_0.1.2_linux_${TARGETARCH} /usr/local/bin/go-template
COPY --from=paskalmaksim/jaeger-client-cpp:0.5.0-clang --chown=envoy:envoy /libjaegertracing_plugin.so /usr/local/lib/libjaegertracing_plugin.so

COPY ./cli /usr/local/bin/cli
COPY ./envoy/scripts /scripts
Expand All @@ -18,10 +17,8 @@ RUN apt update \
&& apt full-upgrade -y \
&& touch /tmp/checksum.amd64 \
&& echo "65d6b1e296dafb062c785c5a14135beeca953b11c577a70da74e5071793a4120 /usr/local/bin/go-template" >> /tmp/checksum.amd64 \
&& echo "473ce4db569c2adfb6fc52a35582310c66164a241b7d7c5cc514d334757b682a /usr/local/lib/libjaegertracing_plugin.so" >> /tmp/checksum.amd64 \
&& touch /tmp/checksum.arm64 \
&& echo "c70ad5472a7a4db5ee9fd2593ebbad1437f345c9ee4a0fda3ba688199350e277 /usr/local/bin/go-template" >> /tmp/checksum.arm64 \
&& echo "edb17cbd9e87afbb2f4612b37f52499ccbd9844d88c22144f0aafb129d3aabd7 /usr/local/lib/libjaegertracing_plugin.so" >> /tmp/checksum.arm64 \
&& sha256sum -c /tmp/checksum.${TARGETARCH} \
&& rm -rf /tmp/checksum* \
&& chmod +x /usr/local/bin/go-template /entrypoint.sh /usr/local/bin/cli /scripts/* \
Expand All @@ -35,8 +32,12 @@ USER 101
ENV XDS_CLUSTER_TYPE=STRICT_DNS
ENV XDS_CLUSTER_ADDRESS=envoy-control-plane

ENV ENVOY_SERVICE_NAME=test-service
ENV OTLP_COLLECTOR_HOST=collector
ENV OTLP_COLLECTOR_PORT=4317

# test configuration
RUN ENVOY_SERVICE_NAME=test-service JAEGER_AGENT_HOST=jaeger /entrypoint.sh \
RUN /entrypoint.sh \
/usr/local/bin/envoy \
-c /etc/envoy/envoy.yaml \
--service-cluster test \
Expand Down
41 changes: 24 additions & 17 deletions envoy/envoy.defaults/envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,23 @@ static_resources:
grpc_services:
- envoy_grpc:
cluster_name: xds_cluster
- 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: {{ env "OTLP_COLLECTOR_HOST" }}
port_value: {{ env "OTLP_COLLECTOR_PORT" }}
- name: xds_cluster
connect_timeout: 1s
type: {{ env "XDS_CLUSTER_TYPE" }}
Expand Down Expand Up @@ -145,21 +162,11 @@ admin:

tracing:
http:
name: envoy.tracers.dynamic_ot
name: envoy.tracers.opentelemetry
typed_config:
"@type": type.googleapis.com/envoy.config.trace.v3.DynamicOtConfig
library: /usr/local/lib/libjaegertracing_plugin.so
config:
service_name: {{ env "ENVOY_SERVICE_NAME" }}
sampler:
type: const
param: 1
reporter:
localAgentHostPort: {{ env "JAEGER_AGENT_HOST" }}:6831
headers:
jaegerDebugHeader: jaeger-debug-id
jaegerBaggageHeader: jaeger-baggage
traceBaggageHeaderPrefix: uberctx-
baggage_restrictions:
denyBaggageOnInitializationFailure: false
hostPort: ""
"@type": type.googleapis.com/envoy.config.trace.v3.OpenTelemetryConfig
grpc_service:
envoy_grpc:
cluster_name: opentelemetry_collector
timeout: 0.250s
service_name: {{ env "ENVOY_SERVICE_NAME" }}
2 changes: 1 addition & 1 deletion examples/test-deploy/templates/envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ spec:
env:
- name: ENVOY_SERVICE_NAME
value: "test-envoy-service"
- name: JAEGER_AGENT_HOST
- name: OTLP_COLLECTOR_HOST
valueFrom:
fieldRef:
apiVersion: v1
Expand Down

0 comments on commit 764ae32

Please sign in to comment.