Skip to content

Conversation

@prestonvasquez
Copy link
Member

Copilot AI review requested due to automatic review settings November 18, 2025 01:13
@prestonvasquez prestonvasquez requested a review from a team as a code owner November 18, 2025 01:13
@prestonvasquez prestonvasquez marked this pull request as draft November 18, 2025 01:13
@prestonvasquez prestonvasquez removed the request for review from qingyang-hu November 18, 2025 01:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR extends the CommandFailedEvent structure to include error codes, addressing GODRIVER-3690. The change enables users to access error codes directly from command failure events without parsing the error themselves.

Key changes:

  • Added a Codes field to CommandFailedEvent to expose error codes
  • Implemented errorCodes() helper function to extract codes from driver errors
  • Added test coverage for the new field

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
event/monitoring.go Added Codes field to CommandFailedEvent structure
x/mongo/driver/operation.go Populates the new Codes field when publishing failed events; removed blank line
x/mongo/driver/errors.go Implemented errorCodes() function to extract error codes from driver errors
mongo/errors.go Refactored variable declarations to use var() block (style change)
internal/integration/clam_prose_test.go Added test case for CommandFailedEvent.Codes; removed blank line

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mongodb-drivers-pr-bot
Copy link
Contributor

mongodb-drivers-pr-bot bot commented Nov 18, 2025

🧪 Performance Results

Commit SHA: c548e7b

The following benchmark tests for version 6924b7f90944590008305a6f had statistically significant changes (i.e., |z-score| > 1.96):

Benchmark Measurement % Change Patch Value Stable Region H-Score Z-Score
BenchmarkSingleRunCommand ops_per_second_min -42.2558 889.5475 Avg: 1540.4969
Med: 1583.2505
Stdev: 241.2132
0.8281 -2.6986
BenchmarkSingleRunCommand ns_per_op 14.1080 155770.0000 Avg: 136511.0000
Med: 134633.5000
Stdev: 7614.5003
0.8069 2.5293
BenchmarkLargeDocInsertOne total_bytes_allocated -12.4360 32082400.0000 Avg: 36638789.6000
Med: 37014380.0000
Stdev: 1618972.4630
0.8176 -2.8144
BenchmarkSingleRunCommand ops_per_second_med -11.9156 6801.4718 Avg: 7721.5423
Med: 7822.8299
Stdev: 373.1667
0.7913 -2.4656
BenchmarkSingleRunCommand ops_per_second_max -10.0519 7798.3655 Avg: 8669.8536
Med: 8690.6652
Stdev: 279.6897
0.8388 -3.1159
BenchmarkMultiInsertLargeDocument ns_per_op 7.8644 31450916.0000 Avg: 29157821.0000
Med: 28892531.0000
Stdev: 823248.9052
0.8175 2.7854
BenchmarkSmallDocInsertOne ops_per_second_max -6.9913 5794.0785 Avg: 6229.6112
Med: 6250.3553
Stdev: 204.7772
0.7543 -2.1269
BenchmarkMultiInsertSmallDocument total_bytes_allocated -6.8892 415766424.0000 Avg: 446528879.1602
Med: 445126496.0000
Stdev: 14519630.6129
0.7498 -2.1187
BenchmarkBSONFlatDocumentEncoding ops_per_second_max 5.1772 90285.3016 Avg: 85841.1593
Med: 86132.6449
Stdev: 2077.8732
0.7606 2.1388
BenchmarkMultiInsertLargeDocument allocated_bytes_per_op 4.6153 28335828.0000 Avg: 27085745.6667
Med: 27345034.0000
Stdev: 531834.3823
0.8017 2.3505
BenchmarkBSONFullDocumentEncoding ops_per_second_med 3.8277 47787.4415 Avg: 46025.7070
Med: 46020.5241
Stdev: 498.6836
0.8446 3.5328
BenchmarkBSONFullDocumentEncoding ops_per_second_max 3.5933 49113.5013 Avg: 47409.9136
Med: 47359.7633
Stdev: 452.5302
0.8527 3.7646
BenchmarkBSONDeepDocumentDecoding total_time_seconds 1.2751 1.2145 Avg: 1.1992
Med: 1.1989
Stdev: 0.0057
0.8166 2.6700

For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch.

@mongodb-drivers-pr-bot
Copy link
Contributor

API Change Report

./v2/event

incompatible changes

CommandFailedEvent: old is comparable, new is not

compatible changes

CommandFailedEvent.Codes: added

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

Successfully merging this pull request may close these issues.

1 participant