Skip to content

Commit 31005e0

Browse files
committed
feat: rewrote to use pgx and support modern versions of jaeger
1 parent 39aad71 commit 31005e0

26 files changed

+2013
-1052
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@
1313

1414
# Dependency directories (remove the comment below to include it)
1515
# vendor/
16+
17+
jaeger/
18+
jaeger-all-in-one
19+
jaeger-postgresql

Makefile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
DBSTRING=postgres://postgres:password@localhost:5432/jaeger
2+
JAEGER_VERSION=1.54.0
3+
4+
.PHONY: install-all-in-one
5+
install-all-in-one:
6+
wget https://github.com/jaegertracing/jaeger/releases/download/v$(JAEGER_VERSION)/jaeger-$(JAEGER_VERSION)-linux-amd64.tar.gz -P ./hack/
7+
tar -C ./hack --extract --file ./hack/jaeger-$(JAEGER_VERSION)-linux-amd64.tar.gz jaeger-$(JAEGER_VERSION)-linux-amd64/jaeger-all-in-one
8+
rm ./hack/jaeger-$(JAEGER_VERSION)-linux-amd64.tar.gz
9+
mv ./hack/jaeger-$(JAEGER_VERSION)-linux-amd64/jaeger-all-in-one ./hack/jaeger-all-in-one
10+
rmdir ./hack/jaeger-$(JAEGER_VERSION)-linux-amd64/
11+
12+
.PHONY: dev
13+
dev:
14+
./hack/jaeger-all-in-one
15+
16+
# Install DB migration tool
17+
.PHONY: install-goose
18+
install-goose:
19+
@sh -c "which goose > /dev/null || go install github.com/pressly/goose/v3/cmd/goose@latest"
20+
21+
.PHONY: install-sqlc
22+
install-sqlc:
23+
@sh -c "which sqlc > /dev/null || go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest"
24+
25+
# Migrate SQL schema to latest version
26+
.PHONY: migrate
27+
migrate: install-goose
28+
GOOSE_DBSTRING=$(DBSTRING) GOOSE_DRIVER=postgres goose -dir ./internal/sql/migrations up
29+
30+
# Redo SQL schema migration
31+
.PHONY: migrate-redo
32+
migrate-redo: install-goose
33+
GOOSE_DBSTRING=$(DBSTRING) GOOSE_DRIVER=postgres goose -dir ./internal/sql/migrations redo
34+
35+
# Rollback SQL schema by one version
36+
.PHONY: migrate-down
37+
migrate-down: install-goose
38+
GOOSE_DBSTRING=$(DBSTRING) GOOSE_DRIVER=postgres goose -dir ./internal/sql/migrations down
39+
40+
# Get SQL schema migration status
41+
.PHONY: migrate-status
42+
migrate-status: install-goose
43+
GOOSE_DBSTRING=$(DBSTRING) GOOSE_DRIVER=postgres goose -dir ./internal/sql/migrations status
44+
45+
46+
.PHONY: dev
47+
dev:
48+
go build .
49+
SPAN_STORAGE_TYPE="grpc-plugin" GRPC_STORAGE_PLUGIN_BINARY=./jaeger-postgresql GRPC_STORAGE_PLUGIN_CONFIGURATION_FILE=./hack/jaeger-postgresql.yaml ./jaeger-all-in-one

docker-compose.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: "3"
2+
services:
3+
postgres:
4+
container_name: postgres
5+
image: postgres:15
6+
environment:
7+
- POSTGRES_PASSWORD=password
8+
restart: always
9+
ports:
10+
- "5432:5432"
11+
volumes:
12+
- pgdata:/var/lib/postgresql/data
13+
volumes:
14+
pgdata:
15+
external: true

go.mod

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,65 @@
11
module jaeger-postgresql
22

3-
go 1.12
3+
go 1.21
44

55
require (
6-
github.com/go-pg/pg/v9 v9.2.0
7-
github.com/gogo/googleapis v1.2.0 // indirect
8-
github.com/hashicorp/go-hclog v0.9.0
9-
github.com/jaegertracing/jaeger v1.17.1
10-
github.com/spf13/viper v1.6.2
6+
github.com/hashicorp/go-hclog v1.6.2
7+
github.com/jackc/pgx/v5 v5.5.4
8+
github.com/jaegertracing/jaeger v1.54.0
9+
github.com/pressly/goose/v3 v3.18.0
10+
github.com/stretchr/testify v1.9.0
11+
)
12+
13+
require (
14+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
15+
github.com/fatih/color v1.14.1 // indirect
16+
github.com/fsnotify/fsnotify v1.7.0 // indirect
17+
github.com/go-logr/logr v1.4.1 // indirect
18+
github.com/go-logr/stdr v1.2.2 // indirect
19+
github.com/gogo/protobuf v1.3.2 // indirect
20+
github.com/golang/protobuf v1.5.3 // indirect
21+
github.com/hashicorp/go-plugin v1.6.0 // indirect
22+
github.com/hashicorp/hcl v1.0.0 // indirect
23+
github.com/hashicorp/yamux v0.1.1 // indirect
24+
github.com/jackc/pgpassfile v1.0.0 // indirect
25+
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
26+
github.com/jackc/puddle/v2 v2.2.1 // indirect
27+
github.com/kr/pretty v0.3.1 // indirect
28+
github.com/kr/text v0.2.0 // indirect
29+
github.com/magiconair/properties v1.8.7 // indirect
30+
github.com/mattn/go-colorable v0.1.13 // indirect
31+
github.com/mattn/go-isatty v0.0.20 // indirect
32+
github.com/mfridman/interpolate v0.0.2 // indirect
33+
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
34+
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c // indirect
35+
github.com/oklog/run v1.1.0 // indirect
36+
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
37+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
38+
github.com/rogpeppe/go-internal v1.11.0 // indirect
39+
github.com/sagikazarmark/locafero v0.4.0 // indirect
40+
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
41+
github.com/sethvargo/go-retry v0.2.4 // indirect
42+
github.com/sourcegraph/conc v0.3.0 // indirect
43+
github.com/spf13/afero v1.11.0 // indirect
44+
github.com/spf13/cast v1.6.0 // indirect
45+
github.com/spf13/pflag v1.0.5 // indirect
46+
github.com/spf13/viper v1.18.2 // indirect
47+
github.com/subosito/gotenv v1.6.0 // indirect
48+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect
49+
go.opentelemetry.io/otel v1.22.0 // indirect
50+
go.opentelemetry.io/otel/metric v1.22.0 // indirect
51+
go.opentelemetry.io/otel/trace v1.22.0 // indirect
52+
go.uber.org/multierr v1.11.0 // indirect
53+
go.uber.org/zap v1.26.0 // indirect
54+
golang.org/x/crypto v0.18.0 // indirect
55+
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc // indirect
56+
golang.org/x/net v0.20.0 // indirect
57+
golang.org/x/sync v0.6.0 // indirect
58+
golang.org/x/sys v0.16.0 // indirect
59+
golang.org/x/text v0.14.0 // indirect
60+
google.golang.org/genproto/googleapis/rpc v0.0.0-20231127180814-3a041ad873d4 // indirect
61+
google.golang.org/grpc v1.61.0 // indirect
62+
google.golang.org/protobuf v1.32.0 // indirect
63+
gopkg.in/ini.v1 v1.67.0 // indirect
64+
gopkg.in/yaml.v3 v3.0.1 // indirect
1165
)

0 commit comments

Comments
 (0)