-
Notifications
You must be signed in to change notification settings - Fork 651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add protobuf via gRPC exporting support for Jaeger #1471
Merged
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
0e9976c
Add grpc and proto dependencies
srikanthccv b6b25bd
Add grpc client and move thrift convert logic to separate file
srikanthccv f431dbe
Rename test file
srikanthccv dc9b59a
Add jaeger proto files
srikanthccv 4da0209
Add generated files
srikanthccv e8673fa
Create separate package for thrift and protobuf translation
srikanthccv c1a5e61
Move AgentClient and Collector to package
srikanthccv e34f5d9
Add tests for jaeger and protobuf
srikanthccv 84533a6
WIP
srikanthccv 47570ff
Fix translation bugs
srikanthccv 3dc0ede
Add function for trace_id and span_id to bytes
srikanthccv ff506a8
Fix tests
srikanthccv cfef392
Update documentation
srikanthccv b435a12
Remove unused imports
srikanthccv 58497bf
Update translations
srikanthccv 07771eb
Add gRPC example
srikanthccv ec310ac
Fix tests
srikanthccv 8e98f5a
Fix <= p36 tests
srikanthccv b091816
Remove fields as order fails the test
srikanthccv cc9cf7f
Remove exporter example
srikanthccv a732ff3
Lint fixes
srikanthccv c1907f4
Fix tests; update doc
srikanthccv b730cd2
Fix py35 test
srikanthccv a4f655f
Fix lint
srikanthccv 76a9a42
Bump sphinx version
srikanthccv a7c78fe
Bump typehints version
srikanthccv b78a09b
Resolve merge conflicts
srikanthccv 5e51115
Fix docs build issue
srikanthccv 647a211
Final changes
srikanthccv 1aba1f9
Exclude jaeger from pypy
srikanthccv 44635a9
Add grpc example
srikanthccv 54aace1
Add changelog entry
srikanthccv cf1b278
Merge branch 'master' into jaeger-protobuf
srikanthccv 7a13b69
Add more explanation to jaeger protobuf example
srikanthccv 504b676
Review suggestions
srikanthccv a7b0f1c
Merge branch 'master' into jaeger-protobuf
srikanthccv add23d2
Merge branch 'master' into jaeger-protobuf
srikanthccv 9070d73
Make attributes private
srikanthccv 68c477c
Use .lower for format name
srikanthccv 6aaf2a0
Merge branch 'master' into jaeger-protobuf
srikanthccv fab1ed1
grpc endpoint changes
srikanthccv 87f6274
review suggestions
srikanthccv cf8c72c
Fix lint
srikanthccv f105915
Fix docs
srikanthccv 206622f
Fix docs
srikanthccv 070b28f
Add intersphinx mapping for grpc
srikanthccv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
exporter/opentelemetry-exporter-jaeger/proto/api_v2/collector.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright (c) 2019 The Jaeger Authors. | ||
// Copyright (c) 2018 Uber Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
syntax="proto3"; | ||
|
||
package jaeger.api_v2; | ||
|
||
import "model.proto"; | ||
import "gogoproto/gogo.proto"; | ||
import "google/api/annotations.proto"; | ||
import "protoc-gen-swagger/options/annotations.proto"; | ||
|
||
option go_package = "api_v2"; | ||
option java_package = "io.jaegertracing.api_v2"; | ||
|
||
// Enable gogoprotobuf extensions (https://github.com/gogo/protobuf/blob/master/extensions.md). | ||
// Enable custom Marshal method. | ||
option (gogoproto.marshaler_all) = true; | ||
// Enable custom Unmarshal method. | ||
option (gogoproto.unmarshaler_all) = true; | ||
// Enable custom Size method (Required by Marshal and Unmarshal). | ||
option (gogoproto.sizer_all) = true; | ||
// Enable registration with golang/protobuf for the grpc-gateway. | ||
option (gogoproto.goproto_registration) = true; | ||
|
||
option (grpc.gateway.protoc_gen_swagger.options.openapiv2_swagger) = { | ||
info: { | ||
version: "1.0"; | ||
}; | ||
external_docs: { | ||
url: "https://github.com/jaegertracing/jaeger"; | ||
description: "Jaeger API"; | ||
} | ||
schemes: HTTP; | ||
schemes: HTTPS; | ||
}; | ||
|
||
message PostSpansRequest { | ||
Batch batch = 1 [ | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
message PostSpansResponse { | ||
} | ||
|
||
service CollectorService { | ||
rpc PostSpans(PostSpansRequest) returns (PostSpansResponse) { | ||
option (google.api.http) = { | ||
post: "/api/v2/spans" | ||
body: "*" | ||
}; | ||
} | ||
} |
166 changes: 166 additions & 0 deletions
166
exporter/opentelemetry-exporter-jaeger/proto/api_v2/model.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
// Copyright (c) 2018 Uber Technologies, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
syntax="proto3"; | ||
|
||
package jaeger.api_v2; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
import "google/protobuf/duration.proto"; | ||
|
||
// TODO: document all types and fields | ||
|
||
// TODO: once this moves to jaeger-idl repo, we may want to change Go pkg to api_v2 | ||
// and rewrite it to model only in this repo. That should make it easier to generate | ||
// classes in other languages. | ||
option go_package = "model"; | ||
option java_package = "io.jaegertracing.api_v2"; | ||
|
||
// Enable gogoprotobuf extensions (https://github.com/gogo/protobuf/blob/master/extensions.md). | ||
// Enable custom Marshal method. | ||
option (gogoproto.marshaler_all) = true; | ||
// Enable custom Unmarshal method. | ||
option (gogoproto.unmarshaler_all) = true; | ||
// Enable custom Size method (Required by Marshal and Unmarshal). | ||
option (gogoproto.sizer_all) = true; | ||
// Enable registration with golang/protobuf for the grpc-gateway. | ||
option (gogoproto.goproto_registration) = true; | ||
|
||
enum ValueType { | ||
STRING = 0; | ||
BOOL = 1; | ||
INT64 = 2; | ||
FLOAT64 = 3; | ||
BINARY = 4; | ||
}; | ||
|
||
message KeyValue { | ||
option (gogoproto.equal) = true; | ||
option (gogoproto.compare) = true; | ||
|
||
string key = 1; | ||
ValueType v_type = 2; | ||
string v_str = 3; | ||
bool v_bool = 4; | ||
int64 v_int64 = 5; | ||
double v_float64 = 6; | ||
bytes v_binary = 7; | ||
} | ||
|
||
message Log { | ||
google.protobuf.Timestamp timestamp = 1 [ | ||
(gogoproto.stdtime) = true, | ||
(gogoproto.nullable) = false | ||
]; | ||
repeated KeyValue fields = 2 [ | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
enum SpanRefType { | ||
CHILD_OF = 0; | ||
FOLLOWS_FROM = 1; | ||
}; | ||
|
||
message SpanRef { | ||
bytes trace_id = 1 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.customtype) = "TraceID", | ||
(gogoproto.customname) = "TraceID" | ||
]; | ||
bytes span_id = 2 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.customtype) = "SpanID", | ||
(gogoproto.customname) = "SpanID" | ||
]; | ||
SpanRefType ref_type = 3; | ||
} | ||
|
||
message Process { | ||
string service_name = 1; | ||
repeated KeyValue tags = 2 [ | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
message Span { | ||
bytes trace_id = 1 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.customtype) = "TraceID", | ||
(gogoproto.customname) = "TraceID" | ||
]; | ||
bytes span_id = 2 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.customtype) = "SpanID", | ||
(gogoproto.customname) = "SpanID" | ||
]; | ||
string operation_name = 3; | ||
repeated SpanRef references = 4 [ | ||
(gogoproto.nullable) = false | ||
]; | ||
uint32 flags = 5 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.customtype) = "Flags" | ||
]; | ||
google.protobuf.Timestamp start_time = 6 [ | ||
(gogoproto.stdtime) = true, | ||
(gogoproto.nullable) = false | ||
]; | ||
google.protobuf.Duration duration = 7 [ | ||
(gogoproto.stdduration) = true, | ||
(gogoproto.nullable) = false | ||
]; | ||
repeated KeyValue tags = 8 [ | ||
(gogoproto.nullable) = false | ||
]; | ||
repeated Log logs = 9 [ | ||
(gogoproto.nullable) = false | ||
]; | ||
Process process = 10; | ||
string process_id = 11 [ | ||
(gogoproto.customname) = "ProcessID" | ||
]; | ||
repeated string warnings = 12; | ||
} | ||
|
||
message Trace { | ||
message ProcessMapping { | ||
string process_id = 1 [ | ||
(gogoproto.customname) = "ProcessID" | ||
]; | ||
Process process = 2 [ | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
repeated Span spans = 1; | ||
repeated ProcessMapping process_map = 2 [ | ||
(gogoproto.nullable) = false | ||
]; | ||
repeated string warnings = 3; | ||
} | ||
|
||
message Batch { | ||
repeated Span spans = 1; | ||
Process process = 2 [ | ||
(gogoproto.nullable) = true | ||
]; | ||
} | ||
|
||
message DependencyLink { | ||
string parent = 1; | ||
string child = 2; | ||
uint64 call_count = 3; | ||
string source = 4; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this isn't required for all exporter configurations, should this be an extras_require?
I personally don't care about bloating package dependencies and including unneeded ones, but I've found that to be a prickly subject for others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is needed as we have import for from grpc and typehints in certain places.