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

NR cannot instrument tracing with python agent on non-web application #995

Open
jonathan-fileread opened this issue Dec 6, 2023 · 1 comment
Labels

Comments

@jonathan-fileread
Copy link

Description
NOTE: # ( Describe the problem you're encountering. )

Hello! We've setup a python agent in our kubernetes container that runs a worker which polls from a queue.

The dockerfile entrypoint looks something like this -

CMD ["python3", "/app/workerservice"]

We get logs but we do not receive distributed traces.

We have NEW_RELIC_DISTRIBUTED_TRACING_ENABLED set to true in the environment variables.

New relic is injected via our main.py, looking something like this.


import newrelic.agent

newrelic.agent.initialize()

@newrelic.agent.background_task()

async def main():

insert-some-components-here

if __name__ == '__main__':

asyncio.run(main())

Here's our permalink.
permalink: https://onenr.io/0EjOoDd18j6

python agent, newrelic==9.1.2 on python,

we ran the CLI diagnostic, but to no avail.

this is also a non-web-app worker we are looking to monitor - there are no frameworks used, just plain python.
[TIP]: # ( Do NOT share sensitive information, whether personal, proprietary, or otherwise! )

Expected Behavior
NOTE: # ( Tell us what you expected to happen. )

our goal is to instrument the agent to send distributed traces to the traces directory. we have a lot of dependencies to our worker services that we'd like to monitor.

Troubleshooting or NR Diag results
NOTE: # ( Provide any other relevant log data. )
[TIP]: # ( Scrub logs and diagnostic information for sensitive information )

Steps to Reproduce
NOTE: # ( Please be as specific as possible. )
[TIP]: # ( Link a sample application that demonstrates the issue. )

  • provided in permalink, but screenshot attached.
Screenshot 2023-12-06 at 12 11 45 AM

Your Environment
[TIP]: # ( Include as many relevant details about your environment as possible including the running version of New Relic software and any relevant configurations. )

  • added in the permalink
    Additional context
    [TIP]: # ( Add any other context about the problem here. For example, relevant community posts or support tickets. )
@hmstepanek
Copy link
Contributor

If main loops forever and never exits than you need to move the background task decorator into something that has a finite start and end time. We will not record a distributed trace until the thing the background task is wrapping has exited. You may also need to set the startup timeout, startup_timeout = 30 so that the first background task is captured.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants