Skip to content

Commit

Permalink
Enable Sentry (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa authored May 19, 2024
1 parent 9589aa0 commit 90898df
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions gatewayd_plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ plugins:
# Possible values: trace, debug, info, warn, error
# Other values will result in no level being set.
- LOG_LEVEL=error
- SENTRY_DSN=https://379ef59ea0c55742957b06c94bc496e1@o4504550475038720.ingest.us.sentry.io/4507282732810240
# Checksum hash to verify the binary before loading
checksum: dee4aa014a722e1865d91744a4fd310772152467d9c6ab4ba17fd9dd40d3f724
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/carlmjohnson/requests v0.23.5
github.com/corazawaf/libinjection-go v0.1.3
github.com/gatewayd-io/gatewayd-plugin-sdk v0.2.13
github.com/getsentry/sentry-go v0.27.0
github.com/hashicorp/go-hclog v1.6.3
github.com/hashicorp/go-plugin v1.6.1
github.com/jackc/pgx/v5 v5.5.5
Expand Down
7 changes: 7 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"log"
"os"

sdkConfig "github.com/gatewayd-io/gatewayd-plugin-sdk/config"
Expand All @@ -10,12 +11,23 @@ import (
p "github.com/gatewayd-io/gatewayd-plugin-sdk/plugin"
v1 "github.com/gatewayd-io/gatewayd-plugin-sdk/plugin/v1"
"github.com/gatewayd-io/gatewayd-plugin-sql-ids-ips/plugin"
"github.com/getsentry/sentry-go"
"github.com/hashicorp/go-hclog"
goplugin "github.com/hashicorp/go-plugin"
"github.com/spf13/cast"
)

func main() {
sentryDSN := sdkConfig.GetEnv("SENTRY_DSN", "")
// Initialize Sentry SDK
err := sentry.Init(sentry.ClientOptions{
Dsn: sentryDSN,
TracesSampleRate: 1.0,
})
if err != nil {
log.Fatalf("Failed to initialize Sentry SDK: %s", err.Error())
}

// Parse command line flags, passed by GatewayD via the plugin config
logLevel := flag.String("log-level", "info", "Log level")
flag.Parse()
Expand Down

0 comments on commit 90898df

Please sign in to comment.