Skip to content

Commit

Permalink
Stop duplicating otel data to Grafana Cloud (#178)
Browse files Browse the repository at this point in the history
* Remove Grafana otel tests

* Revert "feat: duplicate otel data to Grafana"

This reverts commit caee385.

* fix old typo
  • Loading branch information
madwort authored Jan 31, 2025
1 parent 86916ed commit 23e6328
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 92 deletions.
3 changes: 0 additions & 3 deletions services/otel-gateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ LABEL org.opencontainers.image.authors="[email protected]" \

# default config, can be overridden at runtime
ENV HONEYCOMB_ENDPOINT="https://api.honeycomb.io"
ENV GRAFANA_ENDPOINT="https://otlp-gateway-prod-gb-south-0.grafana.net/otlp"
ENV METRICS_DATASET="jobrunner-metrics"
ENV LOG_LEVEL="info"

# these must be provided at runtime
# ENV HONEYCOMB_KEY
# ENV BASIC_AUTH_USER
# ENV BASIC_AUTH_PASSWORD
# ENV GRAFANA_INSTANCE_ID
# ENV GRAFANA_API_TOKEN

COPY config.yaml /etc/otelcol-contrib/config.yaml
8 changes: 3 additions & 5 deletions services/otel-gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ traffic and basic auth.

### Integration Tests

You will need valid API keys for the development environment
You will need a valid API key for the development environment

```
export HONEYCOMB_KEY=...
export GRAFANA_INSTANCE_ID=...
export GRAFANA_API_TOKEN=...
just test-integration
```

This will print a link where you can go and view the data in the Honeycomb UI. It should also send data to Grafana.
This will print a link where you can go and view the data in the Honeycomb UI.


## Deploy to dokku
Expand Down Expand Up @@ -64,7 +62,7 @@ dokku proxy:ports-add otel-gateway https:443:4318
dokku letsencrypt:enable otel-gateway

# secrets
dokku config:set otel-gateway HONEYCOMB_KEY=... BASIC_AUTH_USER=... BASIC_AUTH_PASSWORD=... GRAFANA_INSTANCE_ID=... GRAFANA_API_TOKEN=...
dokku config:set otel-gateway HONEYCOMB_KEY=... BASIC_AUTH_USER=... BASIC_AUTH_PASSWORD=...

```

Expand Down
15 changes: 3 additions & 12 deletions services/otel-gateway/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ extensions:
htpasswd:
inline: |
${BASIC_AUTH_USER}:${BASIC_AUTH_PASSWORD}
basicauth/otlp:
client_auth:
username: ${GRAFANA_INSTANCE_ID}
password: ${GRAFANA_API_TOKEN}
receivers:
otlp:
Expand Down Expand Up @@ -38,22 +34,17 @@ exporters:
x-honeycomb-team: "${HONEYCOMB_KEY}"
x-honeycomb-dataset: "${METRICS_DATASET}"

otlphttp/grafana:
auth:
authenticator: basicauth/otlp
endpoint: "${GRAFANA_ENDPOINT}"

service:
telemetry:
logs:
level: "${LOG_LEVEL}"
extensions: [basicauth/server, basicauth/otlp]
extensions: [basicauth/server]
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp/traces, otlphttp/grafana, logging]
exporters: [otlphttp/traces, logging]
metrics:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp/metrics, otlphttp/grafana, logging]
exporters: [otlphttp/metrics, logging]
2 changes: 0 additions & 2 deletions services/otel-gateway/dotenv-sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
BASIC_AUTH_USER="test"
BASIC_AUTH_PASSWORD="test"
HONEYCOMB_KEY="testkey"
GRAFANA_INSTANCE_ID="012345"
GRAFANA_API_TOKEN="glc_aoeuhtnsqjkxbmwv1234567890="
32 changes: 3 additions & 29 deletions services/otel-gateway/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,17 @@ run *args: build
-e BASIC_AUTH_USER=$BASIC_AUTH_USER \
-e BASIC_AUTH_PASSWORD=$BASIC_AUTH_PASSWORD \
-e HONEYCOMB_KEY \
-e GRAFANA_INSTANCE_ID \
-e GRAFANA_API_TOKEN \
{{ args }} {{ IMAGE_NAME }}


# run integration test. You will need keys for Honeycomb & Grafana set in the environment
# run integration test. You will need a HONEYCOMB_KEY set in the environment
test-integration: venv
#!/bin/bash
set -euo pipefail

{{ just_executable() }} run -d -e LOG_LEVEL=debug -p 4318:4318
{{ just_executable() }} run-python tests.py
echo "Data sent to honeycomb and grafana"
echo "Data sent to honeycomb"
echo "https://ui.honeycomb.io/bennett-institute-for-applied-data-science/environments/development/datasets/otel-gateway-tests?query=%7B%22time_range%22%3A600%2C%22granularity%22%3A0%2C%22breakdowns%22%3A%5B%5D%2C%22calculations%22%3A%5B%5D%2C%22orders%22%3A%5B%5D%2C%22havings%22%3A%5B%5D%2C%22limit%22%3A100%7D"


Expand All @@ -53,40 +51,16 @@ _mock_honeycomb_start:
_mock_honeycomb_stop:
docker stop mock-honeycomb

_mock_grafana_start:
#!/bin/bash
set -euo pipefail

mkdir -p exported/grafana

# run a different instance of a collector as a test endpoint
docker rm --force mock-grafana 2>/dev/null || true
docker run -d -p 4320:4318 --name mock-grafana -u "$(id -u):$(id -g)" \
-v $PWD/mock-grafana-config.yaml:/etc/otelcol-contrib/config.yaml \
-v $PWD/exported/grafana:/exported \
-e GRAFANA_INSTANCE_ID \
-e GRAFANA_API_TOKEN \
otel/opentelemetry-collector-contrib:0.62.1

test "$(docker inspect mock-grafana -f '{{{{.State.Status}}')" == "running" || { docker logs mock-grafana; exit 1; }

_mock_grafana_stop:
docker stop mock-grafana

# run tests against mock upstream servers
test-ci: venv _mock_honeycomb_start _mock_grafana_start && _mock_honeycomb_stop _mock_grafana_stop
test-ci: venv _mock_honeycomb_start && _mock_honeycomb_stop
#!/bin/bash
set -euo pipefail

export HONEYCOMB_ENDPOINT="http://host.docker.internal:4319"
export GRAFANA_ENDPOINT="http://host.docker.internal:4320"

# run otel-gateway pointing at the test endpoint
{{ just_executable() }} run -d \
-e HONEYCOMB_ENDPOINT \
-e GRAFANA_ENDPOINT \
-e GRAFANA_INSTANCE_ID \
-e GRAFANA_API_TOKEN \
-e LOG_LEVEL=debug \
-p 4318:4318 \
--add-host=host.docker.internal:host-gateway
Expand Down
39 changes: 0 additions & 39 deletions services/otel-gateway/mock-grafana-config.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions services/otel-gateway/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
import pytest

trace_files = [
Path("exported/grafana/traces.json"),
Path("exported/honeycomb/traces.json"),
]
metric_files = [
Path("exported/grafana/metrics.json"),
Path("exported/honeycomb/metrics.json"),
]

Expand Down

0 comments on commit 23e6328

Please sign in to comment.