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

Better instrumentation #460

Open
duogenesis opened this issue Aug 21, 2024 · 0 comments
Open

Better instrumentation #460

duogenesis opened this issue Aug 21, 2024 · 0 comments

Comments

@duogenesis
Copy link
Member

duogenesis commented Aug 21, 2024

Instrumentation is currently pretty sparse and generally janky. Whatever logging exists is done using print statements whose outputs have to be checked by connecting to the server and running docker logs -f [container_id]. Instrumentation can be done a lot better by using a solution like Sentry.

At the time of writing, Duolicious serves 65.61M requests per 30 days (according to Cloudflare), but sentry's free tier only allows for 10M spans and 5k errors. We can't afford anything more than the free tier, so if we opt for Sentry, we'll need to sample transactions.

What I'd really be interested in is a) profiling each endpoint; and b) checking for 5xx errors. Though I've never used Sentry before, so I'm not sure if there's easier wins to be had. Sentry's documentation shows this very straightforward implementation:

import sentry_sdk
from flask import Flask
from sentry_sdk.integrations.flask import FlaskIntegration

sentry_sdk.init(
    dsn="https://<key>@sentry.io/<project>",
    integrations=[FlaskIntegration()],

    # Set traces_sample_rate to 1.0 to capture 100%
    # of transactions for Tracing.
    # We recommend adjusting this value in production,
    traces_sample_rate=1.0
)

app = Flask(__name__)

Hopefully it plays nicely with the decorators I've written for all the REST API endpoints.

The chat service, which is probably the least reliable part of Duolicious for reasons partly explained here, will need to be instrumented separately to the REST API.

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

1 participant