Skip to content

Commit e1ce61f

Browse files
lpcoxCopilot
andcommitted
Document test-race target and OpenTelemetry env vars
- Add make test-race to the Running Tests section in CONTRIBUTING.md with a Race Detection Tests subsection explaining its importance for concurrent server code - Add OpenTelemetry / Tracing Variables section to docs/ENVIRONMENT_VARIABLES.md documenting OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_SERVICE_NAME env vars Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 04e132d commit e1ce61f

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,13 +462,28 @@ make test-integration
462462
# Run all tests (unit + integration)
463463
make test-all
464464

465+
# Run unit tests with race detection
466+
make test-race
467+
465468
# Run unit tests with coverage
466469
make coverage
467470

468471
# Run specific package tests
469472
go test ./internal/server/...
470473
```
471474

475+
#### Race Detection Tests
476+
477+
The MCP Gateway is a concurrent HTTP server, so race detection is especially
478+
important when modifying server, launcher, or guard code:
479+
480+
```bash
481+
make test-race
482+
```
483+
484+
This runs `go test -race` across all internal packages to catch data races in
485+
concurrent code paths.
486+
472487
### Writing Tests
473488

474489
- Place tests in `*_test.go` files alongside the code

docs/ENVIRONMENT_VARIABLES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,12 @@ These environment variables configure guard policies (e.g., AllowOnly policies f
8181
| `MCP_GATEWAY_ALLOWONLY_SCOPE_OWNER` | AllowOnly owner scope value (sets default for `--allowonly-scope-owner`) | (disabled) |
8282
| `MCP_GATEWAY_ALLOWONLY_SCOPE_REPO` | AllowOnly repo name (requires owner) (sets default for `--allowonly-scope-repo`) | (disabled) |
8383
| `MCP_GATEWAY_ALLOWONLY_MIN_INTEGRITY` | AllowOnly integrity level: `none`, `unapproved`, `approved`, `merged` (sets default for `--allowonly-min-integrity`) | (disabled) |
84+
85+
## OpenTelemetry / Tracing Variables
86+
87+
These standard OpenTelemetry environment variables set defaults for the corresponding `--otlp-*` CLI flags:
88+
89+
| Variable | Description | Default |
90+
|----------|-------------|---------|
91+
| `OTEL_EXPORTER_OTLP_ENDPOINT` | OTLP HTTP endpoint for trace export (e.g., `http://localhost:4318`). Tracing is disabled when empty. Sets default for `--otlp-endpoint`. | (disabled) |
92+
| `OTEL_SERVICE_NAME` | Service name reported in traces. Sets default for `--otlp-service-name`. | `mcp-gateway` |

0 commit comments

Comments
 (0)