Skip to content

Commit 74ef9ad

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

33 files changed

+2261
-1253
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

.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ release:
3434
name_template: 'v{{ .Version }}'
3535
github:
3636
owner: robbert229
37-
name: jaeger-postgresql
37+
name: github.com/robbert229/jaeger-postgresql
3838

3939
# modelines, feel free to remove those if you don't want/use them:
4040
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json

Makefile

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

config-example.yaml

Lines changed: 0 additions & 3 deletions
This file was deleted.

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: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,65 @@
1-
module jaeger-postgresql
1+
module github.com/robbert229/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)