Skip to content

Commit 90898df

Browse files
authored
Enable Sentry (#25)
1 parent 9589aa0 commit 90898df

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

gatewayd_plugin.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@ plugins:
5959
# Possible values: trace, debug, info, warn, error
6060
# Other values will result in no level being set.
6161
- LOG_LEVEL=error
62+
- SENTRY_DSN=https://379ef59ea0c55742957b06c94bc496e1@o4504550475038720.ingest.us.sentry.io/4507282732810240
6263
# Checksum hash to verify the binary before loading
6364
checksum: dee4aa014a722e1865d91744a4fd310772152467d9c6ab4ba17fd9dd40d3f724

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require (
66
github.com/carlmjohnson/requests v0.23.5
77
github.com/corazawaf/libinjection-go v0.1.3
88
github.com/gatewayd-io/gatewayd-plugin-sdk v0.2.13
9+
github.com/getsentry/sentry-go v0.27.0
910
github.com/hashicorp/go-hclog v1.6.3
1011
github.com/hashicorp/go-plugin v1.6.1
1112
github.com/jackc/pgx/v5 v5.5.5

go.sum

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

main.go

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"flag"
5+
"log"
56
"os"
67

78
sdkConfig "github.com/gatewayd-io/gatewayd-plugin-sdk/config"
@@ -10,12 +11,23 @@ import (
1011
p "github.com/gatewayd-io/gatewayd-plugin-sdk/plugin"
1112
v1 "github.com/gatewayd-io/gatewayd-plugin-sdk/plugin/v1"
1213
"github.com/gatewayd-io/gatewayd-plugin-sql-ids-ips/plugin"
14+
"github.com/getsentry/sentry-go"
1315
"github.com/hashicorp/go-hclog"
1416
goplugin "github.com/hashicorp/go-plugin"
1517
"github.com/spf13/cast"
1618
)
1719

1820
func main() {
21+
sentryDSN := sdkConfig.GetEnv("SENTRY_DSN", "")
22+
// Initialize Sentry SDK
23+
err := sentry.Init(sentry.ClientOptions{
24+
Dsn: sentryDSN,
25+
TracesSampleRate: 1.0,
26+
})
27+
if err != nil {
28+
log.Fatalf("Failed to initialize Sentry SDK: %s", err.Error())
29+
}
30+
1931
// Parse command line flags, passed by GatewayD via the plugin config
2032
logLevel := flag.String("log-level", "info", "Log level")
2133
flag.Parse()

0 commit comments

Comments
 (0)