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

error_reporter , how to build my custom error reporter ? #708

Open
danielb-magnadint opened this issue Dec 7, 2022 · 1 comment
Open

Comments

@danielb-magnadint
Copy link

danielb-magnadint commented Dec 7, 2022

I want to build my custom error reporter but I cant get it to read it from the configuration.
Also found out that sentry and rollbar have entry points inside django_q so maybe its not possible to do my own custom implementation ?

I see that in the code it uses pkg_resources.iter_entry_points(
"djangoq.errorreporters", name
)

so somehow I need to register a entry point.

Any suggestions are welcome. Thanks

@amirraouf
Copy link

I have a tweak

def load_slack_entry_point_for_django_q():
    ep = pkg_resources.EntryPoint.parse('key = pkg_name:ReporterClass')
    d = pkg_resources.Distribution(location="pkg_name", project_name="pkg_name", version="<ver_number>")
    d._ep_map = {'djangoq.errorreporters': {'key': ep}}
    fixed = True
    while fixed:
        try:
            pkg_resources.working_set.add(d, 'slack')
            fixed = False
        except TypeError:
            continue

at manage.py or any file run at the runtime of the project

if __name__ == "__main__":
    load_slack_entry_point_for_django_q()
    main()

then create a package similar to django-q-sentry, add the reporter class you want to add

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

No branches or pull requests

2 participants