From 3c48769c41724cb3a9ffba89871604d07a5d9ada Mon Sep 17 00:00:00 2001 From: aaronabbott Date: Fri, 5 Dec 2025 22:01:12 +0000 Subject: [PATCH] Regenerate opentelemetry-proto code with v1.9.0 release Fixes https://github.com/open-telemetry/opentelemetry-python/issues/4804 I also simplified the script to use uv to manage deps --- CHANGELOG.md | 3 + opentelemetry-proto/README.rst | 4 +- .../proto/common/v1/common_pb2.pyi | 22 +- .../opentelemetry/proto/logs/v1/logs_pb2.pyi | 4 +- .../proto/metrics/v1/metrics_pb2.pyi | 55 +- .../profiles/v1development/profiles_pb2.py | 56 +- .../profiles/v1development/profiles_pb2.pyi | 582 ++++++++---------- .../proto/resource/v1/resource_pb2.pyi | 3 +- .../proto/trace/v1/trace_pb2.pyi | 36 +- scripts/proto_codegen.sh | 27 +- 10 files changed, 371 insertions(+), 421 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fa6d145d65..f97b89505f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +- Regenerate opentelemetry-proto code with v1.9.0 release + ([#4840](https://github.com/open-telemetry/opentelemetry-python/pull/4840)) + ## Version 1.39.0/0.60b0 (2025-12-03) - `opentelemetry-api`: Convert objects of any type other than AnyValue in attributes to string to be exportable diff --git a/opentelemetry-proto/README.rst b/opentelemetry-proto/README.rst index aa70bc7bb91..0d7b15db7b2 100644 --- a/opentelemetry-proto/README.rst +++ b/opentelemetry-proto/README.rst @@ -7,9 +7,9 @@ OpenTelemetry Python Proto :target: https://pypi.org/project/opentelemetry-proto/ This library contains the generated code for OpenTelemetry protobuf data model. The code in the current -package was generated using the v1.7.0 release_ of opentelemetry-proto. +package was generated using the v1.9.0 release_ of opentelemetry-proto. -.. _release: https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v1.7.0 +.. _release: https://github.com/open-telemetry/opentelemetry-proto/releases/tag/v1.9.0 Installation ------------ diff --git a/opentelemetry-proto/src/opentelemetry/proto/common/v1/common_pb2.pyi b/opentelemetry-proto/src/opentelemetry/proto/common/v1/common_pb2.pyi index 1f79b5b253c..5efe75c3f62 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/common/v1/common_pb2.pyi +++ b/opentelemetry-proto/src/opentelemetry/proto/common/v1/common_pb2.pyi @@ -31,7 +31,7 @@ DESCRIPTOR: google.protobuf.descriptor.FileDescriptor @typing_extensions.final class AnyValue(google.protobuf.message.Message): - """AnyValue is used to represent any type of attribute value. AnyValue may contain a + """Represents any type of attribute value. AnyValue may contain a primitive value such as a string or integer or it may contain an arbitrary nested object containing arrays, key-value lists and primitives. """ @@ -108,8 +108,10 @@ class KeyValueList(google.protobuf.message.Message): def values(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___KeyValue]: """A collection of key/value pairs of key-value pairs. The list may be empty (may contain 0 elements). + The keys MUST be unique (it is not allowed to have more than one value with the same key). + The behavior of software that receives duplicated keys can be unpredictable. """ def __init__( self, @@ -122,7 +124,7 @@ global___KeyValueList = KeyValueList @typing_extensions.final class KeyValue(google.protobuf.message.Message): - """KeyValue is a key-value pair that is used to store Span attributes, Link + """Represents a key-value pair that is used to store Span attributes, Link attributes, etc. """ @@ -131,8 +133,10 @@ class KeyValue(google.protobuf.message.Message): KEY_FIELD_NUMBER: builtins.int VALUE_FIELD_NUMBER: builtins.int key: builtins.str + """The key name of the pair.""" @property - def value(self) -> global___AnyValue: ... + def value(self) -> global___AnyValue: + """The value of the pair.""" def __init__( self, *, @@ -157,15 +161,25 @@ class InstrumentationScope(google.protobuf.message.Message): ATTRIBUTES_FIELD_NUMBER: builtins.int DROPPED_ATTRIBUTES_COUNT_FIELD_NUMBER: builtins.int name: builtins.str - """An empty instrumentation scope name means the name is unknown.""" + """A name denoting the Instrumentation scope. + An empty instrumentation scope name means the name is unknown. + """ version: builtins.str + """Defines the version of the instrumentation scope. + An empty instrumentation scope version means the version is unknown. + """ @property def attributes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___KeyValue]: """Additional attributes that describe the scope. [Optional]. Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key). + The behavior of software that receives duplicated keys can be unpredictable. """ dropped_attributes_count: builtins.int + """The number of attributes that were discarded. Attributes + can be discarded because their keys are too long or because there are too many + attributes. If this value is 0, then no attributes were dropped. + """ def __init__( self, *, diff --git a/opentelemetry-proto/src/opentelemetry/proto/logs/v1/logs_pb2.pyi b/opentelemetry-proto/src/opentelemetry/proto/logs/v1/logs_pb2.pyi index 0fa9cc363e9..343a4748a68 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/logs/v1/logs_pb2.pyi +++ b/opentelemetry-proto/src/opentelemetry/proto/logs/v1/logs_pb2.pyi @@ -222,7 +222,8 @@ class ScopeLogs(google.protobuf.message.Message): is recorded in. Notably, the last part of the URL path is the version number of the schema: http[s]://server[:port]/path/. To learn more about Schema URL see https://opentelemetry.io/docs/specs/otel/schemas/#schema-url - This schema_url applies to all logs in the "logs" field. + This schema_url applies to the data in the "scope" field and all logs in the + "log_records" field. """ def __init__( self, @@ -296,6 +297,7 @@ class LogRecord(google.protobuf.message.Message): """Additional attributes that describe the specific event occurrence. [Optional]. Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key). + The behavior of software that receives duplicated keys can be unpredictable. """ dropped_attributes_count: builtins.int flags: builtins.int diff --git a/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.pyi b/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.pyi index 5b547446933..0f374be93ee 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.pyi +++ b/opentelemetry-proto/src/opentelemetry/proto/metrics/v1/metrics_pb2.pyi @@ -326,7 +326,8 @@ class ScopeMetrics(google.protobuf.message.Message): is recorded in. Notably, the last part of the URL path is the version number of the schema: http[s]://server[:port]/path/. To learn more about Schema URL see https://opentelemetry.io/docs/specs/otel/schemas/#schema-url - This schema_url applies to all metrics in the "metrics" field. + This schema_url applies to the data in the "scope" field and all metrics in the + "metrics" field. """ def __init__( self, @@ -440,11 +441,11 @@ class Metric(google.protobuf.message.Message): SUMMARY_FIELD_NUMBER: builtins.int METADATA_FIELD_NUMBER: builtins.int name: builtins.str - """name of the metric.""" + """The name of the metric.""" description: builtins.str - """description of the metric, which can be used in documentation.""" + """A description of the metric, which can be used in documentation.""" unit: builtins.str - """unit in which the metric value is reported. Follows the format + """The unit in which the metric value is reported. Follows the format described by https://unitsofmeasure.org/ucum.html. """ @property @@ -466,6 +467,7 @@ class Metric(google.protobuf.message.Message): for lossless roundtrip translation to / from another data model. Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key). + The behavior of software that receives duplicated keys can be unpredictable. """ def __init__( self, @@ -503,7 +505,10 @@ class Gauge(google.protobuf.message.Message): DATA_POINTS_FIELD_NUMBER: builtins.int @property - def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___NumberDataPoint]: ... + def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___NumberDataPoint]: + """The time series data points. + Note: Multiple time series may be included (same timestamp, different attributes). + """ def __init__( self, *, @@ -525,13 +530,16 @@ class Sum(google.protobuf.message.Message): AGGREGATION_TEMPORALITY_FIELD_NUMBER: builtins.int IS_MONOTONIC_FIELD_NUMBER: builtins.int @property - def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___NumberDataPoint]: ... + def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___NumberDataPoint]: + """The time series data points. + Note: Multiple time series may be included (same timestamp, different attributes). + """ aggregation_temporality: global___AggregationTemporality.ValueType """aggregation_temporality describes if the aggregator reports delta changes since last report time, or cumulative changes since a fixed start time. """ is_monotonic: builtins.bool - """If "true" means that the sum is monotonic.""" + """Represents whether the sum is monotonic.""" def __init__( self, *, @@ -554,7 +562,10 @@ class Histogram(google.protobuf.message.Message): DATA_POINTS_FIELD_NUMBER: builtins.int AGGREGATION_TEMPORALITY_FIELD_NUMBER: builtins.int @property - def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___HistogramDataPoint]: ... + def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___HistogramDataPoint]: + """The time series data points. + Note: Multiple time series may be included (same timestamp, different attributes). + """ aggregation_temporality: global___AggregationTemporality.ValueType """aggregation_temporality describes if the aggregator reports delta changes since last report time, or cumulative changes since a fixed start time. @@ -580,7 +591,10 @@ class ExponentialHistogram(google.protobuf.message.Message): DATA_POINTS_FIELD_NUMBER: builtins.int AGGREGATION_TEMPORALITY_FIELD_NUMBER: builtins.int @property - def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ExponentialHistogramDataPoint]: ... + def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ExponentialHistogramDataPoint]: + """The time series data points. + Note: Multiple time series may be included (same timestamp, different attributes). + """ aggregation_temporality: global___AggregationTemporality.ValueType """aggregation_temporality describes if the aggregator reports delta changes since last report time, or cumulative changes since a fixed start time. @@ -612,7 +626,10 @@ class Summary(google.protobuf.message.Message): DATA_POINTS_FIELD_NUMBER: builtins.int @property - def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___SummaryDataPoint]: ... + def data_points(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___SummaryDataPoint]: + """The time series data points. + Note: Multiple time series may be included (same timestamp, different attributes). + """ def __init__( self, *, @@ -643,6 +660,7 @@ class NumberDataPoint(google.protobuf.message.Message): where this point belongs. The list may be empty (may contain 0 elements). Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key). + The behavior of software that receives duplicated keys can be unpredictable. """ start_time_unix_nano: builtins.int """StartTimeUnixNano is optional but strongly encouraged, see the @@ -718,6 +736,7 @@ class HistogramDataPoint(google.protobuf.message.Message): where this point belongs. The list may be empty (may contain 0 elements). Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key). + The behavior of software that receives duplicated keys can be unpredictable. """ start_time_unix_nano: builtins.int """StartTimeUnixNano is optional but strongly encouraged, see the @@ -838,13 +857,13 @@ class ExponentialHistogramDataPoint(google.protobuf.message.Message): OFFSET_FIELD_NUMBER: builtins.int BUCKET_COUNTS_FIELD_NUMBER: builtins.int offset: builtins.int - """Offset is the bucket index of the first entry in the bucket_counts array. + """The bucket index of the first entry in the bucket_counts array. Note: This uses a varint encoding as a simple form of compression. """ @property def bucket_counts(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: - """bucket_counts is an array of count values, where bucket_counts[i] carries + """An array of count values, where bucket_counts[i] carries the count of the bucket at index (offset+i). bucket_counts[i] is the count of values greater than base^(offset+i) and less than or equal to base^(offset+i+1). @@ -882,6 +901,7 @@ class ExponentialHistogramDataPoint(google.protobuf.message.Message): where this point belongs. The list may be empty (may contain 0 elements). Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key). + The behavior of software that receives duplicated keys can be unpredictable. """ start_time_unix_nano: builtins.int """StartTimeUnixNano is optional but strongly encouraged, see the @@ -897,12 +917,12 @@ class ExponentialHistogramDataPoint(google.protobuf.message.Message): 1970. """ count: builtins.int - """count is the number of values in the population. Must be + """The number of values in the population. Must be non-negative. This value must be equal to the sum of the "bucket_counts" values in the positive and negative Buckets plus the "zero_count" field. """ sum: builtins.float - """sum of the values in the population. If count is zero then this field + """The sum of the values in the population. If count is zero then this field must be zero. Note: Sum should only be filled out when measuring non-negative discrete @@ -929,7 +949,7 @@ class ExponentialHistogramDataPoint(google.protobuf.message.Message): values depend on the range of the data. """ zero_count: builtins.int - """zero_count is the count of values that are either exactly zero or + """The count of values that are either exactly zero or within the region considered zero by the instrumentation at the tolerated degree of precision. This bucket stores values that cannot be expressed using the standard exponential formula as @@ -954,9 +974,9 @@ class ExponentialHistogramDataPoint(google.protobuf.message.Message): measurements that were used to form the data point """ min: builtins.float - """min is the minimum value over (start_time, end_time].""" + """The minimum value over (start_time, end_time].""" max: builtins.float - """max is the maximum value over (start_time, end_time].""" + """The maximum value over (start_time, end_time].""" zero_threshold: builtins.float """ZeroThreshold may be optionally set to convey the width of the zero region. Where the zero region is defined as the closed interval @@ -1049,6 +1069,7 @@ class SummaryDataPoint(google.protobuf.message.Message): where this point belongs. The list may be empty (may contain 0 elements). Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key). + The behavior of software that receives duplicated keys can be unpredictable. """ start_time_unix_nano: builtins.int """StartTimeUnixNano is optional but strongly encouraged, see the diff --git a/opentelemetry-proto/src/opentelemetry/proto/profiles/v1development/profiles_pb2.py b/opentelemetry-proto/src/opentelemetry/proto/profiles/v1development/profiles_pb2.py index 70e6b239a1f..b868549e41c 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/profiles/v1development/profiles_pb2.py +++ b/opentelemetry-proto/src/opentelemetry/proto/profiles/v1development/profiles_pb2.py @@ -16,7 +16,7 @@ from opentelemetry.proto.resource.v1 import resource_pb2 as opentelemetry_dot_proto_dot_resource_dot_v1_dot_resource__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n9opentelemetry/proto/profiles/v1development/profiles.proto\x12*opentelemetry.proto.profiles.v1development\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"\xee\x03\n\x12ProfilesDictionary\x12J\n\rmapping_table\x18\x01 \x03(\x0b\x32\x33.opentelemetry.proto.profiles.v1development.Mapping\x12L\n\x0elocation_table\x18\x02 \x03(\x0b\x32\x34.opentelemetry.proto.profiles.v1development.Location\x12L\n\x0e\x66unction_table\x18\x03 \x03(\x0b\x32\x34.opentelemetry.proto.profiles.v1development.Function\x12\x44\n\nlink_table\x18\x04 \x03(\x0b\x32\x30.opentelemetry.proto.profiles.v1development.Link\x12\x14\n\x0cstring_table\x18\x05 \x03(\t\x12@\n\x0f\x61ttribute_table\x18\x06 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\x12R\n\x0f\x61ttribute_units\x18\x07 \x03(\x0b\x32\x39.opentelemetry.proto.profiles.v1development.AttributeUnit\"\xbb\x01\n\x0cProfilesData\x12W\n\x11resource_profiles\x18\x01 \x03(\x0b\x32<.opentelemetry.proto.profiles.v1development.ResourceProfiles\x12R\n\ndictionary\x18\x02 \x01(\x0b\x32>.opentelemetry.proto.profiles.v1development.ProfilesDictionary\"\xbe\x01\n\x10ResourceProfiles\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12Q\n\x0escope_profiles\x18\x02 \x03(\x0b\x32\x39.opentelemetry.proto.profiles.v1development.ScopeProfiles\x12\x12\n\nschema_url\x18\x03 \x01(\tJ\x06\x08\xe8\x07\x10\xe9\x07\"\xae\x01\n\rScopeProfiles\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12\x45\n\x08profiles\x18\x02 \x03(\x0b\x32\x33.opentelemetry.proto.profiles.v1development.Profile\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\x86\x04\n\x07Profile\x12J\n\x0bsample_type\x18\x01 \x03(\x0b\x32\x35.opentelemetry.proto.profiles.v1development.ValueType\x12\x42\n\x06sample\x18\x02 \x03(\x0b\x32\x32.opentelemetry.proto.profiles.v1development.Sample\x12\x18\n\x10location_indices\x18\x03 \x03(\x05\x12\x12\n\ntime_nanos\x18\x04 \x01(\x03\x12\x16\n\x0e\x64uration_nanos\x18\x05 \x01(\x03\x12J\n\x0bperiod_type\x18\x06 \x01(\x0b\x32\x35.opentelemetry.proto.profiles.v1development.ValueType\x12\x0e\n\x06period\x18\x07 \x01(\x03\x12\x1a\n\x12\x63omment_strindices\x18\x08 \x03(\x05\x12!\n\x19\x64\x65\x66\x61ult_sample_type_index\x18\t \x01(\x05\x12\x12\n\nprofile_id\x18\n \x01(\x0c\x12 \n\x18\x64ropped_attributes_count\x18\x0b \x01(\r\x12\x1f\n\x17original_payload_format\x18\x0c \x01(\t\x12\x18\n\x10original_payload\x18\r \x01(\x0c\x12\x19\n\x11\x61ttribute_indices\x18\x0e \x03(\x05\"F\n\rAttributeUnit\x12\x1e\n\x16\x61ttribute_key_strindex\x18\x01 \x01(\x05\x12\x15\n\runit_strindex\x18\x02 \x01(\x05\")\n\x04Link\x12\x10\n\x08trace_id\x18\x01 \x01(\x0c\x12\x0f\n\x07span_id\x18\x02 \x01(\x0c\"\x9e\x01\n\tValueType\x12\x15\n\rtype_strindex\x18\x01 \x01(\x05\x12\x15\n\runit_strindex\x18\x02 \x01(\x05\x12\x63\n\x17\x61ggregation_temporality\x18\x03 \x01(\x0e\x32\x42.opentelemetry.proto.profiles.v1development.AggregationTemporality\"\xb1\x01\n\x06Sample\x12\x1d\n\x15locations_start_index\x18\x01 \x01(\x05\x12\x18\n\x10locations_length\x18\x02 \x01(\x05\x12\r\n\x05value\x18\x03 \x03(\x03\x12\x19\n\x11\x61ttribute_indices\x18\x04 \x03(\x05\x12\x17\n\nlink_index\x18\x05 \x01(\x05H\x00\x88\x01\x01\x12\x1c\n\x14timestamps_unix_nano\x18\x06 \x03(\x04\x42\r\n\x0b_link_index\"\xe3\x01\n\x07Mapping\x12\x14\n\x0cmemory_start\x18\x01 \x01(\x04\x12\x14\n\x0cmemory_limit\x18\x02 \x01(\x04\x12\x13\n\x0b\x66ile_offset\x18\x03 \x01(\x04\x12\x19\n\x11\x66ilename_strindex\x18\x04 \x01(\x05\x12\x19\n\x11\x61ttribute_indices\x18\x05 \x03(\x05\x12\x15\n\rhas_functions\x18\x06 \x01(\x08\x12\x15\n\rhas_filenames\x18\x07 \x01(\x08\x12\x18\n\x10has_line_numbers\x18\x08 \x01(\x08\x12\x19\n\x11has_inline_frames\x18\t \x01(\x08\"\xb7\x01\n\x08Location\x12\x1a\n\rmapping_index\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\x04\x12>\n\x04line\x18\x03 \x03(\x0b\x32\x30.opentelemetry.proto.profiles.v1development.Line\x12\x11\n\tis_folded\x18\x04 \x01(\x08\x12\x19\n\x11\x61ttribute_indices\x18\x05 \x03(\x05\x42\x10\n\x0e_mapping_index\"<\n\x04Line\x12\x16\n\x0e\x66unction_index\x18\x01 \x01(\x05\x12\x0c\n\x04line\x18\x02 \x01(\x03\x12\x0e\n\x06\x63olumn\x18\x03 \x01(\x03\"n\n\x08\x46unction\x12\x15\n\rname_strindex\x18\x01 \x01(\x05\x12\x1c\n\x14system_name_strindex\x18\x02 \x01(\x05\x12\x19\n\x11\x66ilename_strindex\x18\x03 \x01(\x05\x12\x12\n\nstart_line\x18\x04 \x01(\x03*\x8c\x01\n\x16\x41ggregationTemporality\x12\'\n#AGGREGATION_TEMPORALITY_UNSPECIFIED\x10\x00\x12!\n\x1d\x41GGREGATION_TEMPORALITY_DELTA\x10\x01\x12&\n\"AGGREGATION_TEMPORALITY_CUMULATIVE\x10\x02\x42\xa4\x01\n-io.opentelemetry.proto.profiles.v1developmentB\rProfilesProtoP\x01Z5go.opentelemetry.io/proto/otlp/profiles/v1development\xaa\x02*OpenTelemetry.Proto.Profiles.V1Developmentb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n9opentelemetry/proto/profiles/v1development/profiles.proto\x12*opentelemetry.proto.profiles.v1development\x1a*opentelemetry/proto/common/v1/common.proto\x1a.opentelemetry/proto/resource/v1/resource.proto\"\xf6\x03\n\x12ProfilesDictionary\x12J\n\rmapping_table\x18\x01 \x03(\x0b\x32\x33.opentelemetry.proto.profiles.v1development.Mapping\x12L\n\x0elocation_table\x18\x02 \x03(\x0b\x32\x34.opentelemetry.proto.profiles.v1development.Location\x12L\n\x0e\x66unction_table\x18\x03 \x03(\x0b\x32\x34.opentelemetry.proto.profiles.v1development.Function\x12\x44\n\nlink_table\x18\x04 \x03(\x0b\x32\x30.opentelemetry.proto.profiles.v1development.Link\x12\x14\n\x0cstring_table\x18\x05 \x03(\t\x12T\n\x0f\x61ttribute_table\x18\x06 \x03(\x0b\x32;.opentelemetry.proto.profiles.v1development.KeyValueAndUnit\x12\x46\n\x0bstack_table\x18\x07 \x03(\x0b\x32\x31.opentelemetry.proto.profiles.v1development.Stack\"\xbb\x01\n\x0cProfilesData\x12W\n\x11resource_profiles\x18\x01 \x03(\x0b\x32<.opentelemetry.proto.profiles.v1development.ResourceProfiles\x12R\n\ndictionary\x18\x02 \x01(\x0b\x32>.opentelemetry.proto.profiles.v1development.ProfilesDictionary\"\xbe\x01\n\x10ResourceProfiles\x12;\n\x08resource\x18\x01 \x01(\x0b\x32).opentelemetry.proto.resource.v1.Resource\x12Q\n\x0escope_profiles\x18\x02 \x03(\x0b\x32\x39.opentelemetry.proto.profiles.v1development.ScopeProfiles\x12\x12\n\nschema_url\x18\x03 \x01(\tJ\x06\x08\xe8\x07\x10\xe9\x07\"\xae\x01\n\rScopeProfiles\x12\x42\n\x05scope\x18\x01 \x01(\x0b\x32\x33.opentelemetry.proto.common.v1.InstrumentationScope\x12\x45\n\x08profiles\x18\x02 \x03(\x0b\x32\x33.opentelemetry.proto.profiles.v1development.Profile\x12\x12\n\nschema_url\x18\x03 \x01(\t\"\xb1\x03\n\x07Profile\x12J\n\x0bsample_type\x18\x01 \x01(\x0b\x32\x35.opentelemetry.proto.profiles.v1development.ValueType\x12\x43\n\x07samples\x18\x02 \x03(\x0b\x32\x32.opentelemetry.proto.profiles.v1development.Sample\x12\x16\n\x0etime_unix_nano\x18\x03 \x01(\x06\x12\x15\n\rduration_nano\x18\x04 \x01(\x04\x12J\n\x0bperiod_type\x18\x05 \x01(\x0b\x32\x35.opentelemetry.proto.profiles.v1development.ValueType\x12\x0e\n\x06period\x18\x06 \x01(\x03\x12\x12\n\nprofile_id\x18\x07 \x01(\x0c\x12 \n\x18\x64ropped_attributes_count\x18\x08 \x01(\r\x12\x1f\n\x17original_payload_format\x18\t \x01(\t\x12\x18\n\x10original_payload\x18\n \x01(\x0c\x12\x19\n\x11\x61ttribute_indices\x18\x0b \x03(\x05\")\n\x04Link\x12\x10\n\x08trace_id\x18\x01 \x01(\x0c\x12\x0f\n\x07span_id\x18\x02 \x01(\x0c\"9\n\tValueType\x12\x15\n\rtype_strindex\x18\x01 \x01(\x05\x12\x15\n\runit_strindex\x18\x02 \x01(\x05\"z\n\x06Sample\x12\x13\n\x0bstack_index\x18\x01 \x01(\x05\x12\x0e\n\x06values\x18\x02 \x03(\x03\x12\x19\n\x11\x61ttribute_indices\x18\x03 \x03(\x05\x12\x12\n\nlink_index\x18\x04 \x01(\x05\x12\x1c\n\x14timestamps_unix_nano\x18\x05 \x03(\x06\"\x80\x01\n\x07Mapping\x12\x14\n\x0cmemory_start\x18\x01 \x01(\x04\x12\x14\n\x0cmemory_limit\x18\x02 \x01(\x04\x12\x13\n\x0b\x66ile_offset\x18\x03 \x01(\x04\x12\x19\n\x11\x66ilename_strindex\x18\x04 \x01(\x05\x12\x19\n\x11\x61ttribute_indices\x18\x05 \x03(\x05\"!\n\x05Stack\x12\x18\n\x10location_indices\x18\x01 \x03(\x05\"\x8e\x01\n\x08Location\x12\x15\n\rmapping_index\x18\x01 \x01(\x05\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\x04\x12?\n\x05lines\x18\x03 \x03(\x0b\x32\x30.opentelemetry.proto.profiles.v1development.Line\x12\x19\n\x11\x61ttribute_indices\x18\x04 \x03(\x05\"<\n\x04Line\x12\x16\n\x0e\x66unction_index\x18\x01 \x01(\x05\x12\x0c\n\x04line\x18\x02 \x01(\x03\x12\x0e\n\x06\x63olumn\x18\x03 \x01(\x03\"n\n\x08\x46unction\x12\x15\n\rname_strindex\x18\x01 \x01(\x05\x12\x1c\n\x14system_name_strindex\x18\x02 \x01(\x05\x12\x19\n\x11\x66ilename_strindex\x18\x03 \x01(\x05\x12\x12\n\nstart_line\x18\x04 \x01(\x03\"v\n\x0fKeyValueAndUnit\x12\x14\n\x0ckey_strindex\x18\x01 \x01(\x05\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.opentelemetry.proto.common.v1.AnyValue\x12\x15\n\runit_strindex\x18\x03 \x01(\x05\x42\xa4\x01\n-io.opentelemetry.proto.profiles.v1developmentB\rProfilesProtoP\x01Z5go.opentelemetry.io/proto/otlp/profiles/v1development\xaa\x02*OpenTelemetry.Proto.Profiles.V1Developmentb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -24,32 +24,32 @@ if not _descriptor._USE_C_DESCRIPTORS: _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'\n-io.opentelemetry.proto.profiles.v1developmentB\rProfilesProtoP\001Z5go.opentelemetry.io/proto/otlp/profiles/v1development\252\002*OpenTelemetry.Proto.Profiles.V1Development' - _globals['_AGGREGATIONTEMPORALITY']._serialized_start=2822 - _globals['_AGGREGATIONTEMPORALITY']._serialized_end=2962 _globals['_PROFILESDICTIONARY']._serialized_start=198 - _globals['_PROFILESDICTIONARY']._serialized_end=692 - _globals['_PROFILESDATA']._serialized_start=695 - _globals['_PROFILESDATA']._serialized_end=882 - _globals['_RESOURCEPROFILES']._serialized_start=885 - _globals['_RESOURCEPROFILES']._serialized_end=1075 - _globals['_SCOPEPROFILES']._serialized_start=1078 - _globals['_SCOPEPROFILES']._serialized_end=1252 - _globals['_PROFILE']._serialized_start=1255 - _globals['_PROFILE']._serialized_end=1773 - _globals['_ATTRIBUTEUNIT']._serialized_start=1775 - _globals['_ATTRIBUTEUNIT']._serialized_end=1845 - _globals['_LINK']._serialized_start=1847 - _globals['_LINK']._serialized_end=1888 - _globals['_VALUETYPE']._serialized_start=1891 - _globals['_VALUETYPE']._serialized_end=2049 - _globals['_SAMPLE']._serialized_start=2052 - _globals['_SAMPLE']._serialized_end=2229 - _globals['_MAPPING']._serialized_start=2232 - _globals['_MAPPING']._serialized_end=2459 - _globals['_LOCATION']._serialized_start=2462 - _globals['_LOCATION']._serialized_end=2645 - _globals['_LINE']._serialized_start=2647 - _globals['_LINE']._serialized_end=2707 - _globals['_FUNCTION']._serialized_start=2709 - _globals['_FUNCTION']._serialized_end=2819 + _globals['_PROFILESDICTIONARY']._serialized_end=700 + _globals['_PROFILESDATA']._serialized_start=703 + _globals['_PROFILESDATA']._serialized_end=890 + _globals['_RESOURCEPROFILES']._serialized_start=893 + _globals['_RESOURCEPROFILES']._serialized_end=1083 + _globals['_SCOPEPROFILES']._serialized_start=1086 + _globals['_SCOPEPROFILES']._serialized_end=1260 + _globals['_PROFILE']._serialized_start=1263 + _globals['_PROFILE']._serialized_end=1696 + _globals['_LINK']._serialized_start=1698 + _globals['_LINK']._serialized_end=1739 + _globals['_VALUETYPE']._serialized_start=1741 + _globals['_VALUETYPE']._serialized_end=1798 + _globals['_SAMPLE']._serialized_start=1800 + _globals['_SAMPLE']._serialized_end=1922 + _globals['_MAPPING']._serialized_start=1925 + _globals['_MAPPING']._serialized_end=2053 + _globals['_STACK']._serialized_start=2055 + _globals['_STACK']._serialized_end=2088 + _globals['_LOCATION']._serialized_start=2091 + _globals['_LOCATION']._serialized_end=2233 + _globals['_LINE']._serialized_start=2235 + _globals['_LINE']._serialized_end=2295 + _globals['_FUNCTION']._serialized_start=2297 + _globals['_FUNCTION']._serialized_end=2407 + _globals['_KEYVALUEANDUNIT']._serialized_start=2409 + _globals['_KEYVALUEANDUNIT']._serialized_end=2527 # @@protoc_insertion_point(module_scope) diff --git a/opentelemetry-proto/src/opentelemetry/proto/profiles/v1development/profiles_pb2.pyi b/opentelemetry-proto/src/opentelemetry/proto/profiles/v1development/profiles_pb2.pyi index 91cc416c262..a037842f9f9 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/profiles/v1development/profiles_pb2.pyi +++ b/opentelemetry-proto/src/opentelemetry/proto/profiles/v1development/profiles_pb2.pyi @@ -35,160 +35,18 @@ import builtins import collections.abc import google.protobuf.descriptor import google.protobuf.internal.containers -import google.protobuf.internal.enum_type_wrapper import google.protobuf.message import opentelemetry.proto.common.v1.common_pb2 import opentelemetry.proto.resource.v1.resource_pb2 import sys -import typing -if sys.version_info >= (3, 10): +if sys.version_info >= (3, 8): import typing as typing_extensions else: import typing_extensions DESCRIPTOR: google.protobuf.descriptor.FileDescriptor -class _AggregationTemporality: - ValueType = typing.NewType("ValueType", builtins.int) - V: typing_extensions.TypeAlias = ValueType - -class _AggregationTemporalityEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_AggregationTemporality.ValueType], builtins.type): - DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor - AGGREGATION_TEMPORALITY_UNSPECIFIED: _AggregationTemporality.ValueType # 0 - """UNSPECIFIED is the default AggregationTemporality, it MUST not be used.""" - AGGREGATION_TEMPORALITY_DELTA: _AggregationTemporality.ValueType # 1 - """* DELTA is an AggregationTemporality for a profiler which reports - changes since last report time. Successive metrics contain aggregation of - values from continuous and non-overlapping intervals. - - The values for a DELTA metric are based only on the time interval - associated with one measurement cycle. There is no dependency on - previous measurements like is the case for CUMULATIVE metrics. - - For example, consider a system measuring the number of requests that - it receives and reports the sum of these requests every second as a - DELTA metric: - - 1. The system starts receiving at time=t_0. - 2. A request is received, the system measures 1 request. - 3. A request is received, the system measures 1 request. - 4. A request is received, the system measures 1 request. - 5. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_0 to - t_0+1 with a value of 3. - 6. A request is received, the system measures 1 request. - 7. A request is received, the system measures 1 request. - 8. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_0+1 to - t_0+2 with a value of 2. - """ - AGGREGATION_TEMPORALITY_CUMULATIVE: _AggregationTemporality.ValueType # 2 - """* CUMULATIVE is an AggregationTemporality for a profiler which - reports changes since a fixed start time. This means that current values - of a CUMULATIVE metric depend on all previous measurements since the - start time. Because of this, the sender is required to retain this state - in some form. If this state is lost or invalidated, the CUMULATIVE metric - values MUST be reset and a new fixed start time following the last - reported measurement time sent MUST be used. - - For example, consider a system measuring the number of requests that - it receives and reports the sum of these requests every second as a - CUMULATIVE metric: - - 1. The system starts receiving at time=t_0. - 2. A request is received, the system measures 1 request. - 3. A request is received, the system measures 1 request. - 4. A request is received, the system measures 1 request. - 5. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_0 to - t_0+1 with a value of 3. - 6. A request is received, the system measures 1 request. - 7. A request is received, the system measures 1 request. - 8. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_0 to - t_0+2 with a value of 5. - 9. The system experiences a fault and loses state. - 10. The system recovers and resumes receiving at time=t_1. - 11. A request is received, the system measures 1 request. - 12. The 1 second collection cycle ends. A metric is exported for the - number of requests received over the interval of time t_1 to - t_1+1 with a value of 1. - - Note: Even though, when reporting changes since last report time, using - CUMULATIVE is valid, it is not recommended. - """ - -class AggregationTemporality(_AggregationTemporality, metaclass=_AggregationTemporalityEnumTypeWrapper): - """Specifies the method of aggregating metric values, either DELTA (change since last report) - or CUMULATIVE (total since a fixed start time). - """ - -AGGREGATION_TEMPORALITY_UNSPECIFIED: AggregationTemporality.ValueType # 0 -"""UNSPECIFIED is the default AggregationTemporality, it MUST not be used.""" -AGGREGATION_TEMPORALITY_DELTA: AggregationTemporality.ValueType # 1 -"""* DELTA is an AggregationTemporality for a profiler which reports -changes since last report time. Successive metrics contain aggregation of -values from continuous and non-overlapping intervals. - -The values for a DELTA metric are based only on the time interval -associated with one measurement cycle. There is no dependency on -previous measurements like is the case for CUMULATIVE metrics. - -For example, consider a system measuring the number of requests that -it receives and reports the sum of these requests every second as a -DELTA metric: - -1. The system starts receiving at time=t_0. -2. A request is received, the system measures 1 request. -3. A request is received, the system measures 1 request. -4. A request is received, the system measures 1 request. -5. The 1 second collection cycle ends. A metric is exported for the -number of requests received over the interval of time t_0 to -t_0+1 with a value of 3. -6. A request is received, the system measures 1 request. -7. A request is received, the system measures 1 request. -8. The 1 second collection cycle ends. A metric is exported for the -number of requests received over the interval of time t_0+1 to -t_0+2 with a value of 2. -""" -AGGREGATION_TEMPORALITY_CUMULATIVE: AggregationTemporality.ValueType # 2 -"""* CUMULATIVE is an AggregationTemporality for a profiler which -reports changes since a fixed start time. This means that current values -of a CUMULATIVE metric depend on all previous measurements since the -start time. Because of this, the sender is required to retain this state -in some form. If this state is lost or invalidated, the CUMULATIVE metric -values MUST be reset and a new fixed start time following the last -reported measurement time sent MUST be used. - -For example, consider a system measuring the number of requests that -it receives and reports the sum of these requests every second as a -CUMULATIVE metric: - -1. The system starts receiving at time=t_0. -2. A request is received, the system measures 1 request. -3. A request is received, the system measures 1 request. -4. A request is received, the system measures 1 request. -5. The 1 second collection cycle ends. A metric is exported for the -number of requests received over the interval of time t_0 to -t_0+1 with a value of 3. -6. A request is received, the system measures 1 request. -7. A request is received, the system measures 1 request. -8. The 1 second collection cycle ends. A metric is exported for the -number of requests received over the interval of time t_0 to -t_0+2 with a value of 5. -9. The system experiences a fault and loses state. -10. The system recovers and resumes receiving at time=t_1. -11. A request is received, the system measures 1 request. -12. The 1 second collection cycle ends. A metric is exported for the -number of requests received over the interval of time t_1 to -t_1+1 with a value of 1. - -Note: Even though, when reporting changes since last report time, using -CUMULATIVE is valid, it is not recommended. -""" -global___AggregationTemporality = AggregationTemporality - @typing_extensions.final class ProfilesDictionary(google.protobuf.message.Message): """ Relationships Diagram @@ -209,7 +67,7 @@ class ProfilesDictionary(google.protobuf.message.Message): │ ScopeProfiles │ └──────────────────┘ │ - │ 1-1 + │ 1-n ▼ ┌──────────────────┐ │ Profile │ @@ -217,15 +75,21 @@ class ProfilesDictionary(google.protobuf.message.Message): │ n-1 │ 1-n ┌───────────────────────────────────────┐ ▼ │ ▽ - ┌──────────────────┐ 1-n ┌──────────────┐ ┌──────────┐ - │ Sample │ ──────▷ │ KeyValue │ │ Link │ - └──────────────────┘ └──────────────┘ └──────────┘ - │ 1-n △ △ - │ 1-n ┌─────────────────┘ │ 1-n - ▽ │ │ - ┌──────────────────┐ n-1 ┌──────────────┐ - │ Location │ ──────▷ │ Mapping │ - └──────────────────┘ └──────────────┘ + ┌──────────────────┐ 1-n ┌─────────────────┐ ┌──────────┐ + │ Sample │ ──────▷ │ KeyValueAndUnit │ │ Link │ + └──────────────────┘ └─────────────────┘ └──────────┘ + │ △ △ + │ n-1 │ │ 1-n + ▽ │ │ + ┌──────────────────┐ │ │ + │ Stack │ │ │ + └──────────────────┘ │ │ + │ 1-n │ │ + │ 1-n ┌────────────────┘ │ + ▽ │ │ + ┌──────────────────┐ n-1 ┌─────────────┐ + │ Location │ ──────▷ │ Mapping │ + └──────────────────┘ └─────────────┘ │ │ 1-n ▼ @@ -240,7 +104,28 @@ class ProfilesDictionary(google.protobuf.message.Message): └──────────────────┘ ProfilesDictionary represents the profiles data shared across the - entire message being sent. + entire message being sent. The following applies to all fields in this + message: + + - A dictionary is an array of dictionary items. Users of the dictionary + compactly reference the items using the index within the array. + + - A dictionary MUST have a zero value encoded as the first element. This + allows for _index fields pointing into the dictionary to use a 0 pointer + value to indicate 'null' / 'not set'. Unless otherwise defined, a 'zero + value' message value is one with all default field values, so as to + minimize wire encoded size. + + - There SHOULD NOT be dupes in a dictionary. The identity of dictionary + items is based on their value, recursively as needed. If a particular + implementation does emit duplicated items, it MUST NOT attempt to give them + meaning based on the index or order. A profile processor may remove + duplicate items and this MUST NOT have any observable effects for + consumers. + + - There SHOULD NOT be orphaned (unreferenced) items in a dictionary. A + profile processor may remove ("garbage-collect") orphaned items and this + MUST NOT have any observable effects for consumers. """ DESCRIPTOR: google.protobuf.descriptor.Descriptor @@ -251,32 +136,67 @@ class ProfilesDictionary(google.protobuf.message.Message): LINK_TABLE_FIELD_NUMBER: builtins.int STRING_TABLE_FIELD_NUMBER: builtins.int ATTRIBUTE_TABLE_FIELD_NUMBER: builtins.int - ATTRIBUTE_UNITS_FIELD_NUMBER: builtins.int + STACK_TABLE_FIELD_NUMBER: builtins.int @property def mapping_table(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Mapping]: """Mappings from address ranges to the image/binary/library mapped into that address range referenced by locations via Location.mapping_index. + + mapping_table[0] must always be zero value (Mapping{}) and present. """ @property def location_table(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Location]: - """Locations referenced by samples via Profile.location_indices.""" + """Locations referenced by samples via Stack.location_indices. + + location_table[0] must always be zero value (Location{}) and present. + """ @property def function_table(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Function]: - """Functions referenced by locations via Line.function_index.""" + """Functions referenced by locations via Line.function_index. + + function_table[0] must always be zero value (Function{}) and present. + """ @property def link_table(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Link]: - """Links referenced by samples via Sample.link_index.""" + """Links referenced by samples via Sample.link_index. + + link_table[0] must always be zero value (Link{}) and present. + """ @property def string_table(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]: """A common table for strings referenced by various messages. - string_table[0] must always be "". + + string_table[0] must always be "" and present. """ @property - def attribute_table(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: - """A common table for attributes referenced by various messages.""" + def attribute_table(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___KeyValueAndUnit]: + """A common table for attributes referenced by the Profile, Sample, Mapping + and Location messages below through attribute_indices field. Each entry is + a key/value pair with an optional unit. Since this is a dictionary table, + multiple entries with the same key may be present, unlike direct attribute + tables like Resource.attributes. The referencing attribute_indices fields, + though, do maintain the key uniqueness requirement. + + It's recommended to use attributes for variables with bounded cardinality, + such as categorical variables + (https://en.wikipedia.org/wiki/Categorical_variable). Using an attribute of + a floating point type (e.g., CPU time) in a sample can quickly make every + attribute value unique, defeating the purpose of the dictionary and + impractically increasing the profile size. + + Examples of attributes: + "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" + "abc.com/myattribute": true + "allocation_size": 128 bytes + + attribute_table[0] must always be zero value (KeyValueAndUnit{}) and present. + """ @property - def attribute_units(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___AttributeUnit]: - """Represents a mapping between Attribute Keys and Units.""" + def stack_table(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Stack]: + """Stacks referenced by samples via Sample.stack_index. + + stack_table[0] must always be zero value (Stack{}) and present. + """ def __init__( self, *, @@ -285,10 +205,10 @@ class ProfilesDictionary(google.protobuf.message.Message): function_table: collections.abc.Iterable[global___Function] | None = ..., link_table: collections.abc.Iterable[global___Link] | None = ..., string_table: collections.abc.Iterable[builtins.str] | None = ..., - attribute_table: collections.abc.Iterable[opentelemetry.proto.common.v1.common_pb2.KeyValue] | None = ..., - attribute_units: collections.abc.Iterable[global___AttributeUnit] | None = ..., + attribute_table: collections.abc.Iterable[global___KeyValueAndUnit] | None = ..., + stack_table: collections.abc.Iterable[global___Stack] | None = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["attribute_table", b"attribute_table", "attribute_units", b"attribute_units", "function_table", b"function_table", "link_table", b"link_table", "location_table", b"location_table", "mapping_table", b"mapping_table", "string_table", b"string_table"]) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["attribute_table", b"attribute_table", "function_table", b"function_table", "link_table", b"link_table", "location_table", b"location_table", "mapping_table", b"mapping_table", "stack_table", b"stack_table", "string_table", b"string_table"]) -> None: ... global___ProfilesDictionary = ProfilesDictionary @@ -319,6 +239,8 @@ class ProfilesData(google.protobuf.message.Message): from non-containerized processes. Other resource groupings are possible as well and clarified via Resource.attributes and semantic conventions. + Tools that visualize profiles should prefer displaying + resources_profiles[0].scope_profiles[0].profiles[0] by default. """ @property def dictionary(self) -> global___ProfilesDictionary: @@ -394,7 +316,8 @@ class ScopeProfiles(google.protobuf.message.Message): is recorded in. Notably, the last part of the URL path is the version number of the schema: http[s]://server[:port]/path/. To learn more about Schema URL see https://opentelemetry.io/docs/specs/otel/schemas/#schema-url - This schema_url applies to all profiles in the "profiles" field. + This schema_url applies to the data in the "scope" field and all profiles in the + "profiles" field. """ def __init__( self, @@ -422,21 +345,20 @@ class Profile(google.protobuf.message.Message): that is most useful to humans. There should be enough information present to determine the original sampled values. - - On-disk, the serialized proto must be gzip-compressed. - - The profile is represented as a set of samples, where each sample - references a sequence of locations, and where each location belongs + references a stack trace which is a list of locations, each belonging to a mapping. - - There is a N->1 relationship from sample.location_id entries to - locations. For every sample.location_id entry there must be a + - There is a N->1 relationship from Stack.location_indices entries to + locations. For every Stack.location_indices entry there must be a unique Location with that index. - There is an optional N->1 relationship from locations to mappings. For every nonzero Location.mapping_id there must be a unique Mapping with that index. - Represents a complete profile, including sample types, samples, - mappings to binaries, locations, functions, string table, and additional metadata. - It modifies and annotates pprof Profile with OpenTelemetry specific fields. + Represents a complete profile, including sample types, samples, mappings to + binaries, stacks, locations, functions, string table, and additional + metadata. It modifies and annotates pprof Profile with OpenTelemetry + specific fields. Note that whilst fields in this message retain the name and field id from pprof in most cases for ease of understanding data migration, it is not intended that pprof:Profile and @@ -446,43 +368,34 @@ class Profile(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor SAMPLE_TYPE_FIELD_NUMBER: builtins.int - SAMPLE_FIELD_NUMBER: builtins.int - LOCATION_INDICES_FIELD_NUMBER: builtins.int - TIME_NANOS_FIELD_NUMBER: builtins.int - DURATION_NANOS_FIELD_NUMBER: builtins.int + SAMPLES_FIELD_NUMBER: builtins.int + TIME_UNIX_NANO_FIELD_NUMBER: builtins.int + DURATION_NANO_FIELD_NUMBER: builtins.int PERIOD_TYPE_FIELD_NUMBER: builtins.int PERIOD_FIELD_NUMBER: builtins.int - COMMENT_STRINDICES_FIELD_NUMBER: builtins.int - DEFAULT_SAMPLE_TYPE_INDEX_FIELD_NUMBER: builtins.int PROFILE_ID_FIELD_NUMBER: builtins.int DROPPED_ATTRIBUTES_COUNT_FIELD_NUMBER: builtins.int ORIGINAL_PAYLOAD_FORMAT_FIELD_NUMBER: builtins.int ORIGINAL_PAYLOAD_FIELD_NUMBER: builtins.int ATTRIBUTE_INDICES_FIELD_NUMBER: builtins.int @property - def sample_type(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___ValueType]: - """A description of the samples associated with each Sample.value. - For a cpu profile this might be: - [["cpu","nanoseconds"]] or [["wall","seconds"]] or [["syscall","count"]] + def sample_type(self) -> global___ValueType: + """The type and unit of all Sample.values in this profile. + For a cpu or off-cpu profile this might be: + ["cpu","nanoseconds"] or ["off_cpu","nanoseconds"] For a heap profile, this might be: - [["allocations","count"], ["space","bytes"]], - If one of the values represents the number of events represented - by the sample, by convention it should be at index 0 and use - sample_type.unit == "count". + ["allocated_objects","count"] or ["allocated_space","bytes"], """ @property - def sample(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Sample]: + def samples(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Sample]: """The set of samples recorded in this profile.""" - @property - def location_indices(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: - """References to locations in ProfilesDictionary.location_table.""" - time_nanos: builtins.int - """The following fields 4-14 are informational, do not affect + time_unix_nano: builtins.int + """The following fields 3-12 are informational, do not affect interpretation of results. Time of collection (UTC) represented as nanoseconds past the epoch. """ - duration_nanos: builtins.int + duration_nano: builtins.int """Duration of the profile, if a duration makes sense.""" @property def period_type(self) -> global___ValueType: @@ -491,99 +404,67 @@ class Profile(google.protobuf.message.Message): """ period: builtins.int """The number of events between sampled occurrences.""" - @property - def comment_strindices(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: - """Free-form text associated with the profile. The text is displayed as is - to the user by the tools that read profiles (e.g. by pprof). This field - should not be used to store any machine-readable information, it is only - for human-friendly content. The profile must stay functional if this field - is cleaned. - Indices into ProfilesDictionary.string_table. - """ - default_sample_type_index: builtins.int - """Index into the sample_type array to the default sample type.""" profile_id: builtins.bytes """A globally unique identifier for a profile. The ID is a 16-byte array. An ID with - all zeroes is considered invalid. - - This field is required. + all zeroes is considered invalid. It may be used for deduplication and signal + correlation purposes. It is acceptable to treat two profiles with different values + in this field as not equal, even if they represented the same object at an earlier + time. + This field is optional; an ID may be assigned to an ID-less profile in a later step. """ dropped_attributes_count: builtins.int - """dropped_attributes_count is the number of attributes that were discarded. Attributes + """The number of attributes that were discarded. Attributes can be discarded because their keys are too long or because there are too many attributes. If this value is 0, then no attributes were dropped. """ original_payload_format: builtins.str - """Specifies format of the original payload. Common values are defined in semantic conventions. [required if original_payload is present]""" + """The original payload format. See also original_payload. Optional, but the + format and the bytes must be set or unset together. + + The allowed values for the format string are defined by the OpenTelemetry + specification. Some examples are "jfr", "pprof", "linux_perf". + + The original payload may be optionally provided when the conversion to the + OLTP format was done from a different format with some loss of the fidelity + and the receiver may want to store the original payload to allow future + lossless export or reinterpretation. Some examples of the original format + are JFR (Java Flight Recorder), pprof, Linux perf. + + Even when the original payload is in a format that is semantically close to + OTLP, such as pprof, a conversion may still be lossy in some cases (e.g. if + the pprof file contains custom extensions or conventions). + + The original payload can be large in size, so including the original + payload should be configurable by the profiler or collector options. The + default behavior should be to not include the original payload. + """ original_payload: builtins.bytes - """Original payload can be stored in this field. This can be useful for users who want to get the original payload. - Formats such as JFR are highly extensible and can contain more information than what is defined in this spec. - Inclusion of original payload should be configurable by the user. Default behavior should be to not include the original payload. - If the original payload is in pprof format, it SHOULD not be included in this field. - The field is optional, however if it is present then equivalent converted data should be populated in other fields - of this message as far as is practicable. + """The original payload bytes. See also original_payload_format. Optional, but + format and the bytes must be set or unset together. """ @property def attribute_indices(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: - """References to attributes in attribute_table. [optional] - It is a collection of key/value pairs. Note, global attributes - like server name can be set using the resource API. Examples of attributes: - - "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" - "/http/server_latency": 300 - "abc.com/myattribute": true - "abc.com/score": 10.239 - - The OpenTelemetry API specification further restricts the allowed value types: - https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute - Attribute keys MUST be unique (it is not allowed to have more than one - attribute with the same key). - """ + """References to attributes in attribute_table. [optional]""" def __init__( self, *, - sample_type: collections.abc.Iterable[global___ValueType] | None = ..., - sample: collections.abc.Iterable[global___Sample] | None = ..., - location_indices: collections.abc.Iterable[builtins.int] | None = ..., - time_nanos: builtins.int = ..., - duration_nanos: builtins.int = ..., + sample_type: global___ValueType | None = ..., + samples: collections.abc.Iterable[global___Sample] | None = ..., + time_unix_nano: builtins.int = ..., + duration_nano: builtins.int = ..., period_type: global___ValueType | None = ..., period: builtins.int = ..., - comment_strindices: collections.abc.Iterable[builtins.int] | None = ..., - default_sample_type_index: builtins.int = ..., profile_id: builtins.bytes = ..., dropped_attributes_count: builtins.int = ..., original_payload_format: builtins.str = ..., original_payload: builtins.bytes = ..., attribute_indices: collections.abc.Iterable[builtins.int] | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["period_type", b"period_type"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["attribute_indices", b"attribute_indices", "comment_strindices", b"comment_strindices", "default_sample_type_index", b"default_sample_type_index", "dropped_attributes_count", b"dropped_attributes_count", "duration_nanos", b"duration_nanos", "location_indices", b"location_indices", "original_payload", b"original_payload", "original_payload_format", b"original_payload_format", "period", b"period", "period_type", b"period_type", "profile_id", b"profile_id", "sample", b"sample", "sample_type", b"sample_type", "time_nanos", b"time_nanos"]) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["period_type", b"period_type", "sample_type", b"sample_type"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["attribute_indices", b"attribute_indices", "dropped_attributes_count", b"dropped_attributes_count", "duration_nano", b"duration_nano", "original_payload", b"original_payload", "original_payload_format", b"original_payload_format", "period", b"period", "period_type", b"period_type", "profile_id", b"profile_id", "sample_type", b"sample_type", "samples", b"samples", "time_unix_nano", b"time_unix_nano"]) -> None: ... global___Profile = Profile -@typing_extensions.final -class AttributeUnit(google.protobuf.message.Message): - """Represents a mapping between Attribute Keys and Units.""" - - DESCRIPTOR: google.protobuf.descriptor.Descriptor - - ATTRIBUTE_KEY_STRINDEX_FIELD_NUMBER: builtins.int - UNIT_STRINDEX_FIELD_NUMBER: builtins.int - attribute_key_strindex: builtins.int - """Index into string table.""" - unit_strindex: builtins.int - """Index into string table.""" - def __init__( - self, - *, - attribute_key_strindex: builtins.int = ..., - unit_strindex: builtins.int = ..., - ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["attribute_key_strindex", b"attribute_key_strindex", "unit_strindex", b"unit_strindex"]) -> None: ... - -global___AttributeUnit = AttributeUnit - @typing_extensions.final class Link(google.protobuf.message.Message): """A pointer from a profile Sample to a trace Span. @@ -612,83 +493,86 @@ global___Link = Link @typing_extensions.final class ValueType(google.protobuf.message.Message): - """ValueType describes the type and units of a value, with an optional aggregation temporality.""" + """ValueType describes the type and units of a value.""" DESCRIPTOR: google.protobuf.descriptor.Descriptor TYPE_STRINDEX_FIELD_NUMBER: builtins.int UNIT_STRINDEX_FIELD_NUMBER: builtins.int - AGGREGATION_TEMPORALITY_FIELD_NUMBER: builtins.int type_strindex: builtins.int """Index into ProfilesDictionary.string_table.""" unit_strindex: builtins.int """Index into ProfilesDictionary.string_table.""" - aggregation_temporality: global___AggregationTemporality.ValueType def __init__( self, *, type_strindex: builtins.int = ..., unit_strindex: builtins.int = ..., - aggregation_temporality: global___AggregationTemporality.ValueType = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["aggregation_temporality", b"aggregation_temporality", "type_strindex", b"type_strindex", "unit_strindex", b"unit_strindex"]) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["type_strindex", b"type_strindex", "unit_strindex", b"unit_strindex"]) -> None: ... global___ValueType = ValueType @typing_extensions.final class Sample(google.protobuf.message.Message): - """Each Sample records values encountered in some program - context. The program context is typically a stack trace, perhaps - augmented with auxiliary information like the thread-id, some - indicator of a higher level request being handled etc. + """Each Sample records values encountered in some program context. The program + context is typically a stack trace, perhaps augmented with auxiliary + information like the thread-id, some indicator of a higher level request + being handled etc. + + A Sample MUST have have at least one values or timestamps_unix_nano entry. If + both fields are populated, they MUST contain the same number of elements, and + the elements at the same index MUST refer to the same event. + + Examples of different ways of representing a sample with the total value of 10: + + Report of a stacktrace at 10 timestamps (consumers must assume the value is 1 for each point): + values: [] + timestamps_unix_nano: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + + Report of a stacktrace with an aggregated value without timestamps: + values: [10] + timestamps_unix_nano: [] + + Report of a stacktrace at 4 timestamps where each point records a specific value: + values: [2, 2, 3, 3] + timestamps_unix_nano: [1, 2, 3, 4] """ DESCRIPTOR: google.protobuf.descriptor.Descriptor - LOCATIONS_START_INDEX_FIELD_NUMBER: builtins.int - LOCATIONS_LENGTH_FIELD_NUMBER: builtins.int - VALUE_FIELD_NUMBER: builtins.int + STACK_INDEX_FIELD_NUMBER: builtins.int + VALUES_FIELD_NUMBER: builtins.int ATTRIBUTE_INDICES_FIELD_NUMBER: builtins.int LINK_INDEX_FIELD_NUMBER: builtins.int TIMESTAMPS_UNIX_NANO_FIELD_NUMBER: builtins.int - locations_start_index: builtins.int - """locations_start_index along with locations_length refers to to a slice of locations in Profile.location_indices.""" - locations_length: builtins.int - """locations_length along with locations_start_index refers to a slice of locations in Profile.location_indices. - Supersedes location_index. - """ + stack_index: builtins.int + """Reference to stack in ProfilesDictionary.stack_table.""" @property - def value(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: - """The type and unit of each value is defined by the corresponding - entry in Profile.sample_type. All samples must have the same - number of values, the same as the length of Profile.sample_type. - When aggregating multiple samples into a single sample, the - result has a list of values that is the element-wise sum of the - lists of the originals. - """ + def values(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: + """The type and unit of each value is defined by Profile.sample_type.""" @property def attribute_indices(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: """References to attributes in ProfilesDictionary.attribute_table. [optional]""" link_index: builtins.int - """Reference to link in ProfilesDictionary.link_table. [optional]""" + """Reference to link in ProfilesDictionary.link_table. [optional] + It can be unset / set to 0 if no link exists, as link_table[0] is always a 'null' default value. + """ @property def timestamps_unix_nano(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: - """Timestamps associated with Sample represented in nanoseconds. These timestamps are expected - to fall within the Profile's time range. [optional] + """Timestamps associated with Sample represented in nanoseconds. These + timestamps should fall within the Profile's time range. """ def __init__( self, *, - locations_start_index: builtins.int = ..., - locations_length: builtins.int = ..., - value: collections.abc.Iterable[builtins.int] | None = ..., + stack_index: builtins.int = ..., + values: collections.abc.Iterable[builtins.int] | None = ..., attribute_indices: collections.abc.Iterable[builtins.int] | None = ..., - link_index: builtins.int | None = ..., + link_index: builtins.int = ..., timestamps_unix_nano: collections.abc.Iterable[builtins.int] | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["_link_index", b"_link_index", "link_index", b"link_index"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["_link_index", b"_link_index", "attribute_indices", b"attribute_indices", "link_index", b"link_index", "locations_length", b"locations_length", "locations_start_index", b"locations_start_index", "timestamps_unix_nano", b"timestamps_unix_nano", "value", b"value"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["_link_index", b"_link_index"]) -> typing_extensions.Literal["link_index"] | None: ... + def ClearField(self, field_name: typing_extensions.Literal["attribute_indices", b"attribute_indices", "link_index", b"link_index", "stack_index", b"stack_index", "timestamps_unix_nano", b"timestamps_unix_nano", "values", b"values"]) -> None: ... global___Sample = Sample @@ -705,10 +589,6 @@ class Mapping(google.protobuf.message.Message): FILE_OFFSET_FIELD_NUMBER: builtins.int FILENAME_STRINDEX_FIELD_NUMBER: builtins.int ATTRIBUTE_INDICES_FIELD_NUMBER: builtins.int - HAS_FUNCTIONS_FIELD_NUMBER: builtins.int - HAS_FILENAMES_FIELD_NUMBER: builtins.int - HAS_LINE_NUMBERS_FIELD_NUMBER: builtins.int - HAS_INLINE_FRAMES_FIELD_NUMBER: builtins.int memory_start: builtins.int """Address at which the binary (or DLL) is loaded into memory.""" memory_limit: builtins.int @@ -724,11 +604,6 @@ class Mapping(google.protobuf.message.Message): @property def attribute_indices(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: """References to attributes in ProfilesDictionary.attribute_table. [optional]""" - has_functions: builtins.bool - """The following fields indicate the resolution of symbolic info.""" - has_filenames: builtins.bool - has_line_numbers: builtins.bool - has_inline_frames: builtins.bool def __init__( self, *, @@ -737,15 +612,32 @@ class Mapping(google.protobuf.message.Message): file_offset: builtins.int = ..., filename_strindex: builtins.int = ..., attribute_indices: collections.abc.Iterable[builtins.int] | None = ..., - has_functions: builtins.bool = ..., - has_filenames: builtins.bool = ..., - has_line_numbers: builtins.bool = ..., - has_inline_frames: builtins.bool = ..., ) -> None: ... - def ClearField(self, field_name: typing_extensions.Literal["attribute_indices", b"attribute_indices", "file_offset", b"file_offset", "filename_strindex", b"filename_strindex", "has_filenames", b"has_filenames", "has_functions", b"has_functions", "has_inline_frames", b"has_inline_frames", "has_line_numbers", b"has_line_numbers", "memory_limit", b"memory_limit", "memory_start", b"memory_start"]) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["attribute_indices", b"attribute_indices", "file_offset", b"file_offset", "filename_strindex", b"filename_strindex", "memory_limit", b"memory_limit", "memory_start", b"memory_start"]) -> None: ... global___Mapping = Mapping +@typing_extensions.final +class Stack(google.protobuf.message.Message): + """A Stack represents a stack trace as a list of locations.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + LOCATION_INDICES_FIELD_NUMBER: builtins.int + @property + def location_indices(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: + """References to locations in ProfilesDictionary.location_table. + The first location is the leaf frame. + """ + def __init__( + self, + *, + location_indices: collections.abc.Iterable[builtins.int] | None = ..., + ) -> None: ... + def ClearField(self, field_name: typing_extensions.Literal["location_indices", b"location_indices"]) -> None: ... + +global___Stack = Stack + @typing_extensions.final class Location(google.protobuf.message.Message): """Describes function and line table debug information.""" @@ -754,13 +646,12 @@ class Location(google.protobuf.message.Message): MAPPING_INDEX_FIELD_NUMBER: builtins.int ADDRESS_FIELD_NUMBER: builtins.int - LINE_FIELD_NUMBER: builtins.int - IS_FOLDED_FIELD_NUMBER: builtins.int + LINES_FIELD_NUMBER: builtins.int ATTRIBUTE_INDICES_FIELD_NUMBER: builtins.int mapping_index: builtins.int """Reference to mapping in ProfilesDictionary.mapping_table. - It can be unset if the mapping is unknown or not applicable for - this profile type. + It can be unset / set to 0 if the mapping is unknown or not applicable for + this profile type, as mapping_table[0] is always a 'null' default mapping. """ address: builtins.int """The instruction address for this location, if available. It @@ -770,37 +661,27 @@ class Location(google.protobuf.message.Message): the beginning of the instruction if necessary. """ @property - def line(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Line]: + def lines(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Line]: """Multiple line indicates this location has inlined functions, where the last entry represents the caller into which the preceding entries were inlined. E.g., if memcpy() is inlined into printf: - line[0].function_name == "memcpy" - line[1].function_name == "printf" + lines[0].function_name == "memcpy" + lines[1].function_name == "printf" """ - is_folded: builtins.bool - """Provides an indication that multiple symbols map to this location's - address, for example due to identical code folding by the linker. In that - case the line information above represents one of the multiple - symbols. This field must be recomputed when the symbolization state of the - profile changes. - """ @property def attribute_indices(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.int]: """References to attributes in ProfilesDictionary.attribute_table. [optional]""" def __init__( self, *, - mapping_index: builtins.int | None = ..., + mapping_index: builtins.int = ..., address: builtins.int = ..., - line: collections.abc.Iterable[global___Line] | None = ..., - is_folded: builtins.bool = ..., + lines: collections.abc.Iterable[global___Line] | None = ..., attribute_indices: collections.abc.Iterable[builtins.int] | None = ..., ) -> None: ... - def HasField(self, field_name: typing_extensions.Literal["_mapping_index", b"_mapping_index", "mapping_index", b"mapping_index"]) -> builtins.bool: ... - def ClearField(self, field_name: typing_extensions.Literal["_mapping_index", b"_mapping_index", "address", b"address", "attribute_indices", b"attribute_indices", "is_folded", b"is_folded", "line", b"line", "mapping_index", b"mapping_index"]) -> None: ... - def WhichOneof(self, oneof_group: typing_extensions.Literal["_mapping_index", b"_mapping_index"]) -> typing_extensions.Literal["mapping_index"] | None: ... + def ClearField(self, field_name: typing_extensions.Literal["address", b"address", "attribute_indices", b"attribute_indices", "lines", b"lines", "mapping_index", b"mapping_index"]) -> None: ... global___Location = Location @@ -843,7 +724,7 @@ class Function(google.protobuf.message.Message): FILENAME_STRINDEX_FIELD_NUMBER: builtins.int START_LINE_FIELD_NUMBER: builtins.int name_strindex: builtins.int - """Function name. Empty string if not available.""" + """The function name. Empty string if not available.""" system_name_strindex: builtins.int """Function name, as identified by the system. For instance, it can be a C++ mangled name. Empty string if not available. @@ -863,3 +744,36 @@ class Function(google.protobuf.message.Message): def ClearField(self, field_name: typing_extensions.Literal["filename_strindex", b"filename_strindex", "name_strindex", b"name_strindex", "start_line", b"start_line", "system_name_strindex", b"system_name_strindex"]) -> None: ... global___Function = Function + +@typing_extensions.final +class KeyValueAndUnit(google.protobuf.message.Message): + """A custom 'dictionary native' style of encoding attributes which is more convenient + for profiles than opentelemetry.proto.common.v1.KeyValue + Specifically, uses the string table for keys and allows optional unit information. + """ + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + KEY_STRINDEX_FIELD_NUMBER: builtins.int + VALUE_FIELD_NUMBER: builtins.int + UNIT_STRINDEX_FIELD_NUMBER: builtins.int + key_strindex: builtins.int + """The index into the string table for the attribute's key.""" + @property + def value(self) -> opentelemetry.proto.common.v1.common_pb2.AnyValue: + """The value of the attribute.""" + unit_strindex: builtins.int + """The index into the string table for the attribute's unit. + zero indicates implicit (by semconv) or non-defined unit. + """ + def __init__( + self, + *, + key_strindex: builtins.int = ..., + value: opentelemetry.proto.common.v1.common_pb2.AnyValue | None = ..., + unit_strindex: builtins.int = ..., + ) -> None: ... + def HasField(self, field_name: typing_extensions.Literal["value", b"value"]) -> builtins.bool: ... + def ClearField(self, field_name: typing_extensions.Literal["key_strindex", b"key_strindex", "unit_strindex", b"unit_strindex", "value", b"value"]) -> None: ... + +global___KeyValueAndUnit = KeyValueAndUnit diff --git a/opentelemetry-proto/src/opentelemetry/proto/resource/v1/resource_pb2.pyi b/opentelemetry-proto/src/opentelemetry/proto/resource/v1/resource_pb2.pyi index b1b0f194981..61472c538e1 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/resource/v1/resource_pb2.pyi +++ b/opentelemetry-proto/src/opentelemetry/proto/resource/v1/resource_pb2.pyi @@ -44,9 +44,10 @@ class Resource(google.protobuf.message.Message): """Set of attributes that describe the resource. Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key). + The behavior of software that receives duplicated keys can be unpredictable. """ dropped_attributes_count: builtins.int - """dropped_attributes_count is the number of dropped attributes. If the value is 0, then + """The number of dropped attributes. If the value is 0, then no attributes were dropped. """ @property diff --git a/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.pyi b/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.pyi index 598c1ee6da4..e21336f03c6 100644 --- a/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.pyi +++ b/opentelemetry-proto/src/opentelemetry/proto/trace/v1/trace_pb2.pyi @@ -177,7 +177,8 @@ class ScopeSpans(google.protobuf.message.Message): is recorded in. Notably, the last part of the URL path is the version number of the schema: http[s]://server[:port]/path/. To learn more about Schema URL see https://opentelemetry.io/docs/specs/otel/schemas/#schema-url - This schema_url applies to all spans and span events in the "spans" field. + This schema_url applies to the data in the "scope" field and all spans and span + events in the "spans" field. """ def __init__( self, @@ -276,19 +277,20 @@ class Span(google.protobuf.message.Message): ATTRIBUTES_FIELD_NUMBER: builtins.int DROPPED_ATTRIBUTES_COUNT_FIELD_NUMBER: builtins.int time_unix_nano: builtins.int - """time_unix_nano is the time the event occurred.""" + """The time the event occurred.""" name: builtins.str - """name of the event. + """The name of the event. This field is semantically required to be set to non-empty string. """ @property def attributes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: - """attributes is a collection of attribute key/value pairs on the event. + """A collection of attribute key/value pairs on the event. Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key). + The behavior of software that receives duplicated keys can be unpredictable. """ dropped_attributes_count: builtins.int - """dropped_attributes_count is the number of dropped attributes. If the value is 0, + """The number of dropped attributes. If the value is 0, then no attributes were dropped. """ def __init__( @@ -327,12 +329,13 @@ class Span(google.protobuf.message.Message): """The trace_state associated with the link.""" @property def attributes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: - """attributes is a collection of attribute key/value pairs on the link. + """A collection of attribute key/value pairs on the link. Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key). + The behavior of software that receives duplicated keys can be unpredictable. """ dropped_attributes_count: builtins.int - """dropped_attributes_count is the number of dropped attributes. If the value is 0, + """The number of dropped attributes. If the value is 0, then no attributes were dropped. """ flags: builtins.int @@ -449,7 +452,7 @@ class Span(google.protobuf.message.Message): and `SERVER` (callee) to identify queueing latency associated with the span. """ start_time_unix_nano: builtins.int - """start_time_unix_nano is the start time of the span. On the client side, this is the time + """The start time of the span. On the client side, this is the time kept by the local machine where the span execution starts. On the server side, this is the time when the server's application handler starts running. Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. @@ -457,7 +460,7 @@ class Span(google.protobuf.message.Message): This field is semantically required and it is expected that end_time >= start_time. """ end_time_unix_nano: builtins.int - """end_time_unix_nano is the end time of the span. On the client side, this is the time + """The end time of the span. On the client side, this is the time kept by the local machine where the span execution ends. On the server side, this is the time when the server application handler stops running. Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. @@ -466,7 +469,7 @@ class Span(google.protobuf.message.Message): """ @property def attributes(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[opentelemetry.proto.common.v1.common_pb2.KeyValue]: - """attributes is a collection of key/value pairs. Note, global attributes + """A collection of key/value pairs. Note, global attributes like server name can be set using the resource API. Examples of attributes: "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" @@ -474,30 +477,29 @@ class Span(google.protobuf.message.Message): "example.com/myattribute": true "example.com/score": 10.239 - The OpenTelemetry API specification further restricts the allowed value types: - https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute Attribute keys MUST be unique (it is not allowed to have more than one attribute with the same key). + The behavior of software that receives duplicated keys can be unpredictable. """ dropped_attributes_count: builtins.int - """dropped_attributes_count is the number of attributes that were discarded. Attributes + """The number of attributes that were discarded. Attributes can be discarded because their keys are too long or because there are too many attributes. If this value is 0, then no attributes were dropped. """ @property def events(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Span.Event]: - """events is a collection of Event items.""" + """A collection of Event items.""" dropped_events_count: builtins.int - """dropped_events_count is the number of dropped events. If the value is 0, then no + """The number of dropped events. If the value is 0, then no events were dropped. """ @property def links(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Span.Link]: - """links is a collection of Links, which are references from this span to a span + """A collection of Links, which are references from this span to a span in the same or different trace. """ dropped_links_count: builtins.int - """dropped_links_count is the number of dropped links after the maximum size was + """The number of dropped links after the maximum size was enforced. If this value is 0, then no links were dropped. """ @property diff --git a/scripts/proto_codegen.sh b/scripts/proto_codegen.sh index 8597c4b9729..6b0ffac7c15 100755 --- a/scripts/proto_codegen.sh +++ b/scripts/proto_codegen.sh @@ -12,30 +12,23 @@ # PROTO_REPO_DIR - the path to an existing checkout of the opentelemetry-proto repo # Pinned commit/branch/tag for the current version used in opentelemetry-proto python package. -PROTO_REPO_BRANCH_OR_COMMIT="v1.7.0" +PROTO_REPO_BRANCH_OR_COMMIT="v1.9.0" set -e PROTO_REPO_DIR=${PROTO_REPO_DIR:-"/tmp/opentelemetry-proto"} # root of opentelemetry-python repo repo_root="$(git rev-parse --show-toplevel)" -venv_dir="/tmp/proto_codegen_venv" -# run on exit even if crash -cleanup() { - echo "Deleting $venv_dir" - rm -rf $venv_dir +protoc() { + uvx -c $repo_root/gen-requirements.txt \ + --python 3.12 \ + --from grpcio-tools \ + --with mypy-protobuf \ + python -m grpc_tools.protoc "$@" } -trap cleanup EXIT -echo "Creating temporary virtualenv at $venv_dir using $(python3 --version)" -python3 -m venv $venv_dir -source $venv_dir/bin/activate -python -m pip install \ - -c $repo_root/gen-requirements.txt \ - grpcio-tools mypy-protobuf -echo 'python -m grpc_tools.protoc --version' -python -m grpc_tools.protoc --version +protoc --version # Clone the proto repo if it doesn't exist if [ ! -d "$PROTO_REPO_DIR" ]; then @@ -58,7 +51,7 @@ find opentelemetry/ -regex ".*_pb2.*\.pyi?" -exec rm {} + # generate proto code for all protos all_protos=$(find $PROTO_REPO_DIR/ -iname "*.proto") -python -m grpc_tools.protoc \ +protoc \ -I $PROTO_REPO_DIR \ --python_out=. \ --mypy_out=. \ @@ -67,7 +60,7 @@ python -m grpc_tools.protoc \ # generate grpc output only for protos with service definitions service_protos=$(grep -REl "service \w+ {" $PROTO_REPO_DIR/opentelemetry/) -python -m grpc_tools.protoc \ +protoc \ -I $PROTO_REPO_DIR \ --python_out=. \ --mypy_out=. \