From e95f741820672be5935357ce25fbe48ba8ef8976 Mon Sep 17 00:00:00 2001 From: William Perron Date: Fri, 9 Feb 2024 18:47:55 -0500 Subject: [PATCH] bump sqliteexporter dependency and improve error handling for init tracing --- cmd/themis-server/main.go | 9 ++++++--- go.mod | 2 +- go.sum | 8 ++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cmd/themis-server/main.go b/cmd/themis-server/main.go index e7769f4..71a8b9a 100644 --- a/cmd/themis-server/main.go +++ b/cmd/themis-server/main.go @@ -92,7 +92,9 @@ func main() { } defer store.Close() - initTracing(db) + if err := initTracing(db); err != nil { + log.Fatal().Err(err).Msg("failed to initialize tracing") + } notifChan := make(chan struct{}) notifier := themis.NewNotifier(notifChan) @@ -1017,7 +1019,7 @@ func parseCustomIDState(qs string) (url.Values, error) { return v, nil } -func initTracing(db *sql.DB) { +func initTracing(db *sql.DB) error { res, err := resource.New(context.TODO(), resource.WithHost(), resource.WithOS(), @@ -1028,7 +1030,7 @@ func initTracing(db *sql.DB) { ex, err := sqliteexporter.NewSqliteSDKTraceExporterWithDB(db) if err != nil { - panic("not implemented") + return fmt.Errorf("failed to create span exporter: %w", err) } tp := sdktrace.NewTracerProvider( @@ -1038,4 +1040,5 @@ func initTracing(db *sql.DB) { otel.SetTracerProvider(tp) tracer = tp.Tracer("themis") + return nil } diff --git a/go.mod b/go.mod index 33dc789..e835818 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/rs/zerolog v1.31.0 github.com/stretchr/testify v1.8.4 go.opentelemetry.io/otel/trace v1.23.0 - go.wperron.io/sqliteexporter v0.1.0-rc4.0.20240209151856-fbb499783db4 + go.wperron.io/sqliteexporter v0.1.0-rc5.0.20240209234500-ad89647cf9b6 ) require ( diff --git a/go.sum b/go.sum index bc099db..465fcad 100644 --- a/go.sum +++ b/go.sum @@ -162,8 +162,16 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +go.wperron.io/sqliteexporter v0.1.0-rc4 h1:c87oo4ayZsbQmPTNsYzl6Vk6WNT/kdplU/+Ss58BnGk= +go.wperron.io/sqliteexporter v0.1.0-rc4/go.mod h1:1EGOfZSCZPXd+XBx40fQ5X9U4o35LJ1r+/41We6Yr1c= go.wperron.io/sqliteexporter v0.1.0-rc4.0.20240209151856-fbb499783db4 h1:ertcPQ8wLgmMZbO7PuUgLiURf6BHsHEa60++ye6RsFQ= go.wperron.io/sqliteexporter v0.1.0-rc4.0.20240209151856-fbb499783db4/go.mod h1:iQD28FG3zrdOEpKTGxvWCcLdir5eavk5bKjjN3RQ6Xc= +go.wperron.io/sqliteexporter v0.1.0-rc4.0.20240209232952-5308d8284449 h1:ewfiZC7XIDJwxYlr4usrqpLQjs12QWBGtuzbNoZqtgU= +go.wperron.io/sqliteexporter v0.1.0-rc4.0.20240209232952-5308d8284449/go.mod h1:iQD28FG3zrdOEpKTGxvWCcLdir5eavk5bKjjN3RQ6Xc= +go.wperron.io/sqliteexporter v0.1.0-rc5 h1:kcCW929KkjZU59s1102oak5qWED11rnBpoSGXtdkiRQ= +go.wperron.io/sqliteexporter v0.1.0-rc5/go.mod h1:iQD28FG3zrdOEpKTGxvWCcLdir5eavk5bKjjN3RQ6Xc= +go.wperron.io/sqliteexporter v0.1.0-rc5.0.20240209234500-ad89647cf9b6 h1:GbIjafkOpD/bWS2qR8PAOQAZPTQTQLk5XC4+d7DI7Fw= +go.wperron.io/sqliteexporter v0.1.0-rc5.0.20240209234500-ad89647cf9b6/go.mod h1:iQD28FG3zrdOEpKTGxvWCcLdir5eavk5bKjjN3RQ6Xc= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=