common.proto 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Copyright 2019, OpenTelemetry Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package opentelemetry.proto.common.v1;
  16. option csharp_namespace = "OpenTelemetry.Proto.Common.V1";
  17. option java_multiple_files = true;
  18. option java_package = "io.opentelemetry.proto.common.v1";
  19. option java_outer_classname = "CommonProto";
  20. option go_package = "go.opentelemetry.io/proto/otlp/common/v1";
  21. // AnyValue is used to represent any type of attribute value. AnyValue may contain a
  22. // primitive value such as a string or integer or it may contain an arbitrary nested
  23. // object containing arrays, key-value lists and primitives.
  24. message AnyValue {
  25. // The value is one of the listed fields. It is valid for all values to be unspecified
  26. // in which case this AnyValue is considered to be "empty".
  27. oneof value {
  28. string string_value = 1;
  29. bool bool_value = 2;
  30. int64 int_value = 3;
  31. double double_value = 4;
  32. ArrayValue array_value = 5;
  33. KeyValueList kvlist_value = 6;
  34. bytes bytes_value = 7;
  35. }
  36. }
  37. // ArrayValue is a list of AnyValue messages. We need ArrayValue as a message
  38. // since oneof in AnyValue does not allow repeated fields.
  39. message ArrayValue {
  40. // Array of values. The array may be empty (contain 0 elements).
  41. repeated AnyValue values = 1;
  42. }
  43. // KeyValueList is a list of KeyValue messages. We need KeyValueList as a message
  44. // since `oneof` in AnyValue does not allow repeated fields. Everywhere else where we need
  45. // a list of KeyValue messages (e.g. in Span) we use `repeated KeyValue` directly to
  46. // avoid unnecessary extra wrapping (which slows down the protocol). The 2 approaches
  47. // are semantically equivalent.
  48. message KeyValueList {
  49. // A collection of key/value pairs of key-value pairs. The list may be empty (may
  50. // contain 0 elements).
  51. // The keys MUST be unique (it is not allowed to have more than one
  52. // value with the same key).
  53. repeated KeyValue values = 1;
  54. }
  55. // KeyValue is a key-value pair that is used to store Span attributes, Link
  56. // attributes, etc.
  57. message KeyValue {
  58. string key = 1;
  59. AnyValue value = 2;
  60. }
  61. // InstrumentationScope is a message representing the instrumentation scope information
  62. // such as the fully qualified name and version.
  63. message InstrumentationScope {
  64. // An empty instrumentation scope name means the name is unknown.
  65. string name = 1;
  66. string version = 2;
  67. // Additional attributes that describe the scope. [Optional].
  68. // Attribute keys MUST be unique (it is not allowed to have more than one
  69. // attribute with the same key).
  70. repeated KeyValue attributes = 3;
  71. uint32 dropped_attributes_count = 4;
  72. }