Skip to content

Commit d77c317

Browse files
authored
Improve lookup table pattern use in profiles. (#592)
Based on implementation experience with the draft version of the profiles spec, the use of lookup tables for storing values is space efficient but not particularly user friendly. This change makes improvements by changing field names to clarify their role in the pattern and changing their data types to better accommodate their use in languages limited to 32 bit array indexing e.g. Java.
1 parent 7312bdf commit d77c317

1 file changed

Lines changed: 34 additions & 34 deletions

File tree

opentelemetry/proto/profiles/v1development/profiles.proto

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ message ScopeProfiles {
139139
// A list of Profiles that originate from an instrumentation scope.
140140
repeated Profile profiles = 2;
141141

142-
// The Schema URL, if known. This is the identifier of the Schema that the metric data
142+
// The Schema URL, if known. This is the identifier of the Schema that the profile data
143143
// is recorded in. To learn more about Schema URL see
144144
// https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
145145
// This schema_url applies to all profiles in the "profiles" field.
@@ -194,13 +194,13 @@ message Profile {
194194
// into that address range. mapping[0] will be the main binary.
195195
// If multiple binaries contribute to the Profile and no main
196196
// binary can be identified, mapping[0] has no special meaning.
197-
repeated Mapping mapping = 3;
197+
repeated Mapping mapping_table = 3;
198198
// Locations referenced by samples via location_indices.
199-
repeated Location location = 4;
199+
repeated Location location_table = 4;
200200
// Array of locations referenced by samples.
201-
repeated int64 location_indices = 15;
201+
repeated int32 location_indices = 15;
202202
// Functions referenced by locations.
203-
repeated Function function = 5;
203+
repeated Function function_table = 5;
204204
// Lookup table for attributes.
205205
repeated opentelemetry.proto.common.v1.KeyValue attribute_table = 16;
206206
// Represents a mapping between Attribute Keys and Units.
@@ -212,10 +212,10 @@ message Profile {
212212
repeated string string_table = 6;
213213
// frames with Function.function_name fully matching the following
214214
// regexp will be dropped from the samples, along with their successors.
215-
int64 drop_frames = 7; // Index into string table.
215+
int32 drop_frames_strindex = 7; // Index into string table.
216216
// frames with Function.function_name fully matching the following
217217
// regexp will be kept, even if it matches drop_frames.
218-
int64 keep_frames = 8; // Index into string table.
218+
int32 keep_frames_strindex = 8; // Index into string table.
219219

220220
// The following fields 9-14 are informational, do not affect
221221
// interpretation of results.
@@ -234,10 +234,10 @@ message Profile {
234234
// should not be used to store any machine-readable information, it is only
235235
// for human-friendly content. The profile must stay functional if this field
236236
// is cleaned.
237-
repeated int64 comment = 13; // Indices into string table.
237+
repeated int32 comment_strindices = 13; // Indices into string table.
238238
// Index into the string table of the type of the preferred sample
239239
// value. If unset, clients should default to the last sample value.
240-
int64 default_sample_type = 14;
240+
int32 default_sample_type_strindex = 14;
241241

242242

243243
// A globally unique identifier for a profile. The ID is a 16-byte array. An ID with
@@ -280,9 +280,9 @@ message Profile {
280280
// Represents a mapping between Attribute Keys and Units.
281281
message AttributeUnit {
282282
// Index into string table.
283-
int64 attribute_key = 1;
283+
int32 attribute_key_strindex = 1;
284284
// Index into string table.
285-
int64 unit = 2;
285+
int32 unit_strindex = 2;
286286
}
287287

288288
// A pointer from a profile Sample to a trace Span.
@@ -366,8 +366,8 @@ enum AggregationTemporality {
366366

367367
// ValueType describes the type and units of a value, with an optional aggregation temporality.
368368
message ValueType {
369-
int64 type = 1; // Index into string table.
370-
int64 unit = 2; // Index into string table.
369+
int32 type_strindex = 1; // Index into string table.
370+
int32 unit_strindex = 2; // Index into string table.
371371

372372
AggregationTemporality aggregation_temporality = 3;
373373
}
@@ -377,15 +377,15 @@ message ValueType {
377377
// augmented with auxiliary information like the thread-id, some
378378
// indicator of a higher level request being handled etc.
379379
message Sample {
380-
// The indices recorded here correspond to locations in Profile.location.
380+
// References to locations in Profile.location_table.
381381
// The leaf is at location_index[0]. [deprecated, superseded by locations_start_index / locations_length]
382-
repeated uint64 location_index = 1;
383-
// locations_start_index along with locations_length refers to to a slice of locations in Profile.location.
382+
repeated int32 location_index = 1;
383+
// locations_start_index along with locations_length refers to to a slice of locations in Profile.location_indices.
384384
// Supersedes location_index.
385-
uint64 locations_start_index = 7;
386-
// locations_length along with locations_start_index refers to a slice of locations in Profile.location.
385+
int32 locations_start_index = 7;
386+
// locations_length along with locations_start_index refers to a slice of locations in Profile.location_indices.
387387
// Supersedes location_index.
388-
uint64 locations_length = 8;
388+
int32 locations_length = 8;
389389
// The type and unit of each value is defined by the corresponding
390390
// entry in Profile.sample_type. All samples must have the same
391391
// number of values, the same as the length of Profile.sample_type.
@@ -394,10 +394,10 @@ message Sample {
394394
// lists of the originals.
395395
repeated int64 value = 2;
396396
// References to attributes in Profile.attribute_table. [optional]
397-
repeated uint64 attributes = 10;
397+
repeated int32 attribute_indices = 10;
398398

399399
// Reference to link in Profile.link_table. [optional]
400-
uint64 link = 12;
400+
int32 link_index = 12;
401401

402402
// Timestamps associated with Sample represented in nanoseconds. These timestamps are expected
403403
// to fall within the Profile's time range. [optional]
@@ -407,10 +407,10 @@ message Sample {
407407
// Provides additional context for a sample,
408408
// such as thread ID or allocation size, with optional units. [deprecated]
409409
message Label {
410-
int64 key = 1; // Index into string table
410+
int32 key_strindex = 1; // Index into string table
411411

412412
// At most one of the following must be present
413-
int64 str = 2; // Index into string table
413+
int32 str_strindex = 2; // Index into string table
414414
int64 num = 3;
415415

416416
// Should only be present when num is present.
@@ -420,7 +420,7 @@ message Label {
420420
// Consumers may also interpret units like "bytes" and "kilobytes" as memory
421421
// units and units like "seconds" and "nanoseconds" as time units,
422422
// and apply appropriate unit conversions to these.
423-
int64 num_unit = 4; // Index into string table
423+
int32 num_unit_strindex = 4; // Index into string table
424424
}
425425

426426
// Describes the mapping of a binary in memory, including its address range,
@@ -437,9 +437,9 @@ message Mapping {
437437
// The object this entry is loaded from. This can be a filename on
438438
// disk for the main binary and shared libraries, or virtual
439439
// abstractions like "[vdso]".
440-
int64 filename = 5; // Index into string table
440+
int32 filename_strindex = 5; // Index into string table
441441
// References to attributes in Profile.attribute_table. [optional]
442-
repeated uint64 attributes = 12;
442+
repeated int32 attribute_indices = 12;
443443
// The following fields indicate the resolution of symbolic info.
444444
bool has_functions = 7;
445445
bool has_filenames = 8;
@@ -452,10 +452,10 @@ message Location {
452452
// Unique nonzero id for the location. A profile could use
453453
// instruction addresses or any integer sequence as ids. [deprecated]
454454
uint64 id = 1;
455-
// The index of the corresponding profile.Mapping for this location.
455+
// Reference to mapping in Profile.mapping_table.
456456
// It can be unset if the mapping is unknown or not applicable for
457457
// this profile type.
458-
uint64 mapping_index = 2;
458+
int32 mapping_index = 2;
459459
// The instruction address for this location, if available. It
460460
// should be within [Mapping.memory_start...Mapping.memory_limit]
461461
// for the corresponding mapping. A non-leaf address may be in the
@@ -478,13 +478,13 @@ message Location {
478478
bool is_folded = 5;
479479

480480
// References to attributes in Profile.attribute_table. [optional]
481-
repeated uint64 attributes = 7;
481+
repeated int32 attribute_indices = 7;
482482
}
483483

484484
// Details a specific line in a source code, linked to a function.
485485
message Line {
486-
// The index of the corresponding profile.Function for this line.
487-
uint64 function_index = 1;
486+
// Reference to function in Profile.function_table.
487+
int32 function_index = 1;
488488
// Line number in source code.
489489
int64 line = 2;
490490
// Column number in source code.
@@ -497,12 +497,12 @@ message Function {
497497
// Unique nonzero id for the function. [deprecated]
498498
uint64 id = 1;
499499
// Name of the function, in human-readable form if available.
500-
int64 name = 2; // Index into string table
500+
int32 name_strindex = 2; // Index into string table
501501
// Name of the function, as identified by the system.
502502
// For instance, it can be a C++ mangled name.
503-
int64 system_name = 3; // Index into string table
503+
int32 system_name_strindex = 3; // Index into string table
504504
// Source file containing the function.
505-
int64 filename = 4; // Index into string table
505+
int32 filename_strindex = 4; // Index into string table
506506
// Line number in source file.
507507
int64 start_line = 5;
508508
}

0 commit comments

Comments
 (0)