Skip to content

Commit 94f6628

Browse files
Add pb2 files for protobuf v6 (#1408)
* Add pb2 files for protobuf v6 * Update tox matrix for new protobuf versions * Add comment with runbook --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 5a378c9 commit 94f6628

File tree

3 files changed

+89
-3
lines changed

3 files changed

+89
-3
lines changed

newrelic/core/infinite_tracing_pb2.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,24 @@
2020
PROTOBUF_VERSION = (0, 0, 0)
2121

2222
# Import appropriate generated pb2 file for protobuf version
23-
if PROTOBUF_VERSION >= (5,):
23+
if PROTOBUF_VERSION >= (6,):
24+
from newrelic.core.infinite_tracing_v6_pb2 import AttributeValue, RecordStatus, Span, SpanBatch # noqa: F401
25+
elif PROTOBUF_VERSION >= (5,):
2426
from newrelic.core.infinite_tracing_v5_pb2 import AttributeValue, RecordStatus, Span, SpanBatch # noqa: F401
2527
elif PROTOBUF_VERSION >= (4,):
2628
from newrelic.core.infinite_tracing_v4_pb2 import AttributeValue, RecordStatus, Span, SpanBatch # noqa: F401
2729
else:
2830
from newrelic.core.infinite_tracing_v3_pb2 import AttributeValue, RecordStatus, Span, SpanBatch # noqa: F401
31+
32+
# To generate the pb2 file:
33+
#
34+
# 1. Install grpcio-tools
35+
# * The exact version needed is hard to determine, trial and error is normally used.
36+
# * The newly generated pb2 file will specify the minimum protobuf version needed, we want that to be the first version from this major version series.
37+
# 2. Run the command below to overwrite this file with the newly generated pb2 file.
38+
# 3. Rename the pb2 file to infinite_tracing_vX_pb2 where X is the protobuf major version.
39+
# 4. Restore this file from git.
40+
# 5. Update the if statements above to import the new pb2 file when using the correct protobuf version.
41+
# 6. Validate the generated pb2 file works with the oldest protobuf version in this major version series by importing this file.
42+
#
43+
# python -m grpc_tools.protoc --proto_path=newrelic/core --python_out=newrelic/core newrelic/core/infinite_tracing.proto
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copyright 2010 New Relic, Inc.
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+
# -*- coding: utf-8 -*-
16+
# Generated by the protocol buffer compiler. DO NOT EDIT!
17+
# NO CHECKED-IN PROTOBUF GENCODE
18+
# source: infinite_tracing.proto
19+
# Protobuf Python Version: 6.30.0
20+
"""Generated protocol buffer code."""
21+
from google.protobuf import descriptor as _descriptor
22+
from google.protobuf import descriptor_pool as _descriptor_pool
23+
from google.protobuf import runtime_version as _runtime_version
24+
from google.protobuf import symbol_database as _symbol_database
25+
from google.protobuf.internal import builder as _builder
26+
_runtime_version.ValidateProtobufRuntimeVersion(
27+
_runtime_version.Domain.PUBLIC,
28+
6,
29+
30,
30+
0,
31+
'',
32+
'infinite_tracing.proto'
33+
)
34+
# @@protoc_insertion_point(imports)
35+
36+
_sym_db = _symbol_database.Default()
37+
38+
39+
40+
41+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x16infinite_tracing.proto\x12\x15\x63om.newrelic.trace.v1\"7\n\tSpanBatch\x12*\n\x05spans\x18\x01 \x03(\x0b\x32\x1b.com.newrelic.trace.v1.Span\"\x86\x04\n\x04Span\x12\x10\n\x08trace_id\x18\x01 \x01(\t\x12?\n\nintrinsics\x18\x02 \x03(\x0b\x32+.com.newrelic.trace.v1.Span.IntrinsicsEntry\x12H\n\x0fuser_attributes\x18\x03 \x03(\x0b\x32/.com.newrelic.trace.v1.Span.UserAttributesEntry\x12J\n\x10\x61gent_attributes\x18\x04 \x03(\x0b\x32\x30.com.newrelic.trace.v1.Span.AgentAttributesEntry\x1aX\n\x0fIntrinsicsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x34\n\x05value\x18\x02 \x01(\x0b\x32%.com.newrelic.trace.v1.AttributeValue:\x02\x38\x01\x1a\\\n\x13UserAttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x34\n\x05value\x18\x02 \x01(\x0b\x32%.com.newrelic.trace.v1.AttributeValue:\x02\x38\x01\x1a]\n\x14\x41gentAttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x34\n\x05value\x18\x02 \x01(\x0b\x32%.com.newrelic.trace.v1.AttributeValue:\x02\x38\x01\"t\n\x0e\x41ttributeValue\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\x42\x07\n\x05value\"%\n\x0cRecordStatus\x12\x15\n\rmessages_seen\x18\x01 \x01(\x04\x32\xc5\x01\n\rIngestService\x12T\n\nRecordSpan\x12\x1b.com.newrelic.trace.v1.Span\x1a#.com.newrelic.trace.v1.RecordStatus\"\x00(\x01\x30\x01\x12^\n\x0fRecordSpanBatch\x12 .com.newrelic.trace.v1.SpanBatch\x1a#.com.newrelic.trace.v1.RecordStatus\"\x00(\x01\x30\x01\x62\x06proto3')
42+
43+
_globals = globals()
44+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
45+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'infinite_tracing_pb2', _globals)
46+
if not _descriptor._USE_C_DESCRIPTORS:
47+
DESCRIPTOR._loaded_options = None
48+
_globals['_SPAN_INTRINSICSENTRY']._loaded_options = None
49+
_globals['_SPAN_INTRINSICSENTRY']._serialized_options = b'8\001'
50+
_globals['_SPAN_USERATTRIBUTESENTRY']._loaded_options = None
51+
_globals['_SPAN_USERATTRIBUTESENTRY']._serialized_options = b'8\001'
52+
_globals['_SPAN_AGENTATTRIBUTESENTRY']._loaded_options = None
53+
_globals['_SPAN_AGENTATTRIBUTESENTRY']._serialized_options = b'8\001'
54+
_globals['_SPANBATCH']._serialized_start=49
55+
_globals['_SPANBATCH']._serialized_end=104
56+
_globals['_SPAN']._serialized_start=107
57+
_globals['_SPAN']._serialized_end=625
58+
_globals['_SPAN_INTRINSICSENTRY']._serialized_start=348
59+
_globals['_SPAN_INTRINSICSENTRY']._serialized_end=436
60+
_globals['_SPAN_USERATTRIBUTESENTRY']._serialized_start=438
61+
_globals['_SPAN_USERATTRIBUTESENTRY']._serialized_end=530
62+
_globals['_SPAN_AGENTATTRIBUTESENTRY']._serialized_start=532
63+
_globals['_SPAN_AGENTATTRIBUTESENTRY']._serialized_end=625
64+
_globals['_ATTRIBUTEVALUE']._serialized_start=627
65+
_globals['_ATTRIBUTEVALUE']._serialized_end=743
66+
_globals['_RECORDSTATUS']._serialized_start=745
67+
_globals['_RECORDSTATUS']._serialized_end=782
68+
_globals['_INGESTSERVICE']._serialized_start=785
69+
_globals['_INGESTSERVICE']._serialized_end=982
70+
# @@protoc_insertion_point(module_scope)

