Skip to content

Commit

Permalink
chore(examples/recipes): Updating Kafka Example/Reciple (#3970)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoscar authored Aug 15, 2024
1 parent 182c468 commit fd0d364
Show file tree
Hide file tree
Showing 13 changed files with 155 additions and 575 deletions.

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions examples/quick-start-go-and-kafka/.env.template
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
TRACETEST_API_KEY="<YOUR_TRACETEST_API_KEY>"
TRACETEST_API_TOKEN="<YOUR_TRACETEST_TOKEN>"
# Get the required information here: https://app.tracetest.io/retrieve-token

TRACETEST_TOKEN="<YOUR_TRACETEST_TOKEN>"
TRACETEST_ENVIRONMENT_ID="<YOUR_ENV_ID>"
11 changes: 11 additions & 0 deletions examples/quick-start-go-and-kafka/Dockerfile.tracetest
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM alpine

WORKDIR /app
ARG TRACETEST_IMAGE_VERSION=v1.4.0

RUN apk --update add bash jq curl
RUN curl -L https://raw.githubusercontent.com/kubeshop/tracetest/main/install-cli.sh | bash -s -- $TRACETEST_IMAGE_VERSION

WORKDIR /resources

ENTRYPOINT ["echo", "Tracetest CLI installed"]
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ service:
traces/1:
receivers: [otlp]
processors: [batch]
exporters: [otlp/jaeger]
exporters: [logging, otlp/jaeger]
130 changes: 0 additions & 130 deletions examples/quick-start-go-and-kafka/docker-compose.core.yaml

This file was deleted.

57 changes: 48 additions & 9 deletions examples/quick-start-go-and-kafka/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,13 @@ services:
ports:
- 29092:29092

# Cloud-based Managed Tracetest
tracetest-agent:
image: kubeshop/tracetest-agent:latest
environment:
# Find the Agent API Key here: https://docs.tracetest.io/configuration/agent
- TRACETEST_API_KEY=${TRACETEST_API_KEY}

otel-collector:
image: otel/opentelemetry-collector-contrib:0.59.0
image: otel/opentelemetry-collector-contrib:0.100.0
command:
- "--config"
- "/otel-local-config.yaml"
volumes:
- ./tracetest/collector.config.yaml:/otel-local-config.yaml
- ./collector.config.yaml:/otel-local-config.yaml
ports:
- 4317:4317
depends_on:
Expand All @@ -94,3 +87,49 @@ services:
interval: 1s
timeout: 3s
retries: 60

# Cloud-based Managed Tracetest
tracetest-agent:
image: kubeshop/tracetest-agent:latest
environment:
# Get the required information here: https://app.tracetest.io/retrieve-token
- TRACETEST_API_KEY=${TRACETEST_TOKEN}
- TRACETEST_ENVIRONMENT_ID=${TRACETEST_ENVIRONMENT_ID}

tracetest-apply:
build:
dockerfile: Dockerfile.tracetest
volumes:
- ./resources:/resources
environment:
TRACETEST_TOKEN: ${TRACETEST_TOKEN}
TRACETEST_ENVIRONMENT_ID: ${TRACETEST_ENVIRONMENT_ID}
entrypoint:
- bash
- /resources/apply.sh
networks:
default: null
depends_on:
producer-api:
condition: service_started
consumer-worker:
condition: service_started
tracetest-agent:
condition: service_started

tracetest-run:
build:
dockerfile: Dockerfile.tracetest
volumes:
- ./resources:/resources
environment:
TRACETEST_TOKEN: ${TRACETEST_TOKEN}
TRACETEST_ENVIRONMENT_ID: ${TRACETEST_ENVIRONMENT_ID}
entrypoint:
- bash
- /resources/run.sh
networks:
default: null
depends_on:
tracetest-apply:
condition: service_completed_successfully
17 changes: 17 additions & 0 deletions examples/quick-start-go-and-kafka/resources/apply.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

set -e

TOKEN=$TRACETEST_TOKEN
ENVIRONMENT_ID=$TRACETEST_ENVIRONMENT_ID

apply() {
echo "Configuring TraceTest"
tracetest configure --token $TOKEN --environment $ENVIRONMENT_ID

echo "Applying Resources"
tracetest apply datastore -f /resources/datastore.yaml
tracetest apply test -f /resources/test.yaml
}

apply
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
type: DataStore
spec:
name: Jaeger
id: current
name: jaeger
type: jaeger
default: true
jaeger:
endpoint: jaeger:16685
headers:
"": ""
tls:
insecure: true
16 changes: 16 additions & 0 deletions examples/quick-start-go-and-kafka/resources/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

set -e

TOKEN=$TRACETEST_TOKEN
ENVIRONMENT_ID=$TRACETEST_ENVIRONMENT_ID

run() {
echo "Configuring Tracetest"
tracetest configure --token $TOKEN --environment $ENVIRONMENT_ID

echo "Running Trace-Based Tests..."
tracetest run test -f /resources/test.yaml
}

run
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ spec:
name: It processed a message from Kafka
assertions:
- attr:tracetest.selected_spans.count = 1

This file was deleted.

This file was deleted.

0 comments on commit fd0d364

Please sign in to comment.