Skip to content
This repository was archived by the owner on Apr 7, 2022. It is now read-only.

Commit 39f1bda

Browse files
committed
Compilin some protobufs
0 parents  commit 39f1bda

14 files changed

+711
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.stack-work
2+
/bash_completion.sh

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2019-present Dmitry Ivanov
2+
3+
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
4+
5+
http://www.apache.org/licenses/LICENSE-2.0
6+
7+
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.

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# grpc-foo
2+
3+
Nothing to see here, please move along
4+
5+
## How to use it
6+
7+
```console
8+
$ grpc-foo --help
9+
```

Setup.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Data.ProtoLens.Setup
2+
3+
main = defaultMainGeneratingProtos "proto"

cli/Main.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
main :: IO ()
3+
main = putStrLn "All done."

package.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: grpc-foo
2+
version: 0.1.0
3+
synopsis: Nothing to see here, please move along
4+
description: Nothing to see here, please move along
5+
maintainer: Dmitry Ivanov <[email protected]>
6+
license: Apache-2.0
7+
github: ethercrow/grpc-foo
8+
category: Tools
9+
10+
ghc-options: -Wall -ferror-spans
11+
12+
extra-source-files: proto/**/*.proto
13+
14+
custom-setup:
15+
dependencies:
16+
- base
17+
- Cabal
18+
- proto-lens-setup
19+
20+
dependencies:
21+
- base >= 4.9 && < 5
22+
- containers
23+
- exceptions
24+
- lens
25+
- text
26+
- transformers
27+
- unordered-containers
28+
29+
library:
30+
source-dirs: src
31+
dependencies:
32+
- proto-lens-runtime
33+
- proto-lens
34+
exposed-modules:
35+
- Proto.Google.Protobuf.Timestamp
36+
- Proto.Google.Protobuf.Timestamp_Fields
37+
- Proto.Google.Api.Http
38+
- Proto.Google.Api.Http_Fields
39+
- Proto.Google.Api.Annotations
40+
- Proto.Google.Api.Annotations_Fields
41+
- Proto.Lightstep
42+
- Proto.Lightstep_Fields
43+
- Proto.Collector
44+
- Proto.Collector_Fields
45+
46+
executables:
47+
grpc-foo:
48+
main: Main.hs
49+
source-dirs: cli
50+
dependencies:
51+
- grpc-foo
52+
53+
tests:
54+
tasty:
55+
main: TestMain.hs
56+
source-dirs: test
57+
dependencies:
58+
- grpc-foo
59+
- tasty
60+
- tasty-discover
61+
- tasty-hunit
62+
- tasty-quickcheck
63+
- QuickCheck
64+
65+
default-extensions:
66+
- BlockArguments
67+
- FlexibleInstances
68+
- LambdaCase
69+
- MultiParamTypeClasses
70+
- MultiWayIf
71+
- RecordWildCards
72+
- RecordWildCards
73+
- ScopedTypeVariables
74+
- TupleSections
75+
- TypeApplications

proto/collector.proto

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
syntax = "proto3";
2+
3+
package lightstep.collector;
4+
5+
option go_package = "collectorpb";
6+
option objc_class_prefix = "LSPB";
7+
option java_multiple_files = true;
8+
option java_package = "com.lightstep.tracer.grpc";
9+
10+
import "google/protobuf/timestamp.proto";
11+
import "google/api/annotations.proto";
12+
13+
message SpanContext {
14+
uint64 trace_id = 1 [jstype=JS_STRING];
15+
uint64 span_id = 2 [jstype=JS_STRING];
16+
map<string, string> baggage = 3;
17+
}
18+
19+
// Represent both tags and log fields.
20+
message KeyValue {
21+
string key = 1;
22+
oneof value {
23+
// Holds arbitrary string data; well-formed JSON strings should go in
24+
// json_value.
25+
string string_value = 2;
26+
int64 int_value = 3 [jstype=JS_STRING];
27+
double double_value = 4;
28+
bool bool_value = 5;
29+
// Must be a well-formed JSON value. Truncated JSON should go in
30+
// string_value. Should not be used for tags.
31+
string json_value = 6;
32+
}
33+
}
34+
35+
message Log {
36+
google.protobuf.Timestamp timestamp = 1;
37+
repeated KeyValue fields = 2;
38+
}
39+
40+
message Reference {
41+
enum Relationship {
42+
CHILD_OF = 0;
43+
FOLLOWS_FROM = 1;
44+
}
45+
Relationship relationship = 1;
46+
SpanContext span_context = 2;
47+
}
48+
49+
message Span {
50+
SpanContext span_context = 1;
51+
string operation_name = 2;
52+
repeated Reference references = 3;
53+
google.protobuf.Timestamp start_timestamp = 4;
54+
uint64 duration_micros = 5 [jstype=JS_STRING];
55+
repeated KeyValue tags = 6;
56+
repeated Log logs = 7;
57+
}
58+
59+
message Reporter {
60+
uint64 reporter_id = 1 [jstype=JS_STRING];
61+
repeated KeyValue tags = 4;
62+
}
63+
64+
message MetricsSample {
65+
string name = 1;
66+
oneof value {
67+
int64 int_value = 2 [jstype=JS_STRING];
68+
double double_value = 3;
69+
}
70+
}
71+
72+
message InternalMetrics {
73+
google.protobuf.Timestamp start_timestamp = 1;
74+
uint64 duration_micros = 2 [jstype=JS_STRING];
75+
repeated Log logs = 3;
76+
repeated MetricsSample counts = 4;
77+
repeated MetricsSample gauges = 5;
78+
}
79+
80+
message Auth {
81+
string access_token = 1;
82+
}
83+
84+
message ReportRequest {
85+
Reporter reporter = 1;
86+
Auth auth = 2;
87+
repeated Span spans = 3;
88+
int64 timestamp_offset_micros = 5 [jstype=JS_STRING];
89+
InternalMetrics internal_metrics = 6;
90+
}
91+
92+
message Command {
93+
bool disable = 1;
94+
bool dev_mode = 2;
95+
}
96+
97+
message ReportResponse {
98+
repeated Command commands = 1;
99+
google.protobuf.Timestamp receive_timestamp = 2;
100+
google.protobuf.Timestamp transmit_timestamp = 3;
101+
repeated string errors = 4;
102+
repeated string warnings = 5;
103+
repeated string infos = 6;
104+
}
105+
106+
service CollectorService {
107+
rpc Report(ReportRequest) returns (ReportResponse) {
108+
option (google.api.http) = {
109+
post: "/api/v2/reports"
110+
body: "*"
111+
additional_bindings {
112+
get: "/api/v2/reports"
113+
}
114+
};
115+
}
116+
}

proto/google/api/annotations.proto

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright (c) 2015, Google 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+
syntax = "proto3";
16+
17+
package google.api;
18+
19+
import "google/api/http.proto";
20+
import "google/protobuf/descriptor.proto";
21+
22+
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
23+
option java_multiple_files = true;
24+
option java_outer_classname = "AnnotationsProto";
25+
option java_package = "com.google.api";
26+
option objc_class_prefix = "GAPI";
27+
28+
extend google.protobuf.MethodOptions {
29+
// See `HttpRule`.
30+
HttpRule http = 72295728;
31+
}

0 commit comments

Comments
 (0)