[SERVER-45755] Implement special handling of Duration in logv2 Created: 24/Jan/20  Updated: 29/Oct/23  Resolved: 28/Jan/20

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.3.4

Type: Task Priority: Major - P3
Reporter: Henrik Edin Assignee: Henrik Edin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Dev Tools 2020-01-27
Participants:

 Description   

When logging duration objects we want special formatting to occur:

"duration"_attr = Milliseconds(10)

Should be formatted as:

"durationMillis": 10

Where the attribute name is updated with a unit suffix added and the value should just be the duration count.

It creates an inconsistency we're determined is acceptable:

When logging durations in containers, such as:

std::vector<Milliseconds> vec = {Milliseconds(10), Milliseconds(50)};
"things"_attr = vec

There is no attribute name for each duration that we can update and the duration will instead be logged as an object instead of just a scalar:

things: [{"durationMillis": 10}, {"durationMillis": 50}]



 Comments   
Comment by Githook User [ 28/Jan/20 ]

Author:

{'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin', 'name': 'Henrik Edin'}

Message: SERVER-45755 Special formatting for duration type in logv2

Unit suffix gets appended to attribute name when creating JSON field name.
Branch: master
https://github.com/mongodb/mongo/commit/24f2cf176a6401afcbb2280e4f0a7a016854464c

Generated at Thu Feb 08 05:09:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.