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

PHPLIB-1309 Add addSubscriber/removeSubscriber to Client class to ease configuration #1195

Merged
merged 4 commits into from
Nov 23, 2023

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Nov 21, 2023

Fix PHPLIB-1309

This need emerged while working on the MongoDB profiler for Symfony using monitoring features. Chaining method calls isn't possible in Symfony DI configuration. You have to use a "configurator".

I made the methods final so that we can change the signature in the future if necessary.

@GromNaN GromNaN requested review from jmikola and alcaeus November 21, 2023 11:08
*
* @see Manager::addSubscriber()
*/
final public function addSubscriber(Subscriber $subscriber): void
Copy link
Member

Choose a reason for hiding this comment

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

Please create documentation for the new methods. There should be enough prior art to copy content from other methods. Also, let's start at CHANGELOG-1.18.md file in the root directory of the project.

tests/ClientTest.php Outdated Show resolved Hide resolved
Comment on lines +43 to +44
Create a :phpclass:`MongoDB\\Driver\\Monitoring\\CommandSubscriber` that
logs all events:
Copy link
Member Author

Choose a reason for hiding this comment

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

I created this example as the example on Application Performance Monitoring (APM) seemed complicated to me

Copy link
Member

Choose a reason for hiding this comment

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

We already have example code in the library for an APM subscriber.

It'd make more sense to create a tutorial page that includes APM code alongside surrounding documentation, as we've done for codecs and encryption. That sounds like a separate ticket, so you can just make a note there to come back and add a link to the tutorial to this method as a "See Also" link.

Copy link
Member Author

Choose a reason for hiding this comment

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

I update the example to use the client method. Here is the ticket for the tutorial: https://jira.mongodb.org/browse/PHPLIB-1314

@GromNaN GromNaN requested a review from jmikola November 21, 2023 22:21
@GromNaN GromNaN requested a review from jmikola November 22, 2023 15:58
Copy link
Member

@alcaeus alcaeus left a comment

Choose a reason for hiding this comment

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

LGTM!

@GromNaN GromNaN merged commit b455ab7 into mongodb:master Nov 23, 2023
24 checks passed
@GromNaN GromNaN deleted the PHPLIB-1309 branch November 23, 2023 08:21
alcaeus added a commit to alcaeus/mongo-php-library that referenced this pull request Jan 15, 2024
* master:
  PHPLIB-1323 Implement `unlink` for GridFS stream wrapper (mongodb#1206)
  PHPLIB-1330: Sync tests for failCommand errorLabels reqs (mongodb#1214)
  PHPLIB-1246: Test PHP 8.3 on Evergreen (mongodb#1213)
  PHPLIB-1324 Implement `rename` for GridFS stream wrapper  (mongodb#1207)
  PHPLIB-1248 Add examples on GridFS (mongodb#1196)
  Deprecate setting GridFS disableMD5 to false explicitly (mongodb#1205)
  PHPLIB-1326: Use more permissive top-level runOnRequirements (mongodb#1210)
  PHPLIB-1206 Add bucket alises for context resolver using GridFS StreamWrapper (mongodb#1138)
  Bump actions/upload-artifact from 3 to 4 (mongodb#1208)
  PHPLIB-1275: Replace apiargs usage in docs with extracts (mongodb#1203)
  Fix title formatting in Client::removeSubscriber() docs (mongodb#1204)
  PHPLIB-1304: Pull mongohouse image from ECR repo (mongodb#1202)
  Fix evergreen failures (mongodb#1200)
  Enable workflows to run for GitHub Merge Queue (mongodb#1199)
  PHPLIB-1313 Ensure the GridFS stream is saved when the script ends (mongodb#1197)
  PHPLIB-1309 Add addSubscriber/removeSubscriber to Client class to ease configuration (mongodb#1195)
  Master is now 1.18-dev
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.

3 participants