Skip to content

Commit 791c0a7

Browse files
Add Infinite Tracing Protobuf v5 Files (#1241)
* Add infinite tracing protobuf v5 files * Attempt to load protobuf files without version checks * Revert to using protobuf version for imports --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent eadaff6 commit 791c0a7

File tree

6 files changed

+124
-5
lines changed

6 files changed

+124
-5
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Generate pb2 files using the following command:
2+
// python -m grpc_tools.protoc --proto_path=newrelic/core --python_out=newrelic/core newrelic/core/infinite_tracing.proto
3+
4+
syntax = "proto3";
5+
6+
package com.newrelic.trace.v1;
7+
8+
service IngestService {
9+
// Accepts a stream of Span messages, and returns an irregular stream of
10+
// RecordStatus messages.
11+
rpc RecordSpan(stream Span) returns (stream RecordStatus) {}
12+
13+
// Accepts a stream of SpanBatch messages, and returns an irregular
14+
// stream of RecordStatus messages. This endpoint can be used to improve
15+
// throughput when Span messages are small
16+
rpc RecordSpanBatch(stream SpanBatch) returns (stream RecordStatus) {}
17+
}
18+
19+
message SpanBatch {
20+
repeated Span spans = 1;
21+
}
22+
23+
message Span {
24+
string trace_id = 1;
25+
map<string, AttributeValue> intrinsics = 2;
26+
map<string, AttributeValue> user_attributes = 3;
27+
map<string, AttributeValue> agent_attributes = 4;
28+
}
29+
30+
message AttributeValue {
31+
oneof value {
32+
string string_value = 1;
33+
bool bool_value = 2;
34+
int64 int_value = 3;
35+
double double_value = 4;
36+
}
37+
}
38+
39+
message RecordStatus {
40+
uint64 messages_seen = 1;
41+
}

newrelic/core/infinite_tracing_pb2.py

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

2222
# Import appropriate generated pb2 file for protobuf version
23-
if PROTOBUF_VERSION >= (4,):
23+
if PROTOBUF_VERSION >= (5,):
24+
from newrelic.core.infinite_tracing_v5_pb2 import ( # noqa: F401; pylint: disable=W0611
25+
AttributeValue,
26+
RecordStatus,
27+
Span,
28+
SpanBatch,
29+
)
30+
elif PROTOBUF_VERSION >= (4,):
2431
from newrelic.core.infinite_tracing_v4_pb2 import ( # noqa: F401; pylint: disable=W0611
2532
AttributeValue,
2633
RecordStatus,

newrelic/core/infinite_tracing_v3_pb2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
# Generated by the protocol buffer compiler. DO NOT EDIT!
16-
# source: v1.proto
16+
# source: infinite_tracing.proto
1717
"""Generated protocol buffer code."""
1818
from google.protobuf import descriptor as _descriptor
1919
from google.protobuf import descriptor_pool as _descriptor_pool

newrelic/core/infinite_tracing_v4_pb2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
# Generated by the protocol buffer compiler. DO NOT EDIT!
16-
# source: v1.proto
16+
# source: infinite_tracing.proto
1717
"""Generated protocol buffer code."""
1818
from google.protobuf import descriptor as _descriptor
1919
from google.protobuf import descriptor_pool as _descriptor_pool
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# -*- coding: utf-8 -*-
2+
# # Copyright 2010 New Relic, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
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: 5.27.2
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+
5,
29+
27,
30+
2,
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
@@ -93,8 +93,8 @@ envlist =
9393
python-adapter_waitress-{py37,py38,py39}-waitress010404,
9494
python-agent_features-{py37,py38,py39,py310,py311,py312,py313}-{with,without}_extensions,
9595
python-agent_features-pypy310-without_extensions,
96-
python-agent_streaming-{py37,py38,py39,py310,py311,py312,py313}-protobuf04-{with,without}_extensions,
97-
python-agent_streaming-py39-protobuf{03,0319}-{with,without}_extensions,
96+
python-agent_streaming-{py37,py38,py39,py310,py311,py312,py313}-protobuf05-{with,without}_extensions,
97+
python-agent_streaming-py39-protobuf{03,0319,04}-{with,without}_extensions,
9898
python-agent_unittests-{py37,py38,py39,py310,py311,py312,py313}-{with,without}_extensions,
9999
python-agent_unittests-pypy310-without_extensions,
100100
python-application_celery-{py37,py38,py39,py310,py311,py312,py313,pypy310}-celerylatest,
@@ -219,6 +219,7 @@ deps =
219219
adapter_waitress-waitresslatest: waitress
220220
agent_features: beautifulsoup4
221221
agent_features: protobuf
222+
agent_streaming-protobuf05: protobuf<6
222223
agent_streaming-protobuf04: protobuf<5
223224
agent_streaming-protobuf03: protobuf<4
224225
agent_streaming-protobuf0319: protobuf<3.20

0 commit comments

Comments
 (0)