Skip to content

The only tool you need to know what is happening and how to fix it.

client testing

ddux9993ce1f49be
diff --git a/clients/go-client/devtesting/devtesting.go b/clients/go-client/devtesting/devtesting.go
index e9dc5fcf..3f5e49a6 100644
--- a/clients/go-client/devtesting/devtesting.go
+++ b/clients/go-client/devtesting/devtesting.go
@@ -3,6 +3,7 @@ package main
import (
"errors"
"math/rand/v2"
+ "os"
"time"
"traceway"
tracewaygin "traceway/traceway_gin"
@@ -15,11 +16,15 @@ func main() {
}
func testGin() {
+ endpoint := os.Getenv("TRACEWAY_ENDPOINT")
+ if endpoint == "" {
+ endpoint = "default_token_change_me@http://localhost:8082/api/report"
+ }
router := gin.Default()
router.Use(tracewaygin.New(
- "default_token_change_me@http://localhost:8082/api/report",
+ endpoint,
traceway.WithDebug(true),
))
diff --git a/testing/go-client-gin/Dockerfile b/testing/go-client-gin/Dockerfile
new file mode 100644
index 00000000..c9dd9cc1
--- /dev/null
+++ b/testing/go-client-gin/Dockerfile
@@ -0,0 +1,11 @@
+FROM golang:1.25-alpine
+
+RUN apk add --no-cache git
+
+WORKDIR /app/devtesting
+
+# Default endpoint for macOS (host.docker.internal reaches the Mac host)
+# Override with -e TRACEWAY_ENDPOINT=... for different setups
+ENV TRACEWAY_ENDPOINT="default_token_change_me@http://host.docker.internal:8082/api/report"
+
+CMD ["tail", "-f", "/dev/null"]
diff --git a/testing/go-client-gin/docker.md b/testing/go-client-gin/docker.md
new file mode 100644
index 00000000..543ebbee
--- /dev/null
+++ b/testing/go-client-gin/docker.md
@@ -0,0 +1,70 @@
+# Go Client Gin Testing Container
+
+Docker setup for testing the Traceway Go client SDK with the devtesting Gin application.
+
+## Prerequisites
+
+- Backend running on port 8082 (e.g., `go run .` in backend folder, or another container)
+- Docker installed
+
+## Build
+
+```bash
+docker build -t traceway-go-client-test ./testing/go-client-gin
+```
+
+## Run
+
+```bash
+docker run -d \
+ --name go-client-test \
+ -v $(pwd)/clients/go-client:/app \
+ traceway-go-client-test
+```
+
+The Dockerfile sets `TRACEWAY_ENDPOINT` to use `host.docker.internal:8082` by default, which reaches services running on your Mac.
+
+## Usage
+
+Exec into the container:
+
+```bash
+docker exec -it go-client-test sh
+```
+
+Run the devtesting server:
+
+```bash
+go run .
+```
+
+The server will start and connect to the backend at `host.docker.internal:8082/api/report`.
+
+## Custom Endpoint
+
+Override the endpoint if needed:
+
+```bash
+docker run -d \
+ --name go-client-test \
+ -e TRACEWAY_ENDPOINT="your_token@http://your-host:8082/api/report" \
+ -v $(pwd)/clients/go-client:/app \
+ traceway-go-client-test
+```
+
+## Test Endpoints
+
+Once running, test the SDK with these endpoints (from your Mac):
+
+```bash
+curl http://localhost:8080/test-ok
+curl http://localhost:8080/test-not-found
+curl http://localhost:8080/test-exception
+curl http://localhost:8080/test-segments
+```
+
+## Cleanup
+
+```bash
+docker stop go-client-test && docker rm go-client-test
+```