Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Sentry #25

Merged
merged 1 commit into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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