tox.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ envlist =
9191
python-adapter_waitress-{py37,py38,py39}-waitress010404,
9292
python-agent_features-{py37,py38,py39,py310,py311,py312,py313}-{with,without}_extensions,
9393
python-agent_features-pypy310-without_extensions,
94-
python-agent_streaming-{py37,py38,py39,py310,py311,py312,py313}-protobuf05-{with,without}_extensions,
95-
python-agent_streaming-py39-protobuf{03,0319,04}-{with,without}_extensions,
94+
python-agent_streaming-{py37,py38,py39,py310,py311,py312,py313}-protobuf06-{with,without}_extensions,
95+
python-agent_streaming-py39-protobuf{03,0319,04,05}-{with,without}_extensions,
9696
python-agent_unittests-{py37,py38,py39,py310,py311,py312,py313}-{with,without}_extensions,
9797
python-agent_unittests-pypy310-without_extensions,
9898
python-application_celery-{py37,py38,py39,py310,py311,py312,py313,pypy310}-celerylatest,
@@ -220,6 +220,7 @@ deps =
220220
adapter_waitress-waitresslatest: waitress
221221
agent_features: beautifulsoup4
222222
agent_features: protobuf
223+
agent_streaming-protobuf06: protobuf<7
223224
agent_streaming-protobuf05: protobuf<6
224225
agent_streaming-protobuf04: protobuf<5
225226
agent_streaming-protobuf03: protobuf<4

0 commit comments

Comments
 (0)