Skip to content

feat: Add sentry for serve.Serve function#54

Merged
yevgenypats merged 2 commits intomainfrom
feat/sentry
Sep 6, 2022
Merged

feat: Add sentry for serve.Serve function#54
yevgenypats merged 2 commits intomainfrom
feat/sentry

Conversation

@yevgenypats
Copy link
Copy Markdown
Contributor

@yevgenypats yevgenypats commented Sep 5, 2022

plugin developers will be able to direct their plugin errors
to their own projects on sentry as we dont want to monitor any
community errors anyway.

Also each plugin should go into it's own project on sentry
because we are using server side grouping which are mostly
project based.

Tested it on gcp - grouping works smoothly with nice title (no more diags.Error) for every single error as we use standard sentry.Message as well as using sentry mechanism to group and change title based on tags.

Every error in the ETL process which is not ignore is sent with the error as string + table_name as tag.

https://sentry.io/organizations/cloudquery-v2/issues/?project=6720365

hopefully this brings sane error monitoring one step closer :) 🚀


Use the following steps to ensure your PR is ready to be reviewed

  • Read the contribution guidelines 🧑‍🎓
  • Run go fmt to format your code 🖊
  • Lint your changes via golangci-lint run 🚨 (install golangci-lint here)
  • Update or add tests 🧪
  • Ensure the status checks below are successful ✅

plugin developers will be able to direct their plugin errors
to their own projects on sentry as we dont want to monitor any
community errors anyway.

Also each plugin should go into it's own project on sentry
because we are using server side grouping which are mostly
project based.
@yevgenypats yevgenypats merged commit c1b508f into main Sep 6, 2022
@yevgenypats yevgenypats deleted the feat/sentry branch September 6, 2022 07:04
@cq-bot cq-bot mentioned this pull request Sep 6, 2022
Comment on lines +225 to +229
// if pks[resource.PrimaryKeyValue()] {
// meta.Logger().Error().Str("table_name", t.Name).Str("primary_key", resource.PrimaryKeyValue()).Msg("duplicate primary key found")
// } else {
// pks[resource.PrimaryKeyValue()] = true
// }
Copy link
Copy Markdown
Member

@erezrokah erezrokah Sep 6, 2022

Choose a reason for hiding this comment

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

Suggested change
// if pks[resource.PrimaryKeyValue()] {
// meta.Logger().Error().Str("table_name", t.Name).Str("primary_key", resource.PrimaryKeyValue()).Msg("duplicate primary key found")
// } else {
// pks[resource.PrimaryKeyValue()] = true
// }

// we want to check for data integrity
// in the future we can do that as an optinoal feature via a flag
pks := map[string]bool{}
// pks := map[string]bool{}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
// pks := map[string]bool{}

cmd.Flags().StringVar(&network, "network", "tcp", `the network must be "tcp", "tcp4", "tcp6", "unix" or "unixpacket"`)
cmd.Flags().Var(logLevel, "log-level", fmt.Sprintf("log level. one of: %s", strings.Join(logLevel.Allowed, ",")))
cmd.Flags().Var(logFormat, "log-format", fmt.Sprintf("log format. one of: %s", strings.Join(logFormat.Allowed, ",")))
cmd.Flags().BoolVar(&noSentry, "no-sentry", false, "disable sentry")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe use the same wording as the CLI e.g. disable-telemetry?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think for flags it's better to use no- and I used it everywhere else (I don't think we have enable or at least shouldn't ) - this should make flags short. I can change the help to no sentry if this is more consistent.

Copy link
Copy Markdown
Member

@erezrokah erezrokah Sep 6, 2022

Choose a reason for hiding this comment

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

Ah sure I don't mind no- vs disable- just not use an internal implementation detail in the name of the flag (if we can)

kodiakhq bot pushed a commit that referenced this pull request Sep 6, 2022
🤖 I have created a release *beep* *boop*
---


## [0.1.1](v0.1.0...v0.1.1) (2022-09-06)


### Features

* Add custom faker ([#52](#52)) ([34bef4b](34bef4b))
* Add sentry for serve.Serve function ([#54](#54)) ([c1b508f](c1b508f))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
@erezrokah erezrokah mentioned this pull request Sep 19, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants