@@ -172,6 +172,16 @@ mongoc_structured_log_instance_destroy (mongoc_structured_log_instance_t *instan
172
172
#define _mongoc_structured_log_item_int64 (_key_or_null , _value_int64 ) \
173
173
{.func = _mongoc_structured_log_append_int64, .arg1.utf8 = (_key_or_null), .arg2.int64 = (_value_int64)},
174
174
175
+ /**
176
+ * @def double(key, value)
177
+ * @brief Structured log item, double precision floating point
178
+ *
179
+ * @param key Key as a NUL-terminated const char * expression, or NULL to skip this item.
180
+ * @param value Value as a double expression.
181
+ */
182
+ #define _mongoc_structured_log_item_double (_key_or_null , _value_double ) \
183
+ {.func = _mongoc_structured_log_append_double, .arg1.utf8 = (_key_or_null), .arg2.double_value = (_value_double)},
184
+
175
185
/**
176
186
* @def boolean(key, value)
177
187
* @brief Structured log item, boolean
@@ -337,12 +347,9 @@ typedef enum {
337
347
* @def monotonic_time_duration(duration)
338
348
* @brief Structured log item, standard format for a duration in monotonic time.
339
349
* @param duration Duration in microseconds, as an int64_t expression.
340
- *
341
- * Includes milliseconds for consistency across drivers, and microseconds as the highest available resolution.
342
350
*/
343
- #define _mongoc_structured_log_item_monotonic_time_duration (_duration ) \
344
- _mongoc_structured_log_item_int32 ("durationMS", (int32_t) ((_duration) / 1000)) \
345
- _mongoc_structured_log_item_int64 ("durationMicros", (_duration))
351
+ #define _mongoc_structured_log_item_monotonic_time_duration (_duration ) \
352
+ _mongoc_structured_log_item_double ("durationMS", (_duration) * 1e-3)
346
353
347
354
typedef struct mongoc_structured_log_builder_stage_t mongoc_structured_log_builder_stage_t ;
348
355
@@ -371,6 +378,7 @@ struct mongoc_structured_log_builder_stage_t {
371
378
const char * utf8 ;
372
379
const mongoc_read_prefs_t * read_prefs ;
373
380
const struct _mongoc_topology_t * topology ;
381
+ double double_value ;
374
382
int32_t int32 ;
375
383
int64_t int64 ;
376
384
mongoc_error_content_flags_t error_flags ;
@@ -428,6 +436,11 @@ _mongoc_structured_log_append_int64 (bson_t *bson,
428
436
const mongoc_structured_log_builder_stage_t * stage ,
429
437
const mongoc_structured_log_opts_t * opts );
430
438
439
+ const mongoc_structured_log_builder_stage_t *
440
+ _mongoc_structured_log_append_double (bson_t * bson ,
441
+ const mongoc_structured_log_builder_stage_t * stage ,
442
+ const mongoc_structured_log_opts_t * opts );
443
+
431
444
const mongoc_structured_log_builder_stage_t *
432
445
_mongoc_structured_log_append_boolean (bson_t * bson ,
433
446
const mongoc_structured_log_builder_stage_t * stage ,
0 commit comments