Skip to content

Commit

Permalink
updating sumo logic example (#3962)
Browse files Browse the repository at this point in the history
  • Loading branch information
xoscar committed Aug 13, 2024
1 parent 7b34bb0 commit 058c76f
Show file tree
Hide file tree
Showing 11 changed files with 132 additions and 410 deletions.

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions examples/quick-start-sumologic-nodejs/.env.template
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
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>"

# https://help.sumologic.com/docs/manage/security/installation-tokens/
SUMOLOGIC_INSTALLATION_TOKEN="<YOUR_SUMOLOGIC_INSTALLATION_TOKEN>"

# https://help.sumologic.com/docs/manage/security/access-keys/#create-an-access-key
SUMO_LOGIC_ACCESS_ID="<YOUR_SUMO_LOGIC_ACCESS_ID>"
SUMO_LOGIC_ACCESS_KEY="<YOUR_SUMO_LOGIC_ACCESS_KEY>"
1 change: 1 addition & 0 deletions examples/quick-start-sumologic-nodejs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.DS_Store
.env
resources/datastore.yaml
11 changes: 11 additions & 0 deletions examples/quick-start-sumologic-nodejs/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"]
46 changes: 44 additions & 2 deletions examples/quick-start-sumologic-nodejs/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ services:
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel-collector:4317
# HTTP
# - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel-collector:4318/v1/traces
depends_on:
otel-collector:
condition: service_started

otel-collector:
image: public.ecr.aws/sumologic/sumologic-otel-collector:0.75.0-sumo-0
Expand All @@ -23,5 +26,44 @@ services:
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}
# 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}
SUMO_LOGIC_ACCESS_ID: ${SUMO_LOGIC_ACCESS_ID}
SUMO_LOGIC_ACCESS_KEY: ${SUMO_LOGIC_ACCESS_KEY}
entrypoint:
- bash
- /resources/apply.sh
networks:
default: null
depends_on:
app:
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#!/bin/sh

set -e

TOKEN=$TRACETEST_TOKEN
ENVIRONMENT_ID=$TRACETEST_ENVIRONMENT_ID
ACCESS_ID=$SUMO_LOGIC_ACCESS_ID
ACCESS_KEY=$SUMO_LOGIC_ACCESS_KEY

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

echo "
---
type: DataStore
spec:
Expand All @@ -12,5 +26,13 @@ spec:
# Create your ID and Key under Administration > Security > Access Keys
# in your Sumo Logic account:
# https://help.sumologic.com/docs/manage/security/access-keys/#create-your-access-key
accessID: "your-access-id"
accessKey: "your-access-key"
accessID: ${ACCESS_ID}
accessKey: ${ACCESS_KEY}
" > /resources/datastore.yaml

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

apply
16 changes: 16 additions & 0 deletions examples/quick-start-sumologic-nodejs/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

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 058c76f

Please sign in to comment.