[SERVER-21241] Record timestamp in root of sample document Created: 01/Nov/15  Updated: 17/Nov/15  Resolved: 06/Nov/15

Status: Closed
Project: Core Server
Component/s: Diagnostics
Affects Version/s: None
Fix Version/s: 3.2.0-rc3

Type: Improvement Priority: Minor - P4
Reporter: Bruce Lucas (Inactive) Assignee: Mark Benvenuto
Resolution: Done Votes: 1
Labels: FTDC
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Minor Change
Sprint: Platform C (11/20/15)
Participants:

 Description   

Currently timestamps are recorded in a few places (_id for chunk, start/end for each data source). However for certain kinds of filtering operations it is useful to have a guaranteed reliable place to find a timestamp for each sample. Currently the closest is serverStatus.start (or serverStatus.localTime), but that is potentially fragile in that it is tied to a particular data source (serverStatus), and as we expand the range of data sources (collections, system stats, etc.) we will want to make some data sources optional, and for consistency we may wish to make every data source optional.

A more robust and future-proof design would be to have a "start" (and possibly "end") timestamp for each sample at the root of the sample document, independent of any particular data source. If we do this now, the tooling could be made more future proof by using that as the timing source for the sample rather than relying on timestamps in serverStatus. Ideally the _id for the chunk would be the same as the start field of the first sample (although this is not a requirement).



 Comments   
Comment by Githook User [ 06/Nov/15 ]

Author:

{u'username': u'markbenvenuto', u'name': u'Mark Benvenuto', u'email': u'mark.benvenuto@mongodb.com'}

Message: SERVER-21241 Record timestamp in root of sample document
Branch: master
https://github.com/mongodb/mongo/commit/02eb7fa6d33d23244d41a876867d0b64f75f096f

Comment by Bruce Lucas (Inactive) [ 04/Nov/15 ]

Yes, that is correct. (Specifically I care about "start", but it seems natural to also have "end" for consistency).

Comment by Mark Benvenuto [ 04/Nov/15 ]

The current BSON document is as follows:

Example:

{
"_id" : Date_t
"type" : 1
"data" : BinData(...)
 }

The BinData blob has this format for the reference document:

 {
                “serverStatus” : {
                        “start” : ISODate("2015-08-03T18:30:20.809Z"),
                        “data” : {  ... },
			“end” : ISODate("2015-08-03T18:30:20.809Z"),
                },
                “buildInfo” : {
                        “start” : ISODate("2015-08-03T18:30:20.809Z"),
                        “data” : {  ... },
			“end” : ISODate("2015-08-03T18:30:20.809Z"),
                },
                ... 
        }

Your proposal is to have the following:

 {
                “start” : ISODate("2015-08-03T18:30:20.809Z"), // NEW FIELD
                “serverStatus” : {
                        “start” : ISODate("2015-08-03T18:30:20.809Z"),
                        “data” : { 
                        ... },
			“end” : ISODate("2015-08-03T18:30:20.809Z"),
                },
                “buildInfo” : {
                        “start” : ISODate("2015-08-03T18:30:20.809Z"),
                        “data” : {  ... },
			“end” : ISODate("2015-08-03T18:30:20.809Z"),
                },
                ... 
                “end” : ISODate("2015-08-03T18:30:20.809Z"), // NEW FIELD
        }

Generated at Thu Feb 08 03:56:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.