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

OGM-1589: Add hibernate-ogm metadata to MongoClient construction #1135

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

jyemin
Copy link
Contributor

@jyemin jyemin commented Sep 5, 2024

This change allows users to track which connections are coming from hibernate-ogm by examining the MongoDB server logs, by looking for log statements like this:

{
  "t": {
    "$date": "2024-09-05T11:52:33.248-04:00"
  },
  "s": "D2",
  "c": "COMMAND",
  "id": 21965,
  "ctx": "conn304",
  "commandArgs": {
    "isMaster": 1,
    "helloOk": true,
    "client": {
      "driver": {
        "name": "mongo-java-driver|legacy|hibernate-ogm",
        "version": "4.11.3|5.4.2"
      },
      "os": {
        "type": "Darwin",
        "name": "Mac OS X",
        "architecture": "x86_64",
        "version": "14.6.1"
      },
      "platform": "Java/Amazon.com Inc./1.8.0_422-b05"
    },
    "$db": "admin"
  }
}

Note the driver name and version refer to both the underlying MongoDB Java driver and hibernate-ogm.

https://hibernate.atlassian.net/browse/OGM-1589

This change allows users to track which connections are coming
from hibernate-ogm by examining the MongoDB server logs, by
looking for log statements like this:

{
  "t": {
    "$date": "2024-09-05T11:52:33.248-04:00"
  },
  "s": "D2",
  "c": "COMMAND",
  "id": 21965,
  "ctx": "conn304",
  "commandArgs": {
    "isMaster": 1,
    "helloOk": true,
    "client": {
      "driver": {
        "name": "mongo-java-driver|legacy|hibernate-ogm",
        "version": "4.11.3|5.4.2"
      },
      "os": {
        "type": "Darwin",
        "name": "Mac OS X",
        "architecture": "x86_64",
        "version": "14.6.1"
      },
      "platform": "Java/Amazon.com Inc./1.8.0_422-b05"
    },
    "$db": "admin"
  }
}

Note the driver name and version refer to both the underlying MongoDB Java driver and hibernate-ogm.
@jyemin jyemin requested a review from DavideD September 5, 2024 16:11
@jyemin
Copy link
Contributor Author

jyemin commented Sep 5, 2024

@DavideD if you don't mind please take a look at this small PR. Thanks!

@DavideD DavideD merged commit 5ea6b53 into hibernate:main Sep 6, 2024
6 checks passed
@DavideD
Copy link
Member

DavideD commented Sep 6, 2024

Merged, thanks

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.

2 participants