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

Queries completing with errors do not set span error tag #11

Open
epkugelmass opened this issue May 17, 2019 · 2 comments
Open

Queries completing with errors do not set span error tag #11

epkugelmass opened this issue May 17, 2019 · 2 comments

Comments

@epkugelmass
Copy link
Contributor

Expected:
When a CRUD operation fails against Mongo due to a constraint violation (and the Mongo java driver throws a MongoException), the corresponding CommandEvent span should have the "error" tag set to true and a log message with relevant details.

Actual:
The span does not have the "error" tag set.

Cause:
TracingCommandListener only sets the "error" tag on a CommandFailedEvent. According to https://github.com/mongodb/specifications/blob/master/source/command-monitoring/command-monitoring.rst#succeeded-or-failed, command success does not indicate that the CRUD operation actually completed without error, only that the server was able to try to execute it.

@malafeev
Copy link

malafeev commented May 28, 2019

I don't have any idea how we can handle it.
It looks like a limitation of Mongo Driver Command Listener.

@epkugelmass
Copy link
Contributor Author

The extremely unreliable way to implement such a feature would be to inspect the BsonDocument payload of the CommandSucceededEvent. This is how the Mongo Java Driver internally figures out when to throw an exception. See com.mongodb.operation.BulkWriteBatch#addResult

Obviously, this is ridiculously unreliable. As you suggested, it seems we're lacking an appropriate upstream 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

2 participants