Skip to content
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 gRPC plugin proto changes #1323

Merged
merged 32 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b658be0
Add gRPC plugin proto changes
chvck Feb 8, 2019
3cdbb0d
Change FindTraces signature to return a stream.
chvck Feb 12, 2019
61e63bf
Satisfy gofmt tool
chvck Feb 12, 2019
3a87811
Change proto package and service names
chvck Feb 13, 2019
464b68a
Delete commented out spanstorage
chvck Feb 13, 2019
786776e
Change FindTraces response to be a stream of spans
chvck Feb 13, 2019
d570a0e
Change from EmptyMessage to google.protobuf.Empty
chvck Feb 14, 2019
fbc8594
Move from using StoragePluginError to google.rpc.Status
chvck Feb 14, 2019
cd71076
Remove commented code and clean up proto formatting
chvck Feb 14, 2019
8d237e2
Remove protobuf responses and only return successes, rely on Status
chvck Feb 14, 2019
870c54e
Update Gopkg lockfile
chvck Feb 15, 2019
4f72738
Update Span type to come from model.proto
chvck Feb 18, 2019
6b998b5
Update storage proto file
chvck Feb 20, 2019
75eee97
Add generated storage plugin file to lint ignores
chvck Mar 18, 2019
5fb2135
Lint ignore grpc plugin generated code by name not path
chvck Mar 19, 2019
b503969
Rename FindTracesResponseChunk to SpansResponseChunk
chvck Mar 19, 2019
db7790a
Add marshal/unmarshal tests for DependencyLink
chvck Mar 20, 2019
d05d800
Add tests for storage protos with custom types
chvck Mar 20, 2019
8a301d9
Run fmt and ignore storage_test for linting
chvck Mar 20, 2019
54df218
Remove DependencyLinkSource and use string
chvck Mar 21, 2019
d46c32d
Update headers
chvck Mar 21, 2019
7dbde43
Add SpansChunkResponse test
chvck Mar 21, 2019
f99d320
Update makefile protoc calls
chvck Mar 22, 2019
18e47f2
Merge branch 'master' into proto-master
chvck Mar 25, 2019
3f8ea75
Update proto generated files and update license script
chvck Mar 26, 2019
273eaee
Merge branch 'master' into proto-master
chvck Mar 29, 2019
07a8b07
Update generated storage file to new proto layout
chvck Mar 29, 2019
94cfbae
Add storage generated files to import order cleanup ignores
chvck Mar 29, 2019
b23cde6
Move storage generated file to proto-gen dir
chvck Apr 3, 2019
7aafb1b
Remove generated plugin storage file from script ignores
chvck Apr 3, 2019
700e4e4
Fix copyright headers
chvck Apr 3, 2019
398c5d2
Update storage_test generated file
chvck Apr 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ required = [
[prune]
go-tests = true
unused-packages = true
[[prune.project]]
name = "github.com/gogo/protobuf"
non-go = false
unused-packages = false
[[prune.project]]
name = "github.com/grpc-ecosystem/grpc-gateway"
non-go = false
unused-packages = false
[[prune.project]]
name = "github.com/gogo/googleapis"
non-go = false
unused-packages = false

[[constraint]]
name = "github.com/Shopify/sarama"
Expand Down
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ ALL_SRC := $(shell find . -name '*.go' \
-not -name '*_test.go' \
-not -name 'model.pb.go' \
-not -name 'model_test.pb.go' \
-not -name 'storage.pb.go' \
-not -name 'storage_test.pb.go' \
-not -path './examples/*' \
-not -path './vendor/*' \
-not -path '*/mocks/*' \
Expand Down Expand Up @@ -337,19 +339,22 @@ PROTO_INCLUDES := \
-I model/proto \
-I vendor/github.com/grpc-ecosystem/grpc-gateway \
-I vendor/github.com/gogo/googleapis \
-I vendor/github.com/gogo/protobuf/protobuf \
-I vendor/github.com/gogo/protobuf
# Remapping of std types to gogo types (must not contain spaces)
PROTO_GOGO_MAPPINGS := $(shell echo \
Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/types, \
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types, \
Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types, \
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types, \
Mgoogle/api/annotations.proto=github.com/gogo/googleapis/google/api, \
Mmodel.proto=github.com/jaegertracing/jaeger/model \
| sed 's/ //g')


.PHONY: proto
proto:
# Generate gogo, gRPC-Gateway, swagger, go-validators output.
# Generate gogo, gRPC-Gateway, swagger, go-validators, gRPC-storage-plugin output.
#
# -I declares import folders, in order of importance
# This is how proto resolves the protofile imports.
Expand Down Expand Up @@ -385,11 +390,23 @@ proto:
--swagger_out=allow_merge=true:$(PWD)/proto-gen/openapi/ \
model/proto/api_v2/*.proto

$(PROTOC) \
$(PROTO_INCLUDES) \
-I plugin/storage/grpc/proto \
--gogo_out=plugins=grpc,$(PROTO_GOGO_MAPPINGS):$(PWD)/plugin/storage/grpc/proto/storage_v1 \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in order to avoid code coverage drop, we should place the generated files under proto-gen/storage_v1/

plugin/storage/grpc/proto/storage.proto
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix indentation in these two lines to align with L395


$(PROTOC) \
-I model/proto \
--go_out=$(PWD)/model/prototest/ \
model/proto/model_test.proto

$(PROTOC) \
-I plugin/storage/grpc/proto \
--go_out=$(PWD)/plugin/storage/grpc/proto/storageprototest/ \
plugin/storage/grpc/proto/storage_test.proto


.PHONY: proto-install
proto-install:
go get -u github.com/golang/glog
Expand Down
13 changes: 1 addition & 12 deletions model/dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,11 @@

package model

// DependencyLinkSource is the source of data used to generate the dependencies.
type DependencyLinkSource string

const (
// JaegerDependencyLinkSource describes a dependency diagram that was generated from Jaeger traces.
JaegerDependencyLinkSource = DependencyLinkSource("jaeger")
JaegerDependencyLinkSource = "jaeger"
)

// DependencyLink shows dependencies between services
type DependencyLink struct {
Parent string `json:"parent"`
Child string `json:"child"`
CallCount uint64 `json:"callCount"`
Source DependencyLinkSource `json:"source"`
}

// ApplyDefaults applies defaults to the DependencyLink.
func (d DependencyLink) ApplyDefaults() DependencyLink {
if d.Source == "" {
Expand Down
2 changes: 1 addition & 1 deletion model/dependencies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestDependencyLinkApplyDefaults(t *testing.T) {
dl := DependencyLink{}.ApplyDefaults()
assert.Equal(t, JaegerDependencyLinkSource, dl.Source)

networkSource := DependencyLinkSource("network")
networkSource := "network"
dl = DependencyLink{Source: networkSource}.ApplyDefaults()
assert.Equal(t, networkSource, dl.Source)
}
Loading