-
Notifications
You must be signed in to change notification settings - Fork 85
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
Conversation
create_aio_app/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/__main__.py
Outdated
Show resolved
Hide resolved
create_aio_app/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/__main__.py
Outdated
Show resolved
Hide resolved
create_aio_app/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/app.py
Outdated
Show resolved
Hide resolved
create_aio_app/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/app.py
Outdated
Show resolved
Hide resolved
create_aio_app/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/app.py
Outdated
Show resolved
Hide resolved
@@ -36,6 +36,13 @@ | |||
'port': trafaret.Int(), | |||
}), | |||
{%- endif %} | |||
{%- if cookiecutter.use_sentry == 'y' %} | |||
trafaret.Key('sentry'): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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()] |
There was a problem hiding this comment.
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
?
There was a problem hiding this 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.
{%- if cookiecutter.use_sentry == 'y' %} | ||
init_sentry(app) | ||
{%- endif %} | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 %} |
There was a problem hiding this comment.
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.
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.
@4lovi4 can you do that? 😀 |
Going to refresh the doc. |
@4lovi4 any updates? |
@4lovi4 any updates |
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
CHANGES
folder<issue_id>.<type>
(e.g.588.bugfix
)issue_id
change it to the pr id after creating the PR.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.Fix issue with non-ascii contents in doctest text files.