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

statsd logging does not work in UvicornWorker and does not throw any error #846

Open
tim-gb opened this issue Aug 9, 2024 · 1 comment
Labels
kind/bug Bug related issue stale Stale - Bot reminder

Comments

@tim-gb
Copy link

tim-gb commented Aug 9, 2024

Describe the bug
In my application, I deploy a FastAPI app to my kubernetes pod, and I have a datadog agent set up in the cluster.
When I exec into my pod and start a REPL, I can do statsd.set no problem, and find my metric on datadog metric explorer.
My app has the following structure:

  • main.py -- the main application code
  • start.py -- pre-setup before launching application, then launching application by running
launch_cmd = f"""gunicornmain:app -k uvicorn.workers.UvicornWorker \
    --bind 0.0.0.0:8006 \
    --workers 4 \
    --access-logfile - --access-logformat '%(t)s %(p)s %(m)s %(U)s' \
    --timeout 600"""
subprocess.call(launch_cmd, shell=True)

When I run statsd.set("example_metric", 1) in start.py, I can see metrics successfully logged.
When I run statsd.set("example_metric", 1) in main.py, I don't see my metric showing up, and there are no errors.

Label the issue properly.

  • Add severity/ label.
  • Add documentation label if this issue is related to documentation changes.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
Metrics should show up on metrics explorer, or stastd should throw error when it fails.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment and Versions (please complete the following information):
A clear and precise description of your setup:

  • version for this project in use.
  • services, libraries, languages and tools list and versions.

datadog==0.49.0
fastapi==0.111.1
uvicorn==0.30.3
gunicorn==20.1.0

Additional context
I tried comparing all my environment variables by dumping them in start.py and in main.py, and they are the same.

@tim-gb tim-gb added the kind/bug Bug related issue label Aug 9, 2024
Copy link

github-actions bot commented Sep 8, 2024

Thanks for your contribution!

This issue has been automatically marked as stale because it has not had activity in the last 30 days. Note that the issue will not be automatically closed, but this notification will remind us to investigate why there's been inactivity. Thank you for participating in the Datadog open source community.

If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of this project.

  2. Comment that the issue is still reproducible and include updated details requested in the issue template.

@github-actions github-actions bot added the stale Stale - Bot reminder label Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Bug related issue stale Stale - Bot reminder
Projects
None yet
Development

No branches or pull requests

1 participant