Skip to content

Commit

Permalink
feat: Remove plugin option for logging error events to Sentry (#1724)
Browse files Browse the repository at this point in the history
  • Loading branch information
murarustefaan authored Jun 11, 2024
1 parent 7b9d6cc commit 7732fe8
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 133 deletions.
1 change: 0 additions & 1 deletion examples/simple_plugin/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ require (
github.com/fatih/structs v1.1.0 // indirect
github.com/flosch/pongo2/v4 v4.0.2 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/getsentry/sentry-go v0.28.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/gin-gonic/gin v1.9.1 // indirect
Expand Down
7 changes: 0 additions & 7 deletions examples/simple_plugin/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,12 @@ github.com/flosch/pongo2/v4 v4.0.2 h1:gv+5Pe3vaSVmiJvh/BZa82b7/00YUGm0PIyVVLop0H
github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8=
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
github.com/getsentry/sentry-go v0.28.0 h1:7Rqx9M3ythTKy2J6uZLHmc8Sz9OGgIlseuO1iBX/s0M=
github.com/getsentry/sentry-go v0.28.0/go.mod h1:1fQZ+7l7eeJ3wYi82q5Hg8GqAPgefRq+FP/QhafYVgg=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
Expand Down Expand Up @@ -190,9 +186,6 @@ github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZ
github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require (
github.com/cloudquery/cloudquery-api-go v1.11.3
github.com/cloudquery/plugin-pb-go v1.19.19
github.com/cloudquery/plugin-sdk/v2 v2.7.0
github.com/getsentry/sentry-go v0.28.0
github.com/goccy/go-json v0.10.3
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
Expand Down
7 changes: 0 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,12 @@ github.com/flosch/pongo2/v4 v4.0.2 h1:gv+5Pe3vaSVmiJvh/BZa82b7/00YUGm0PIyVVLop0H
github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8=
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
github.com/getsentry/sentry-go v0.28.0 h1:7Rqx9M3ythTKy2J6uZLHmc8Sz9OGgIlseuO1iBX/s0M=
github.com/getsentry/sentry-go v0.28.0/go.mod h1:1fQZ+7l7eeJ3wYi82q5Hg8GqAPgefRq+FP/QhafYVgg=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
Expand Down Expand Up @@ -190,9 +186,6 @@ github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZ
github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=
github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ=
github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down
1 change: 0 additions & 1 deletion internal/servers/plugin/v3/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type Server struct {
Plugin *plugin.Plugin
Logger zerolog.Logger
Directory string
NoSentry bool
}

func (s *Server) GetTables(ctx context.Context, req *pb.GetTables_Request) (*pb.GetTables_Response, error) {
Expand Down
39 changes: 0 additions & 39 deletions scheduler/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ import (
"time"

"github.com/apache/arrow/go/v16/arrow"

"github.com/cloudquery/plugin-sdk/v4/caser"
"github.com/cloudquery/plugin-sdk/v4/message"
"github.com/cloudquery/plugin-sdk/v4/schema"
"github.com/getsentry/sentry-go"
"github.com/rs/zerolog"
"github.com/thoas/go-funk"
"go.opentelemetry.io/otel"
Expand Down Expand Up @@ -235,7 +233,6 @@ func (s *syncClient) logTablesMetrics(tables schema.Tables, client Client) {
}

func (s *syncClient) resolveResource(ctx context.Context, table *schema.Table, client schema.ClientMeta, parent *schema.Resource, item any) *schema.Resource {
var validationErr *schema.ValidationError
ctx, cancel := context.WithTimeout(ctx, 10*time.Minute)
defer cancel()
resource := schema.NewResourceData(table, parent, item)
Expand All @@ -248,22 +245,12 @@ func (s *syncClient) resolveResource(ctx context.Context, table *schema.Table, c
stack := fmt.Sprintf("%s\n%s", err, string(debug.Stack()))
logger.Error().Interface("error", err).TimeDiff("duration", time.Now(), objectStartTime).Str("stack", stack).Msg("resource resolver finished with panic")
atomic.AddUint64(&tableMetrics.Panics, 1)
sentry.WithScope(func(scope *sentry.Scope) {
scope.SetTag("table", table.Name)
sentry.CurrentHub().CaptureMessage(stack)
})
}
}()
if table.PreResourceResolver != nil {
if err := table.PreResourceResolver(ctx, client, resource); err != nil {
logger.Error().Err(err).Msg("pre resource resolver failed")
atomic.AddUint64(&tableMetrics.Errors, 1)
if errors.As(err, &validationErr) {
sentry.WithScope(func(scope *sentry.Scope) {
scope.SetTag("table", table.Name)
sentry.CurrentHub().CaptureMessage(validationErr.MaskedError())
})
}
return nil
}
}
Expand All @@ -276,45 +263,26 @@ func (s *syncClient) resolveResource(ctx context.Context, table *schema.Table, c
if err := table.PostResourceResolver(ctx, client, resource); err != nil {
logger.Error().Stack().Err(err).Msg("post resource resolver finished with error")
atomic.AddUint64(&tableMetrics.Errors, 1)
if errors.As(err, &validationErr) {
sentry.WithScope(func(scope *sentry.Scope) {
scope.SetTag("table", table.Name)
sentry.CurrentHub().CaptureMessage(validationErr.MaskedError())
})
}
}
}
atomic.AddUint64(&tableMetrics.Resources, 1)
return resource
}

func (s *syncClient) resolveColumn(ctx context.Context, logger zerolog.Logger, tableMetrics *TableClientMetrics, client schema.ClientMeta, resource *schema.Resource, c schema.Column) {
var validationErr *schema.ValidationError
columnStartTime := time.Now()
defer func() {
if err := recover(); err != nil {
stack := fmt.Sprintf("%s\n%s", err, string(debug.Stack()))
logger.Error().Str("column", c.Name).Interface("error", err).TimeDiff("duration", time.Now(), columnStartTime).Str("stack", stack).Msg("column resolver finished with panic")
atomic.AddUint64(&tableMetrics.Panics, 1)
sentry.WithScope(func(scope *sentry.Scope) {
scope.SetTag("table", resource.Table.Name)
scope.SetTag("column", c.Name)
sentry.CurrentHub().CaptureMessage(stack)
})
}
}()

if c.Resolver != nil {
if err := c.Resolver(ctx, client, resource, c); err != nil {
logger.Error().Err(err).Msg("column resolver finished with error")
atomic.AddUint64(&tableMetrics.Errors, 1)
if errors.As(err, &validationErr) {
sentry.WithScope(func(scope *sentry.Scope) {
scope.SetTag("table", resource.Table.Name)
scope.SetTag("column", c.Name)
sentry.CurrentHub().CaptureMessage(validationErr.MaskedError())
})
}
}
} else {
// base use case: try to get column with CamelCase name
Expand All @@ -324,13 +292,6 @@ func (s *syncClient) resolveColumn(ctx context.Context, logger zerolog.Logger, t
if err != nil {
logger.Error().Err(err).Msg("column resolver finished with error")
atomic.AddUint64(&tableMetrics.Errors, 1)
if errors.As(err, &validationErr) {
sentry.WithScope(func(scope *sentry.Scope) {
scope.SetTag("table", resource.Table.Name)
scope.SetTag("column", c.Name)
sentry.CurrentHub().CaptureMessage(validationErr.MaskedError())
})
}
}
}
}
Expand Down
34 changes: 0 additions & 34 deletions scheduler/scheduler_dfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ package scheduler

import (
"context"
"errors"
"fmt"
"runtime/debug"
"sync"
"sync/atomic"

"github.com/cloudquery/plugin-sdk/v4/helpers"
"github.com/cloudquery/plugin-sdk/v4/schema"
"github.com/getsentry/sentry-go"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"golang.org/x/sync/semaphore"
Expand All @@ -33,10 +31,6 @@ func (s *syncClient) syncDfs(ctx context.Context, resolvedResources chan<- *sche
if _, ok := seenClients[c.ID()]; !ok {
seenClients[c.ID()] = true
} else {
sentry.WithScope(func(scope *sentry.Scope) {
scope.SetTag("table", table.Name)
sentry.CurrentHub().CaptureMessage("duplicate client ID in " + table.Name)
})
s.logger.Warn().Str("client", c.ID()).Str("table", table.Name).Msg("multiplex returned duplicate client")
}
}
Expand Down Expand Up @@ -76,7 +70,6 @@ func (s *syncClient) resolveTableDfs(ctx context.Context, table *schema.Table, c
ctx, span := otel.Tracer(otelName).Start(ctx, "resolveTableDfs_"+table.Name)
span.SetAttributes(attribute.Key("client-id").String(client.ID()))
defer span.End()
var validationErr *schema.ValidationError
clientName := client.ID()
logger := s.logger.With().Str("table", table.Name).Str("client", clientName).Logger()

Expand All @@ -90,10 +83,6 @@ func (s *syncClient) resolveTableDfs(ctx context.Context, table *schema.Table, c
defer func() {
if err := recover(); err != nil {
stack := fmt.Sprintf("%s\n%s", err, string(debug.Stack()))
sentry.WithScope(func(scope *sentry.Scope) {
scope.SetTag("table", table.Name)
sentry.CurrentHub().CaptureMessage(stack)
})
logger.Error().Interface("error", err).Str("stack", stack).Msg("table resolver finished with panic")
atomic.AddUint64(&tableMetrics.Panics, 1)
}
Expand All @@ -102,12 +91,6 @@ func (s *syncClient) resolveTableDfs(ctx context.Context, table *schema.Table, c
if err := table.Resolver(ctx, client, parent, res); err != nil {
logger.Error().Err(err).Msg("table resolver finished with error")
atomic.AddUint64(&tableMetrics.Errors, 1)
if errors.As(err, &validationErr) {
sentry.WithScope(func(scope *sentry.Scope) {
scope.SetTag("table", table.Name)
sentry.CurrentHub().CaptureMessage(validationErr.MaskedError())
})
}
return
}
}()
Expand All @@ -132,7 +115,6 @@ func (s *syncClient) resolveResourcesDfs(ctx context.Context, table *schema.Tabl
go func() {
defer close(resourcesChan)
var wg sync.WaitGroup
sentValidationErrors := sync.Map{}
for i := range resourcesSlice {
i := i
resourceConcurrencyKey := table.Name + "-" + client.ID() + "-" + "resource"
Expand Down Expand Up @@ -168,28 +150,12 @@ func (s *syncClient) resolveResourcesDfs(ctx context.Context, table *schema.Tabl
if err := resolvedResource.CalculateCQID(s.deterministicCQID); err != nil {
tableMetrics := s.metrics.TableClient[table.Name][client.ID()]
s.logger.Error().Err(err).Str("table", table.Name).Str("client", client.ID()).Msg("resource resolver finished with primary key calculation error")
if _, found := sentValidationErrors.LoadOrStore(table.Name, struct{}{}); !found {
// send resource validation errors to Sentry only once per table,
// to avoid sending too many duplicate messages
sentry.WithScope(func(scope *sentry.Scope) {
scope.SetTag("table", table.Name)
sentry.CurrentHub().CaptureMessage(err.Error())
})
}
atomic.AddUint64(&tableMetrics.Errors, 1)
return
}
if err := resolvedResource.Validate(); err != nil {
tableMetrics := s.metrics.TableClient[table.Name][client.ID()]
s.logger.Error().Err(err).Str("table", table.Name).Str("client", client.ID()).Msg("resource resolver finished with validation error")
if _, found := sentValidationErrors.LoadOrStore(table.Name, struct{}{}); !found {
// send resource validation errors to Sentry only once per table,
// to avoid sending too many duplicate messages
sentry.WithScope(func(scope *sentry.Scope) {
scope.SetTag("table", table.Name)
sentry.CurrentHub().CaptureMessage(err.Error())
})
}
atomic.AddUint64(&tableMetrics.Errors, 1)
return
}
Expand Down
47 changes: 4 additions & 43 deletions serve/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ import (
serverDestinationV0 "github.com/cloudquery/plugin-sdk/v4/internal/servers/destination/v0"
serverDestinationV1 "github.com/cloudquery/plugin-sdk/v4/internal/servers/destination/v1"
serversv3 "github.com/cloudquery/plugin-sdk/v4/internal/servers/plugin/v3"
"github.com/getsentry/sentry-go"
"github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/logging"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"github.com/thoas/go-funk"
"google.golang.org/grpc"
"google.golang.org/grpc/test/bufconn"
)
Expand All @@ -43,20 +41,13 @@ type PluginServe struct {
plugin *plugin.Plugin
args []string
destinationV0V1Server bool
sentryDSN string
testListener bool
testListenerConn *bufconn.Listener
versions []int
}

type PluginOption func(*PluginServe)

func WithPluginSentryDSN(dsn string) PluginOption {
return func(s *PluginServe) {
s.sentryDSN = dsn
}
}

// WithDestinationV0V1Server is used to include destination v0 and v1 server to work
// with older sources
func WithDestinationV0V1Server() PluginOption {
Expand Down Expand Up @@ -225,9 +216,8 @@ func (s *PluginServe) newCmdPluginServe() *cobra.Command {
)
s.plugin.SetLogger(logger)
pbv3.RegisterPluginServer(grpcServer, &serversv3.Server{
Plugin: s.plugin,
Logger: logger,
NoSentry: noSentry,
Plugin: s.plugin,
Logger: logger,
})
if s.destinationV0V1Server {
pbDestinationV1.RegisterDestinationServer(grpcServer, &serverDestinationV1.Server{
Expand All @@ -246,33 +236,6 @@ func (s *PluginServe) newCmdPluginServe() *cobra.Command {
Versions: []int32{0, 1, 2, 3},
})

version := s.plugin.Version()

if s.sentryDSN != "" && !strings.EqualFold(version, "development") && !noSentry {
err = sentry.Init(sentry.ClientOptions{
Dsn: s.sentryDSN,
Debug: false,
AttachStacktrace: false,
Release: version,
Transport: sentry.NewHTTPSyncTransport(),
ServerName: "oss", // set to "oss" on purpose to avoid sending any identifying information
// https://docs.sentry.io/platforms/go/configuration/options/#removing-default-integrations
Integrations: func(integrations []sentry.Integration) []sentry.Integration {
var filteredIntegrations []sentry.Integration
for _, integration := range integrations {
if integration.Name() == "Modules" {
continue
}
filteredIntegrations = append(filteredIntegrations, integration)
}
return filteredIntegrations
},
})
if err != nil {
log.Error().Err(err).Msg("Error initializing sentry")
}
}

ctx := cmd.Context()
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
Expand Down Expand Up @@ -308,10 +271,8 @@ func (s *PluginServe) newCmdPluginServe() *cobra.Command {
cmd.Flags().BoolVar(&otelEndpointInsecure, "otel-endpoint-insecure", false, "use Open Telemetry HTTP endpoint (for development only)")
cmd.Flags().BoolVar(&noSentry, "no-sentry", false, "disable sentry")
cmd.Flags().StringVar(&licenseFile, "license", "", "Path to offline license file or directory")
sendErrors := funk.ContainsString([]string{"all", "errors"}, telemetryLevel.String())
if !sendErrors {
noSentry = true
}

_ = cmd.Flags().MarkDeprecated("no-sentry", "no-sentry option is deprecated and unused")

return cmd
}
Expand Down

1 comment on commit 7732fe8

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏱️ Benchmark results

  • Glob-8 ns/op: 92.66

Please sign in to comment.