@@ -284,9 +284,14 @@ message Profile {
284284 // The following fields 3-12 are informational, do not affect
285285 // interpretation of results.
286286
287- // Time of collection (UTC) represented as nanoseconds past the epoch.
287+ // Time of collection. Value is UNIX Epoch time in nanoseconds since 00:00:00
288+ // UTC on 1 January 1970.
288289 fixed64 time_unix_nano = 3 ;
289- // Duration of the profile, if a duration makes sense.
290+ // Duration of the profile. For instant profiles like live heap snapshot, the
291+ // duration can be zero but it may be preferable to set time_unix_nano to the
292+ // process start time and duration_nano to the relative time when the profile
293+ // was gathered. This ensures Sample.timestamps_unix_nano values such as
294+ // allocation timestamp fall into the profile time range.
290295 uint64 duration_nano = 4 ;
291296 // The kind of events between sampled occurrences.
292297 // e.g [ "cpu","cycles" ] or [ "heap","bytes" ]
@@ -364,7 +369,11 @@ message ValueType {
364369// both fields are populated, they MUST contain the same number of elements, and
365370// the elements at the same index MUST refer to the same event.
366371//
367- // Examples of different ways of representing a sample with the total value of 10:
372+ // For the purposes of efficiently representing aggregated data observations, a Sample is regarded
373+ // as having a shared identity and an associated collection of per-observation data points.
374+ // Samples having the same identity SHOULD be combined by inserting timestamps and values to the data arrays.
375+ //
376+ // Examples of different ways ('shapes') of representing a sample with the total value of 10:
368377//
369378// Report of a stacktrace at 10 timestamps (consumers must assume the value is 1 for each point):
370379// values: []
@@ -377,20 +386,30 @@ message ValueType {
377386// Report of a stacktrace at 4 timestamps where each point records a specific value:
378387// values: [2, 2, 3, 3]
379388// timestamps_unix_nano: [1, 2, 3, 4]
389+ //
390+ // All Samples for a Profile SHOULD have the same shape, i.e. all data observation series should consistently
391+ // adopt the same data recording style.
392+ //
380393message Sample {
394+
395+ // A Sample's identity (i.e. 'primary key') is the tuple of {stack_index, set_of(attribute_indices), link_index}
396+
381397 // Reference to stack in ProfilesDictionary.stack_table.
382398 int32 stack_index = 1 ;
383- // The type and unit of each value is defined by Profile.sample_type.
384- repeated int64 values = 2 ;
385399 // References to attributes in ProfilesDictionary.attribute_table. [optional]
386- repeated int32 attribute_indices = 3 ;
387-
400+ repeated int32 attribute_indices = 2 ;
388401 // Reference to link in ProfilesDictionary.link_table. [optional]
389402 // It can be unset / set to 0 if no link exists, as link_table[0] is always a 'null' default value.
390- int32 link_index = 4 ;
403+ int32 link_index = 3 ;
391404
392- // Timestamps associated with Sample represented in nanoseconds. These
393- // timestamps should fall within the Profile's time range.
405+ // The following fields may contain per-observation data and do not form part of the Sample's identity.
406+
407+ // The type and unit of each value is defined by Profile.sample_type.
408+ repeated int64 values = 4 ;
409+ // Timestamps associated with Sample. Value is UNIX Epoch time in nanoseconds
410+ // since 00:00:00 UTC on 1 January 1970. The timestamps should fall within the
411+ // [Profile.time_unix_nano, Profile.time_unix_nano + Profile.duration_nano)
412+ // time range.
394413 repeated fixed64 timestamps_unix_nano = 5 ;
395414}
396415
0 commit comments