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

Integrate support for Sentry reporting #137

Closed
wants to merge 2 commits into from
Closed

Integrate support for Sentry reporting #137

wants to merge 2 commits into from

Conversation

4lovi4
Copy link
Contributor

@4lovi4 4lovi4 commented Jun 17, 2019

What do these changes do?

sentry integration template for the generated app

Are there changes in behavior for the user?

Related issue number

Closes #120

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • Add a new news fragment into the CHANGES folder
    • name it <issue_id>.<type> (e.g. 588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the PR
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: Fix issue with non-ascii contents in doctest text files.

@@ -36,6 +36,13 @@
'port': trafaret.Int(),
}),
{%- endif %}
{%- if cookiecutter.use_sentry == 'y' %}
trafaret.Key('sentry'):
Copy link
Member

Choose a reason for hiding this comment

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

No. Accept a string for dsn.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've put the dsn key here.

Copy link
Member

Choose a reason for hiding this comment

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

Either add other options or turn this into a scalar option. No need for mapping if it's just one value.

config = app['config']['sentry']
sentry_sdk.init(
dsn=config["dsn"],
integrations=[AioHttpIntegration()]
Copy link
Member

Choose a reason for hiding this comment

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

Maybe also set environment, server_name, attach_stacktrace and release?

Copy link
Member

@webknjaz webknjaz left a comment

Choose a reason for hiding this comment

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

LGTM overall. Let's see what others think.

@webknjaz webknjaz requested a review from Arfey June 18, 2019 19:41
@webknjaz webknjaz changed the title issue#120 sentry Integrate support for Sentry reporting Jun 18, 2019
{%- if cookiecutter.use_sentry == 'y' %}
init_sentry(app)
{%- endif %}

Copy link
Member

Choose a reason for hiding this comment

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

This is simple init function, so move initialize sentry to init_app from app.py

Insert this function after init_routes(app), please. I guess so this features is not useful for developer mode. As a solution, I recommend provide some value to config file. Some like debug with True/False or mode with prd/test/dev properties. (In my opinion mode will be more useful because give possibility split different environments) And after that use sentry only for production.

Copy link
Member

Choose a reason for hiding this comment

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

I usually set dev env and also a specifier of my laptop, so that if errors come from different devs it could be easy to recognize.

Copy link
Member

Choose a reason for hiding this comment

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

I don't use sentry so can't say anything about best usage this library and just proposed.

trafaret.Dict({
'dsn': trafaret.String(),
}),
{%- endif %}
Copy link
Member

Choose a reason for hiding this comment

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

After generation a new project with sentry, I will get error that my config file doesn't have sentry key. Am i right? If it's true so add this keys to config files, please.

@Arfey
Copy link
Member

Arfey commented Jun 19, 2019

It's look as very useful feature for a lot of people. If we want that people use this then we need to describe about that for them.

  • add description about this flag to the readme
  • add description about setting sentry to the documentation

@4lovi4 can you do that? 😀

@4lovi4
Copy link
Contributor Author

4lovi4 commented Jun 20, 2019

Going to refresh the doc.

@webknjaz
Copy link
Member

@4lovi4 any updates?

@Arfey
Copy link
Member

Arfey commented Feb 9, 2020

@4lovi4 any updates 2.0?)

@CLAassistant

This comment has been minimized.

@4lovi4 4lovi4 closed this by deleting the head repository Jan 14, 2024
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.

Integrate Sentry support
4 participants