-
Notifications
You must be signed in to change notification settings - Fork 198
feat: MCP integration for AI tools #1156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
44540db
feat: MCP integration for AI tools (#1091)
zeitlinger d5f8184
style: fix shfmt and line-length lint failures
zeitlinger 382c35c
merge: resolve conflict in run-otelcol.sh
zeitlinger 225a452
address review comments on MCP integration
zeitlinger 69a55ba
fix: only delete bootstrap-managed SA token on restart
zeitlinger a63c766
style: fix markdown list style and shellcheck warning
zeitlinger aeff707
address review comments: env var overrides, style fixes, doc improvem…
zeitlinger 3b64d3c
fix: re-enable SC1091 after source
zeitlinger c19471a
fix: use GF_SECURITY_ADMIN_USER/PASSWORD for SA token creation
zeitlinger bc65cc8
fix: inline shellcheck disable for source
zeitlinger 80d5bd2
fix: introduce GRAFANA_PUBLIC_URL var for client-facing MCP config
zeitlinger 4393740
fix: restrict /etc/lgtm permissions, fix docs URL version prefix
zeitlinger e861ec2
fix: lint — shellcheck directive before source, split long line
zeitlinger 871332e
fix: pipe at end of line for linter
zeitlinger 2bc13fe
fix: unify pipeline overlay generation, drop static debug config
zeitlinger dd27848
test: add bats unit tests for run-otelcol.sh config generation
zeitlinger a7a212c
chore: remove unnecessary Renovate annotation from bats tool entry
zeitlinger 5cc8f92
ci: run unit tests in lint workflow
zeitlinger 67344d6
ci: add 'ci' task depending on lint and unit tests
zeitlinger 96c5963
Merge branch 'main' into mcp-integration
zeitlinger fbd73ff
fix: shellcheck bats tests and update flint to v0.9.2
zeitlinger ae02003
fix: OATS brittleness, clarify MCP doc wording, add --init for signal…
zeitlinger a2ea1b7
fix: simplify docs version ref, add kubectl exec to README
zeitlinger 6669518
fix: forward OTEL_COLLECTOR_DEBUG_EXPORTER to container; DRY up SA URL
zeitlinger 01e8b8c
fix: add port 3200 to k8s port-forward; quote args in claude-mcp-setu…
zeitlinger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| #!/usr/bin/env bats | ||
| # shellcheck disable=SC2030,SC2031 # export in @bats test is intentionally local | ||
| bats_require_minimum_version 1.5.0 | ||
| # Tests for run-otelcol.sh config generation logic. | ||
| # The script is run in a temp dir with a stub logging.sh so that | ||
| # run_with_logging records its args without exec-ing the real binary. | ||
|
|
||
| setup() { | ||
| TESTDIR=$(mktemp -d) | ||
|
|
||
| # Stub logging.sh: record otelcol args to a file instead of exec-ing. | ||
| cat >"$TESTDIR/logging.sh" <<EOF | ||
| run_with_logging() { | ||
| shift 2 # skip name and envvar args | ||
| printf '%s\n' "\$@" >"$TESTDIR/otelcol-invocation" | ||
| } | ||
| EOF | ||
|
|
||
| cp "$BATS_TEST_DIRNAME/run-otelcol.sh" "$TESTDIR/" | ||
|
|
||
| export OPENTELEMETRY_COLLECTOR_VERSION="test" | ||
| unset OTEL_EXPORTER_OTLP_ENDPOINT \ | ||
| OTEL_EXPORTER_OTLP_TRACES_ENDPOINT \ | ||
| OTEL_EXPORTER_OTLP_METRICS_ENDPOINT \ | ||
| OTEL_EXPORTER_OTLP_LOGS_ENDPOINT \ | ||
| OTEL_EXPORTER_OTLP_HEADERS \ | ||
| OTEL_COLLECTOR_DEBUG_EXPORTER \ | ||
| OTELCOL_EXTRA_ARGS 2>/dev/null || true | ||
| } | ||
|
|
||
| teardown() { | ||
| rm -rf "$TESTDIR" | ||
| } | ||
|
|
||
| run_otelcol() { | ||
| cd "$TESTDIR" && bash run-otelcol.sh | ||
| } | ||
|
|
||
| # --- no flags --- | ||
|
|
||
| @test "no flags: no overlay config generated" { | ||
| run run_otelcol | ||
| [ "$status" -eq 0 ] | ||
| [ ! -f "$TESTDIR/otelcol-config-export-http.yaml" ] | ||
| } | ||
|
|
||
| @test "no flags: otelcol started with only base config" { | ||
| run run_otelcol | ||
| [ "$status" -eq 0 ] | ||
| grep -q -- "--config=file:./otelcol-config.yaml" "$TESTDIR/otelcol-invocation" | ||
| run ! grep -q "otelcol-config-export-http" "$TESTDIR/otelcol-invocation" | ||
|
zeitlinger marked this conversation as resolved.
|
||
| } | ||
|
|
||
| # --- debug only --- | ||
|
|
||
| @test "debug only: overlay generated" { | ||
| export OTEL_COLLECTOR_DEBUG_EXPORTER=true | ||
| run run_otelcol | ||
| [ "$status" -eq 0 ] | ||
| [ -f "$TESTDIR/otelcol-config-export-http.yaml" ] | ||
| } | ||
|
|
||
| @test "debug only: overlay has debug exporters for all signals" { | ||
| export OTEL_COLLECTOR_DEBUG_EXPORTER=true | ||
| run run_otelcol | ||
| grep -q "debug/traces" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| grep -q "debug/metrics" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| grep -q "debug/logs" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| } | ||
|
|
||
| @test "debug only: overlay has no external exporters" { | ||
| export OTEL_COLLECTOR_DEBUG_EXPORTER=true | ||
| run run_otelcol | ||
| run ! grep -q "otlphttp/external" "$TESTDIR/otelcol-config-export-http.yaml" | ||
|
zeitlinger marked this conversation as resolved.
|
||
| } | ||
|
zeitlinger marked this conversation as resolved.
|
||
|
|
||
| @test "debug only: overlay passed to otelcol" { | ||
| export OTEL_COLLECTOR_DEBUG_EXPORTER=true | ||
| run run_otelcol | ||
| grep -q "otelcol-config-export-http" "$TESTDIR/otelcol-invocation" | ||
| } | ||
|
|
||
| # --- external only (shared endpoint) --- | ||
|
|
||
| @test "external only: overlay has external exporters for all signals" { | ||
| export OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4318 | ||
| run run_otelcol | ||
| grep -q "otlphttp/external-traces" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| grep -q "otlphttp/external-metrics" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| grep -q "otlphttp/external-logs" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| } | ||
|
|
||
| @test "external only: overlay has no debug exporters" { | ||
| export OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4318 | ||
| run run_otelcol | ||
| run ! grep -q "debug/" "$TESTDIR/otelcol-config-export-http.yaml" | ||
|
zeitlinger marked this conversation as resolved.
|
||
| } | ||
|
zeitlinger marked this conversation as resolved.
zeitlinger marked this conversation as resolved.
|
||
|
|
||
| # --- per-signal external endpoints --- | ||
|
|
||
| @test "per-signal: only configured signals get external exporter" { | ||
| export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://tempo:4318 | ||
| run run_otelcol | ||
| grep -q "otlphttp/external-traces" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| run ! grep -q "otlphttp/external-metrics" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| run ! grep -q "otlphttp/external-logs" "$TESTDIR/otelcol-config-export-http.yaml" | ||
|
zeitlinger marked this conversation as resolved.
|
||
| } | ||
|
zeitlinger marked this conversation as resolved.
|
||
|
|
||
| # --- both debug and external --- | ||
|
|
||
| @test "both: overlay has debug and external exporters for all signals" { | ||
| export OTEL_COLLECTOR_DEBUG_EXPORTER=true | ||
| export OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4318 | ||
| run run_otelcol | ||
| grep -q "debug/traces" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| grep -q "debug/metrics" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| grep -q "debug/logs" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| grep -q "otlphttp/external-traces" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| grep -q "otlphttp/external-metrics" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| grep -q "otlphttp/external-logs" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| } | ||
|
|
||
| @test "both: only one overlay config passed to otelcol" { | ||
| export OTEL_COLLECTOR_DEBUG_EXPORTER=true | ||
| export OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4318 | ||
| run run_otelcol | ||
| count=$(grep -c "otelcol-config-export-http" "$TESTDIR/otelcol-invocation") | ||
| [ "$count" -eq 1 ] | ||
| } | ||
|
|
||
| # --- headers --- | ||
|
|
||
| @test "headers: added to external endpoints in overlay" { | ||
| export OTEL_EXPORTER_OTLP_ENDPOINT=http://collector:4318 | ||
| export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer token123" | ||
| run run_otelcol | ||
| grep -q "headers:" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| grep -q "Authorization" "$TESTDIR/otelcol-config-export-http.yaml" | ||
| } | ||
|
|
||
| @test "headers: not applied when debug only (no external endpoints)" { | ||
| export OTEL_COLLECTOR_DEBUG_EXPORTER=true | ||
| export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer token123" | ||
| run run_otelcol | ||
| run ! grep -q "headers:" "$TESTDIR/otelcol-config-export-http.yaml" | ||
|
zeitlinger marked this conversation as resolved.
|
||
| } | ||
|
zeitlinger marked this conversation as resolved.
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.