Skip to content

Conversation

ckoehn
Copy link
Contributor

@ckoehn ckoehn commented Feb 23, 2023

What does this pull request do?

This change handles the case when APM is not recording/disabled and client.begin_transaction() just returns None. I wasn't able to figure out how to add a test for this. Do you have an advice/hint?

Related issues

@github-actions github-actions bot added agent-python community Issues opened by the community triage Issues awaiting triage labels Feb 23, 2023
@basepi basepi requested a review from beniwohli February 27, 2023 19:03
Copy link
Contributor

@beniwohli beniwohli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ckoehn

Good catch, the fix looks good. Testing this is indeed somewhat tricky, as our setup with a GRPC server in a subprocess is a bit convoluted. I added a test that does the trick, albeit a bit unsatisfactory. It fails without your patch, but will also pass if a transaction isn't recorded by our fake APM Server for other reasons. But I think it's acceptable for now.

@beniwohli beniwohli enabled auto-merge (squash) March 1, 2023 07:45
@beniwohli beniwohli merged commit 73b6eb8 into elastic:main Mar 1, 2023
@beniwohli
Copy link
Contributor

huh. not sure why this was auto-merged before the tests completed :/

@ckoehn ckoehn deleted the fix-grpc-server-non-existent-transaction branch March 1, 2023 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-python community Issues opened by the community triage Issues awaiting triage

3 participants