0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-21 13:39:22 +01:00
posthog/livestream/db.go
James Greenhill 37f7c8ec9a
chore: add sentry to liveevents (#23057)
* chore: add sentry to liveevents

* Use `isProd` for `Debug`

* Add a bunch of `CaptureException` calls

* Properly bubble `getPGConn()` error

* Fix `ParseIP` error handling

* Remove unused `personFromDistinctId()`

---------

Co-authored-by: Michael Matloka <dev@twixes.com>
Co-authored-by: Michael Matloka <michal@matloka.com>
2024-06-19 21:23:55 +00:00

20 lines
345 B
Go

package main
import (
"context"
"github.com/getsentry/sentry-go"
"github.com/jackc/pgx/v5"
"github.com/spf13/viper"
)
func getPGConn() (*pgx.Conn, error) {
url := viper.GetString("postgres.url")
conn, err := pgx.Connect(context.Background(), url)
if err != nil {
sentry.CaptureException(err)
return nil, err
}
return conn, nil
}