Skip to content

Commit dab60cd

Browse files
authored
Merge pull request #8 from database-playground/observability
2 parents ee06a89 + 7046036 commit dab60cd

7 files changed

Lines changed: 571 additions & 27 deletions

File tree

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,37 @@ curl --request GET \
9191
OK
9292
```
9393

94+
## Observability
95+
96+
SQL Runner exports its metrics at the API endpoint `/metrics`.
97+
98+
It supports configuring OpenTelemetry (tracing and logging) using the following environment variables: <https://opentelemetry.io/docs/languages/sdk-configuration/general/>
99+
100+
Here are some useful variables:
101+
102+
- `OTEL_SERVICE_NAME`: Specify the name of this service (e.g., `sqlrunner-replica-1`).
103+
- `OTEL_TRACES_EXPORTER`: Specify where the traces should be exported.
104+
- Supported values: `console`, `otlp`
105+
- Default: `console`
106+
- `OTEL_LOGS_EXPORTER`: Specify where the logs should be exported.
107+
- Supported values: `console`, `otlp`
108+
- Default: `console`
109+
- `OTEL_EXPORTER_OTLP_PROTOCOL`: Specify the default protocol for OTLP.
110+
- Supported values: `grpc`, `http/protobuf`
111+
- Default: `grpc`
112+
- `OTEL_EXPORTER_OTLP_ENDPOINT`: Specify the default endpoint for OTLP.
113+
- Example: `http://otlp-collector:4317`
114+
- `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL`: Specify the default protocol for OTLP trace data.
115+
- Supported values: `grpc`, `http/protobuf`
116+
- Default: falls back to `OTEL_EXPORTER_OTLP_PROTOCOL`
117+
- `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT`: Specify the default endpoint for OTLP trace data.
118+
- Example: `http://victoriatraces:10428/insert/opentelemetry/v1/traces`
119+
- `OTEL_EXPORTER_OTLP_LOGS_PROTOCOL`: Specify the default protocol for OTLP log data.
120+
- Supported values: `grpc`, `http/protobuf`
121+
- Default: falls back to `OTEL_EXPORTER_OTLP_PROTOCOL`
122+
- `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT`: Specify the default endpoint for OTLP log data.
123+
- Example: `http://victorialogs:9428/insert/opentelemetry/v1/logs`
124+
94125
## License
95126

96127
Apache-2.0. See [LICENSE](LICENSE) for details.

go.mod

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,77 @@ module github.com/database-playground/sqlrunner
22

33
go 1.25
44

5-
require modernc.org/sqlite v1.41.0
5+
require (
6+
github.com/Depado/ginprom v1.8.2
7+
github.com/gin-gonic/gin v1.11.0
8+
go.opentelemetry.io/contrib/bridges/otelslog v0.14.0
9+
go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.64.0
10+
go.opentelemetry.io/otel v1.39.0
11+
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.15.0
12+
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.15.0
13+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0
14+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.39.0
15+
go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.15.0
16+
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.39.0
17+
go.opentelemetry.io/otel/log v0.15.0
18+
go.opentelemetry.io/otel/sdk v1.39.0
19+
go.opentelemetry.io/otel/sdk/log v0.15.0
20+
modernc.org/sqlite v1.41.0
21+
)
622

723
require (
24+
github.com/beorn7/perks v1.0.1 // indirect
25+
github.com/bytedance/gopkg v0.1.3 // indirect
26+
github.com/bytedance/sonic v1.14.2 // indirect
27+
github.com/bytedance/sonic/loader v0.4.0 // indirect
28+
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
29+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
30+
github.com/cloudwego/base64x v0.1.6 // indirect
831
github.com/davecgh/go-spew v1.1.1 // indirect
32+
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
33+
github.com/gin-contrib/sse v1.1.0 // indirect
34+
github.com/go-logr/logr v1.4.3 // indirect
35+
github.com/go-logr/stdr v1.2.2 // indirect
36+
github.com/go-playground/locales v0.14.1 // indirect
37+
github.com/go-playground/universal-translator v0.18.1 // indirect
38+
github.com/go-playground/validator/v10 v10.30.1 // indirect
39+
github.com/goccy/go-json v0.10.5 // indirect
40+
github.com/goccy/go-yaml v1.19.1 // indirect
941
github.com/google/go-cmp v0.7.0 // indirect
42+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 // indirect
43+
github.com/json-iterator/go v1.1.12 // indirect
44+
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
45+
github.com/leodido/go-urn v1.4.0 // indirect
46+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
47+
github.com/modern-go/reflect2 v1.0.2 // indirect
48+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
49+
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
1050
github.com/pmezard/go-difflib v1.0.0 // indirect
51+
github.com/prometheus/client_golang v1.23.2 // indirect
52+
github.com/prometheus/client_model v0.6.2 // indirect
53+
github.com/prometheus/common v0.67.4 // indirect
54+
github.com/prometheus/procfs v0.19.2 // indirect
55+
github.com/quic-go/qpack v0.6.0 // indirect
56+
github.com/quic-go/quic-go v0.58.0 // indirect
57+
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
58+
github.com/ugorji/go/codec v1.3.1 // indirect
59+
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
60+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0 // indirect
61+
go.opentelemetry.io/otel/metric v1.39.0 // indirect
62+
go.opentelemetry.io/otel/trace v1.39.0 // indirect
63+
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
64+
go.yaml.in/yaml/v2 v2.4.3 // indirect
65+
golang.org/x/arch v0.23.0 // indirect
66+
golang.org/x/crypto v0.46.0 // indirect
1167
golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 // indirect
1268
golang.org/x/mod v0.31.0 // indirect
69+
golang.org/x/net v0.48.0 // indirect
70+
golang.org/x/text v0.32.0 // indirect
1371
golang.org/x/tools v0.40.0 // indirect
72+
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
73+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
74+
google.golang.org/grpc v1.77.0 // indirect
75+
google.golang.org/protobuf v1.36.11 // indirect
1476
gopkg.in/yaml.v3 v3.0.1 // indirect
1577
mvdan.cc/gofumpt v0.9.1 // indirect
1678
)

0 commit comments

Comments
 (0)