Skip to content

Commit

Permalink
DRIVERS-3089 document durationMS in logs may be Int32/Int64/Double (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinAlbs authored Jan 24, 2025
1 parent 60fe09f commit d9b434d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,11 @@ placeholders as appropriate:

In addition to the common fields, command succeeded messages MUST contain the following key-value pairs:

| Key | Suggested Type | Value |
| ---------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| message | String | "Command succeeded" |
| durationMS | Int | The execution time for the command in milliseconds. The calculated value MUST be the time to send the message and receive the reply from the server and MAY include BSON serialization and/or deserialization. |
| reply | String | Relaxed extJSON representation of the reply. This document MUST be truncated appropriately according to rules defined in the [logging specification](../logging/logging.md#configurable-max-document-length), and MUST be replaced with an empty document "{ }" if the command is considered sensitive. |
| Key | Suggested Type | Value |
| ---------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| message | String | "Command succeeded" |
| durationMS | Int32/Int64/Double | The execution time for the command in milliseconds. The calculated value MUST be the time to send the message and receive the reply from the server and MAY include BSON serialization and/or deserialization. |
| reply | String | Relaxed extJSON representation of the reply. This document MUST be truncated appropriately according to rules defined in the [logging specification](../logging/logging.md#configurable-max-document-length), and MUST be replaced with an empty document "{ }" if the command is considered sensitive. |

The unstructured form SHOULD be as follows, using the values defined in the structured format above to fill in
placeholders as appropriate:
Expand All @@ -415,11 +415,11 @@ placeholders as appropriate:

In addition to the common fields, command failed messages MUST contain the following key-value pairs:

| Key | Suggested Type | Value |
| ---------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| message | String | "Command failed" |
| durationMS | Int | The execution time for the command in milliseconds. The calculated value MUST be the time to send the message and receive the reply from the server and MAY include BSON serialization and/or deserialization. |
| failure | Flexible | The error. The type and format of this value is flexible; see the [logging specification](../logging/logging.md#representing-errors-in-log-messages) for details on representing errors in log messages. If the command is considered sensitive, the error MUST be redacted and replaced with a language-appropriate alternative for a redacted error, e.g. an empty string, empty document, or null. |
| Key | Suggested Type | Value |
| ---------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| message | String | "Command failed" |
| durationMS | Int32/Int64/Double | The execution time for the command in milliseconds. The calculated value MUST be the time to send the message and receive the reply from the server and MAY include BSON serialization and/or deserialization. |
| failure | Flexible | The error. The type and format of this value is flexible; see the [logging specification](../logging/logging.md#representing-errors-in-log-messages) for details on representing errors in log messages. If the command is considered sensitive, the error MUST be redacted and replaced with a language-appropriate alternative for a redacted error, e.g. an empty string, empty document, or null. |

The unstructured form SHOULD be as follows, using the values defined in the structured format above to fill in
placeholders as appropriate:
Expand All @@ -444,6 +444,8 @@ penalties, particularly when event listeners are introduced.

## Changelog

- 2025-01-22: Clarify durationMS in logs may be Int32/Int64/Double.

- 2024-09-11: Migrated from reStructuredText to Markdown.

- 2015-09-16: Removed `limit` from find test with options to support 3.2.\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1105,11 +1105,11 @@ placeholders as appropriate:

In addition to the common fields defined above, this message MUST contain the following key-value pairs:

| Key | Suggested Type | Value |
| ------------------ | -------------- | ----------------------------------------------------------------------------------- |
| message | String | "Connection ready" |
| driverConnectionId | Int64 | The driver-generated ID for the connection as defined in [Connection](#connection). |
| durationMS | Int64 | `ConnectionReadyEvent.duration` converted to milliseconds. |
| Key | Suggested Type | Value |
| ------------------ | ------------------ | ----------------------------------------------------------------------------------- |
| message | String | "Connection ready" |
| driverConnectionId | Int64 | The driver-generated ID for the connection as defined in [Connection](#connection). |
| durationMS | Int32/Int64/Double | `ConnectionReadyEvent.duration` converted to milliseconds. |

The unstructured form SHOULD be as follows, using the values defined in the structured format above to fill in
placeholders as appropriate:
Expand Down Expand Up @@ -1151,12 +1151,12 @@ placeholders as appropriate:

In addition to the common fields defined above, this message MUST contain the following key-value pairs:

| Key | Suggested Type | Value |
| ---------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| message | String | "Connection checkout failed" |
| reason | String | A string describing the reason checkout. The following strings MUST be used for each possible reason as defined in [Events](#events) above:<br>- Timeout: "Wait queue timeout elapsed without a connection becoming available"<br>- ConnectionError: "An error occurred while trying to establish a new connection"<br>- Pool closed: "Connection pool was closed" |
| error | Flexible | If `reason` is `ConnectionError`, the associated error. The type and format of this value is flexible; see the [logging specification](../logging/logging.md#representing-errors-in-log-messages) for details on representing errors in log messages. |
| durationMS | Int64 | `ConnectionCheckOutFailedEvent.duration` converted to milliseconds. |
| Key | Suggested Type | Value |
| ---------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| message | String | "Connection checkout failed" |
| reason | String | A string describing the reason checkout. The following strings MUST be used for each possible reason as defined in [Events](#events) above:<br>- Timeout: "Wait queue timeout elapsed without a connection becoming available"<br>- ConnectionError: "An error occurred while trying to establish a new connection"<br>- Pool closed: "Connection pool was closed" |
| error | Flexible | If `reason` is `ConnectionError`, the associated error. The type and format of this value is flexible; see the [logging specification](../logging/logging.md#representing-errors-in-log-messages) for details on representing errors in log messages. |
| durationMS | Int32/Int64/Double | `ConnectionCheckOutFailedEvent.duration` converted to milliseconds. |

The unstructured form SHOULD be as follows, using the values defined in the structured format above to fill in
placeholders as appropriate:
Expand All @@ -1168,11 +1168,11 @@ placeholders as appropriate:

In addition to the common fields defined above, this message MUST contain the following key-value pairs:

| Key | Suggested Type | Value |
| ------------------ | -------------- | ----------------------------------------------------------------------------------- |
| message | String | "Connection checked out" |
| driverConnectionId | Int64 | The driver-generated ID for the connection as defined in [Connection](#connection). |
| durationMS | Int64 | `ConnectionCheckedOutEvent.duration` converted to milliseconds. |
| Key | Suggested Type | Value |
| ------------------ | ------------------ | ----------------------------------------------------------------------------------- |
| message | String | "Connection checked out" |
| driverConnectionId | Int64 | The driver-generated ID for the connection as defined in [Connection](#connection). |
| durationMS | Int32/Int64/Double | `ConnectionCheckedOutEvent.duration` converted to milliseconds. |

The unstructured form SHOULD be as follows, using the values defined in the structured format above to fill in
placeholders as appropriate:
Expand Down Expand Up @@ -1375,6 +1375,8 @@ to close and remove from its pool a [Connection](#connection) which has unread e

## Changelog

- 2025-01-22: Clarify durationMS in logs may be Int32/Int64/Double.

- 2024-11-27: Relaxed the WaitQueue fairness requirement.

- 2024-11-01: Fixed race condition in pool-checkout-returned-connection-maxConnecting.yml test.
Expand Down
Loading

0 comments on commit d9b434d

Please sign in to comment.