// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include ////////////////////////////////////////////////////////////////////////// // // OTEL .proto definitions, for reference // #if 0 // clang-format off //////////////////////////////////////////////////////////////////////// // resource/v1/resource.proto // // Resource information. message Resource { // 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 attribute values SHOULD NOT contain empty values. // The attribute values SHOULD NOT contain bytes values. // The attribute values SHOULD NOT contain array values different than array of string values, bool values, int values, // double values. // The attribute values SHOULD NOT contain kvlist values. // The behavior of software that receives attributes containing such values can be unpredictable. // These restrictions can change in a minor release. // The restrictions take origin from the OpenTelemetry specification: // https://github.com/open-telemetry/opentelemetry-specification/blob/v1.47.0/specification/common/README.md#attribute. repeated opentelemetry.proto.common.v1.KeyValue attributes = 1; // The number of dropped attributes. If the value is 0, then // no attributes were dropped. uint32 dropped_attributes_count = 2; // Set of entities that participate in this Resource. // // Note: keys in the references MUST exist in attributes of this message. // // Status: [Development] repeated opentelemetry.proto.common.v1.EntityRef entity_refs = 3; } ///////////////////////////////////////////////////////////////////////// // common/v1/commmon.proto // // 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. message AnyValue { // The value is one of the listed fields. It is valid for all values to be unspecified // in which case this AnyValue is considered to be "empty". oneof value { string string_value = 1; bool bool_value = 2; int64 int_value = 3; double double_value = 4; ArrayValue array_value = 5; KeyValueList kvlist_value = 6; bytes bytes_value = 7; } } // ArrayValue is a list of AnyValue messages. We need ArrayValue as a message // since oneof in AnyValue does not allow repeated fields. message ArrayValue { // Array of values. The array may be empty (contain 0 elements). repeated AnyValue values = 1; } // KeyValueList is a list of KeyValue messages. We need KeyValueList as a message // since `oneof` in AnyValue does not allow repeated fields. Everywhere else where we need // a list of KeyValue messages (e.g. in Span) we use `repeated KeyValue` directly to // avoid unnecessary extra wrapping (which slows down the protocol). The 2 approaches // are semantically equivalent. message KeyValueList { // 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). repeated KeyValue values = 1; } // Represents a key-value pair that is used to store Span attributes, Link // attributes, etc. message KeyValue { // The key name of the pair. string key = 1; // The value of the pair. AnyValue value = 2; } // InstrumentationScope is a message representing the instrumentation scope information // such as the fully qualified name and version. message InstrumentationScope { // A name denoting the Instrumentation scope. // An empty instrumentation scope name means the name is unknown. string name = 1; // Defines the version of the instrumentation scope. // An empty instrumentation scope version means the version is unknown. string version = 2; // 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). repeated KeyValue attributes = 3; // 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. uint32 dropped_attributes_count = 4; } // clang-format on #endif ////////////////////////////////////////////////////////////////////////// namespace zen::otel { enum class KeyValueList : protozero::pbf_tag_type { repeated_KeyValue_values = 1 }; enum class KeyValue : protozero::pbf_tag_type { string_key = 1, AnyValue_value = 2 }; enum class Resource : protozero::pbf_tag_type { repeated_KeyValue_attributes = 1, uint32_dropped_attributes_count = 2, repeated_EntityRef_entity_refs = 3 }; enum class AnyValue : protozero::pbf_tag_type { string_string_value = 1, bool_bool_value = 2, int64_int_value = 3, double_double_value = 4, ArrayValue_array_value = 5, KeyValueList_kvlist_value = 6, bytes_bytes_value = 7 }; enum class InstrumentationScope : protozero::pbf_tag_type { string_name = 1, string_version = 2, repeated_KeyValue_attributes = 3, uint32_dropped_attributes_count = 4 }; } // namespace zen::otel