Skip to content

Commit 0a1ed7d

Browse files
authored
Fix OpenTelemetry Conflicts (#1383)
* Remove old pb2 files * Add protos for opentelemetry-python 1.32.1 * Edit paths in opentelemetry proto files * Generate new opentelemetry pb2 files
1 parent 3e2991a commit 0a1ed7d

File tree

10 files changed

+1214
-405
lines changed

10 files changed

+1214
-405
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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+
15+
// =============================================================================
16+
// WARNING: Manually edited with the following changes.
17+
// 1. Replace listed .proto file paths with newrelic/packages/opentelemetry_proto/
18+
// 2. Replace listed __module__ paths with newrelic.packages.opentelemetry_proto
19+
// This prevents conflicts with other packages using different versions
20+
// of opentelemetry's pb2 files.
21+
// =============================================================================
22+
23+
syntax = "proto3";
24+
25+
package newrelic.packages.opentelemetry_proto;
26+
27+
option csharp_namespace = "OpenTelemetry.Proto.Common.V1";
28+
option java_multiple_files = true;
29+
option java_package = "io.opentelemetry.proto.common.v1";
30+
option java_outer_classname = "CommonProto";
31+
option go_package = "go.opentelemetry.io/proto/otlp/common/v1";
32+
33+
// AnyValue is used to represent any type of attribute value. AnyValue may contain a
34+
// primitive value such as a string or integer or it may contain an arbitrary nested
35+
// object containing arrays, key-value lists and primitives.
36+
message AnyValue {
37+
// The value is one of the listed fields. It is valid for all values to be unspecified
38+
// in which case this AnyValue is considered to be "empty".
39+
oneof value {
40+
string string_value = 1;
41+
bool bool_value = 2;
42+
int64 int_value = 3;
43+
double double_value = 4;
44+
ArrayValue array_value = 5;
45+
KeyValueList kvlist_value = 6;
46+
bytes bytes_value = 7;
47+
}
48+
}
49+
50+
// ArrayValue is a list of AnyValue messages. We need ArrayValue as a message
51+
// since oneof in AnyValue does not allow repeated fields.
52+
message ArrayValue {
53+
// Array of values. The array may be empty (contain 0 elements).
54+
repeated AnyValue values = 1;
55+
}
56+
57+
// KeyValueList is a list of KeyValue messages. We need KeyValueList as a message
58+
// since `oneof` in AnyValue does not allow repeated fields. Everywhere else where we need
59+
// a list of KeyValue messages (e.g. in Span) we use `repeated KeyValue` directly to
60+
// avoid unnecessary extra wrapping (which slows down the protocol). The 2 approaches
61+
// are semantically equivalent.
62+
message KeyValueList {
63+
// A collection of key/value pairs of key-value pairs. The list may be empty (may
64+
// contain 0 elements).
65+
// The keys MUST be unique (it is not allowed to have more than one
66+
// value with the same key).
67+
repeated KeyValue values = 1;
68+
}
69+
70+
// KeyValue is a key-value pair that is used to store Span attributes, Link
71+
// attributes, etc.
72+
message KeyValue {
73+
string key = 1;
74+
AnyValue value = 2;
75+
}
76+
77+
// InstrumentationScope is a message representing the instrumentation scope information
78+
// such as the fully qualified name and version.
79+
message InstrumentationScope {
80+
// An empty instrumentation scope name means the name is unknown.
81+
string name = 1;
82+
string version = 2;
83+
84+
// Additional attributes that describe the scope. [Optional].
85+
// Attribute keys MUST be unique (it is not allowed to have more than one
86+
// attribute with the same key).
87+
repeated KeyValue attributes = 3;
88+
uint32 dropped_attributes_count = 4;
89+
}
Lines changed: 27 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,42 @@
11
# -*- coding: utf-8 -*-
2+
# =============================================================================
3+
# WARNING: Generated from proto files edited with the following changes.
4+
# 1. Replace listed .proto file paths with newrelic/packages/opentelemetry_proto/
5+
# 2. Replace listed __module__ paths with newrelic.packages.opentelemetry_proto
6+
# This prevents conflicts with other packages using different versions
7+
# of opentelemetry's pb2 files.
8+
# =============================================================================
29
# Generated by the protocol buffer compiler. DO NOT EDIT!
3-
# source: opentelemetry/proto/common/v1/common.proto
10+
# source: newrelic/packages/opentelemetry_proto/common.proto
11+
# Protobuf Python Version: 5.26.1
412
"""Generated protocol buffer code."""
513
from google.protobuf import descriptor as _descriptor
614
from google.protobuf import descriptor_pool as _descriptor_pool
7-
from google.protobuf import message as _message
8-
from google.protobuf import reflection as _reflection
915
from google.protobuf import symbol_database as _symbol_database
16+
from google.protobuf.internal import builder as _builder
1017
# @@protoc_insertion_point(imports)
1118

1219
_sym_db = _symbol_database.Default()
1320

1421

1522

1623

17-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n*opentelemetry/proto/common/v1/common.proto\x12\x1dopentelemetry.proto.common.v1\"\x8c\x02\n\x08\x41nyValue\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x02 \x01(\x08H\x00\x12\x13\n\tint_value\x18\x03 \x01(\x03H\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12@\n\x0b\x61rray_value\x18\x05 \x01(\x0b\x32).opentelemetry.proto.common.v1.ArrayValueH\x00\x12\x43\n\x0ckvlist_value\x18\x06 \x01(\x0b\x32+.opentelemetry.proto.common.v1.KeyValueListH\x00\x12\x15\n\x0b\x62ytes_value\x18\x07 \x01(\x0cH\x00\x42\x07\n\x05value\"E\n\nArrayValue\x12\x37\n\x06values\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.AnyValue\"G\n\x0cKeyValueList\x12\x37\n\x06values\x18\x01 \x03(\x0b\x32\'.opentelemetry.proto.common.v1.KeyValue\"O\n\x08KeyValue\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x36\n\x05value\x18\x02 \x01(\x0b\x32\'.opentelemetry.proto.common.v1.AnyValue\";\n\x16InstrumentationLibrary\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t:\x02\x18\x01\"5\n\x14InstrumentationScope\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\tB[\n io.opentelemetry.proto.common.v1B\x0b\x43ommonProtoP\x01Z(go.opentelemetry.io/proto/otlp/common/v1b\x06proto3')
24+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n2newrelic/packages/opentelemetry_proto/common.proto\x12%newrelic.packages.opentelemetry_proto\"\x9c\x02\n\x08\x41nyValue\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x02 \x01(\x08H\x00\x12\x13\n\tint_value\x18\x03 \x01(\x03H\x00\x12\x16\n\x0c\x64ouble_value\x18\x04 \x01(\x01H\x00\x12H\n\x0b\x61rray_value\x18\x05 \x01(\x0b\x32\x31.newrelic.packages.opentelemetry_proto.ArrayValueH\x00\x12K\n\x0ckvlist_value\x18\x06 \x01(\x0b\x32\x33.newrelic.packages.opentelemetry_proto.KeyValueListH\x00\x12\x15\n\x0b\x62ytes_value\x18\x07 \x01(\x0cH\x00\x42\x07\n\x05value\"M\n\nArrayValue\x12?\n\x06values\x18\x01 \x03(\x0b\x32/.newrelic.packages.opentelemetry_proto.AnyValue\"O\n\x0cKeyValueList\x12?\n\x06values\x18\x01 \x03(\x0b\x32/.newrelic.packages.opentelemetry_proto.KeyValue\"W\n\x08KeyValue\x12\x0b\n\x03key\x18\x01 \x01(\t\x12>\n\x05value\x18\x02 \x01(\x0b\x32/.newrelic.packages.opentelemetry_proto.AnyValue\"\x9c\x01\n\x14InstrumentationScope\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12\x43\n\nattributes\x18\x03 \x03(\x0b\x32/.newrelic.packages.opentelemetry_proto.KeyValue\x12 \n\x18\x64ropped_attributes_count\x18\x04 \x01(\rB{\n io.opentelemetry.proto.common.v1B\x0b\x43ommonProtoP\x01Z(go.opentelemetry.io/proto/otlp/common/v1\xaa\x02\x1dOpenTelemetry.Proto.Common.V1b\x06proto3')
1825

19-
20-
21-
_ANYVALUE = DESCRIPTOR.message_types_by_name['AnyValue']
22-
_ARRAYVALUE = DESCRIPTOR.message_types_by_name['ArrayValue']
23-
_KEYVALUELIST = DESCRIPTOR.message_types_by_name['KeyValueList']
24-
_KEYVALUE = DESCRIPTOR.message_types_by_name['KeyValue']
25-
_INSTRUMENTATIONLIBRARY = DESCRIPTOR.message_types_by_name['InstrumentationLibrary']
26-
_INSTRUMENTATIONSCOPE = DESCRIPTOR.message_types_by_name['InstrumentationScope']
27-
AnyValue = _reflection.GeneratedProtocolMessageType('AnyValue', (_message.Message,), {
28-
'DESCRIPTOR' : _ANYVALUE,
29-
'__module__' : 'opentelemetry.proto.common.v1.common_pb2'
30-
# @@protoc_insertion_point(class_scope:opentelemetry.proto.common.v1.AnyValue)
31-
})
32-
_sym_db.RegisterMessage(AnyValue)
33-
34-
ArrayValue = _reflection.GeneratedProtocolMessageType('ArrayValue', (_message.Message,), {
35-
'DESCRIPTOR' : _ARRAYVALUE,
36-
'__module__' : 'opentelemetry.proto.common.v1.common_pb2'
37-
# @@protoc_insertion_point(class_scope:opentelemetry.proto.common.v1.ArrayValue)
38-
})
39-
_sym_db.RegisterMessage(ArrayValue)
40-
41-
KeyValueList = _reflection.GeneratedProtocolMessageType('KeyValueList', (_message.Message,), {
42-
'DESCRIPTOR' : _KEYVALUELIST,
43-
'__module__' : 'opentelemetry.proto.common.v1.common_pb2'
44-
# @@protoc_insertion_point(class_scope:opentelemetry.proto.common.v1.KeyValueList)
45-
})
46-
_sym_db.RegisterMessage(KeyValueList)
47-
48-
KeyValue = _reflection.GeneratedProtocolMessageType('KeyValue', (_message.Message,), {
49-
'DESCRIPTOR' : _KEYVALUE,
50-
'__module__' : 'opentelemetry.proto.common.v1.common_pb2'
51-
# @@protoc_insertion_point(class_scope:opentelemetry.proto.common.v1.KeyValue)
52-
})
53-
_sym_db.RegisterMessage(KeyValue)
54-
55-
InstrumentationLibrary = _reflection.GeneratedProtocolMessageType('InstrumentationLibrary', (_message.Message,), {
56-
'DESCRIPTOR' : _INSTRUMENTATIONLIBRARY,
57-
'__module__' : 'opentelemetry.proto.common.v1.common_pb2'
58-
# @@protoc_insertion_point(class_scope:opentelemetry.proto.common.v1.InstrumentationLibrary)
59-
})
60-
_sym_db.RegisterMessage(InstrumentationLibrary)
61-
62-
InstrumentationScope = _reflection.GeneratedProtocolMessageType('InstrumentationScope', (_message.Message,), {
63-
'DESCRIPTOR' : _INSTRUMENTATIONSCOPE,
64-
'__module__' : 'opentelemetry.proto.common.v1.common_pb2'
65-
# @@protoc_insertion_point(class_scope:opentelemetry.proto.common.v1.InstrumentationScope)
66-
})
67-
_sym_db.RegisterMessage(InstrumentationScope)
68-
69-
if _descriptor._USE_C_DESCRIPTORS == False:
70-
71-
DESCRIPTOR._options = None
72-
DESCRIPTOR._serialized_options = b'\n io.opentelemetry.proto.common.v1B\013CommonProtoP\001Z(go.opentelemetry.io/proto/otlp/common/v1'
73-
_INSTRUMENTATIONLIBRARY._options = None
74-
_INSTRUMENTATIONLIBRARY._serialized_options = b'\030\001'
75-
_ANYVALUE._serialized_start=78
76-
_ANYVALUE._serialized_end=346
77-
_ARRAYVALUE._serialized_start=348
78-
_ARRAYVALUE._serialized_end=417
79-
_KEYVALUELIST._serialized_start=419
80-
_KEYVALUELIST._serialized_end=490
81-
_KEYVALUE._serialized_start=492
82-
_KEYVALUE._serialized_end=571
83-
_INSTRUMENTATIONLIBRARY._serialized_start=573
84-
_INSTRUMENTATIONLIBRARY._serialized_end=632
85-
_INSTRUMENTATIONSCOPE._serialized_start=634
86-
_INSTRUMENTATIONSCOPE._serialized_end=687
26+
_globals = globals()
27+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
28+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'newrelic.packages.opentelemetry_proto.common_pb2', _globals)
29+
if not _descriptor._USE_C_DESCRIPTORS:
30+
_globals['DESCRIPTOR']._loaded_options = None
31+
_globals['DESCRIPTOR']._serialized_options = b'\n io.opentelemetry.proto.common.v1B\013CommonProtoP\001Z(go.opentelemetry.io/proto/otlp/common/v1\252\002\035OpenTelemetry.Proto.Common.V1'
32+
_globals['_ANYVALUE']._serialized_start=94
33+
_globals['_ANYVALUE']._serialized_end=378
34+
_globals['_ARRAYVALUE']._serialized_start=380
35+
_globals['_ARRAYVALUE']._serialized_end=457
36+
_globals['_KEYVALUELIST']._serialized_start=459
37+
_globals['_KEYVALUELIST']._serialized_end=538
38+
_globals['_KEYVALUE']._serialized_start=540
39+
_globals['_KEYVALUE']._serialized_end=627
40+
_globals['_INSTRUMENTATIONSCOPE']._serialized_start=630
41+
_globals['_INSTRUMENTATIONSCOPE']._serialized_end=786
8742
# @@protoc_insertion_point(module_scope)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
REPO_ROOT=$(git rev-parse --show-toplevel)
4+
cd $REPO_ROOT
5+
6+
# Generated from:
7+
# opentelemetry-python==1.32.1
8+
# Which uses:
9+
# grpcio-tools==1.63.2
10+
# https://github.com/open-telemetry/opentelemetry-proto/tree/v1.2.0
11+
12+
protos=(
13+
./newrelic/packages/opentelemetry_proto/metrics.proto
14+
./newrelic/packages/opentelemetry_proto/logs.proto
15+
./newrelic/packages/opentelemetry_proto/resource.proto
16+
./newrelic/packages/opentelemetry_proto/common.proto
17+
)
18+
python -m grpc_tools.protoc \
19+
-I ./ \
20+
--python_out=. \
21+
${protos[@]}

0 commit comments

Comments
 (0)