Skip to content

Commit 59d696d

Browse files
committed
Protobuf absolute path should include events
The files can't be generated relative to the `events` dir, or else `events` isn't included in the absolute path of the generated protobuf files. This can easily cause conflicts with other repos that define similarly named protobuf definitions (i.e. loggregator v2).
1 parent 89b8599 commit 59d696d

File tree

4 files changed

+64
-64
lines changed

4 files changed

+64
-64
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The [Sonde-Go](https://github.com/cloudfoundry/sonde-go) library can be used ins
3838
Or, from the base directory, where `$DST_DIR` is the desired destination:
3939
```
4040
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
41-
protoc -I=events --go_out=. events/*.proto
41+
protoc --go_out=. events/*.proto
4242
mv github.com/cloudfoundry/sonde-go/events/*.pb.go $DST_DIR
4343
rm -rf github.com
4444
```
@@ -47,7 +47,7 @@ rm -rf github.com
4747

4848
From the base directory, where `$DST_DIR` is the desired destination:
4949
```
50-
protoc -I=events --java_out=. events/*.proto
50+
protoc --java_out=. events/*.proto
5151
mv org/cloudfoundry/dropsonde/events/*.java $DST_DIR
5252
rm -rf org
5353
```

events/README.md

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,46 @@
33

44
## Table of Contents
55

6-
- [envelope.proto](#envelope-proto)
7-
- [Envelope](#events-Envelope)
8-
- [Envelope.TagsEntry](#events-Envelope-TagsEntry)
6+
- [events/envelope.proto](#events/envelope.proto)
7+
- [Envelope](#events.Envelope)
8+
- [Envelope.TagsEntry](#events.Envelope.TagsEntry)
99

10-
- [Envelope.EventType](#events-Envelope-EventType)
10+
- [Envelope.EventType](#events.Envelope.EventType)
1111

12-
- [error.proto](#error-proto)
13-
- [Error](#events-Error)
12+
- [events/error.proto](#events/error.proto)
13+
- [Error](#events.Error)
1414

15-
- [http.proto](#http-proto)
16-
- [HttpStartStop](#events-HttpStartStop)
15+
- [events/http.proto](#events/http.proto)
16+
- [HttpStartStop](#events.HttpStartStop)
1717

18-
- [Method](#events-Method)
19-
- [PeerType](#events-PeerType)
18+
- [Method](#events.Method)
19+
- [PeerType](#events.PeerType)
2020

21-
- [log.proto](#log-proto)
22-
- [LogMessage](#events-LogMessage)
21+
- [events/log.proto](#events/log.proto)
22+
- [LogMessage](#events.LogMessage)
2323

24-
- [LogMessage.MessageType](#events-LogMessage-MessageType)
24+
- [LogMessage.MessageType](#events.LogMessage.MessageType)
2525

26-
- [metric.proto](#metric-proto)
27-
- [ContainerMetric](#events-ContainerMetric)
28-
- [CounterEvent](#events-CounterEvent)
29-
- [ValueMetric](#events-ValueMetric)
26+
- [events/metric.proto](#events/metric.proto)
27+
- [ContainerMetric](#events.ContainerMetric)
28+
- [CounterEvent](#events.CounterEvent)
29+
- [ValueMetric](#events.ValueMetric)
3030

31-
- [uuid.proto](#uuid-proto)
32-
- [UUID](#events-UUID)
31+
- [events/uuid.proto](#events/uuid.proto)
32+
- [UUID](#events.UUID)
3333

3434
- [Scalar Value Types](#scalar-value-types)
3535

3636

3737

38-
<a name="envelope-proto"></a>
38+
<a name="events/envelope.proto"></a>
3939
<p align="right"><a href="#top">Top</a></p>
4040

41-
## envelope.proto
41+
## events/envelope.proto
4242

4343

4444

45-
<a name="events-Envelope"></a>
45+
<a name="events.Envelope"></a>
4646

4747
### Envelope
4848
Envelope wraps an Event and adds metadata.
@@ -51,26 +51,26 @@ Envelope wraps an Event and adds metadata.
5151
| Field | Type | Label | Description |
5252
| ----- | ---- | ----- | ----------- |
5353
| origin | [string](#string) | required | Unique description of the origin of this event. |
54-
| eventType | [Envelope.EventType](#events-Envelope-EventType) | required | Type of wrapped event. Only the optional field corresponding to the value of eventType should be set. |
54+
| eventType | [Envelope.EventType](#events.Envelope.EventType) | required | Type of wrapped event. Only the optional field corresponding to the value of eventType should be set. |
5555
| timestamp | [int64](#int64) | optional | UNIX timestamp (in nanoseconds) event was wrapped in this Envelope. |
5656
| deployment | [string](#string) | optional | Deployment name (used to uniquely identify source). |
5757
| job | [string](#string) | optional | Job name (used to uniquely identify source). |
5858
| index | [string](#string) | optional | Index of job (used to uniquely identify source). |
5959
| ip | [string](#string) | optional | IP address (used to uniquely identify source). |
60-
| tags | [Envelope.TagsEntry](#events-Envelope-TagsEntry) | repeated | key/value tags to include additional identifying information. |
61-
| httpStartStop | [HttpStartStop](#events-HttpStartStop) | optional | |
62-
| logMessage | [LogMessage](#events-LogMessage) | optional | |
63-
| valueMetric | [ValueMetric](#events-ValueMetric) | optional | |
64-
| counterEvent | [CounterEvent](#events-CounterEvent) | optional | |
65-
| error | [Error](#events-Error) | optional | |
66-
| containerMetric | [ContainerMetric](#events-ContainerMetric) | optional | |
60+
| tags | [Envelope.TagsEntry](#events.Envelope.TagsEntry) | repeated | key/value tags to include additional identifying information. |
61+
| httpStartStop | [HttpStartStop](#events.HttpStartStop) | optional | |
62+
| logMessage | [LogMessage](#events.LogMessage) | optional | |
63+
| valueMetric | [ValueMetric](#events.ValueMetric) | optional | |
64+
| counterEvent | [CounterEvent](#events.CounterEvent) | optional | |
65+
| error | [Error](#events.Error) | optional | |
66+
| containerMetric | [ContainerMetric](#events.ContainerMetric) | optional | |
6767

6868

6969

7070

7171

7272

73-
<a name="events-Envelope-TagsEntry"></a>
73+
<a name="events.Envelope.TagsEntry"></a>
7474

7575
### Envelope.TagsEntry
7676

@@ -88,7 +88,7 @@ Envelope wraps an Event and adds metadata.
8888

8989

9090

91-
<a name="events-Envelope-EventType"></a>
91+
<a name="events.Envelope.EventType"></a>
9292

9393
### Envelope.EventType
9494
Type of the wrapped event.
@@ -111,14 +111,14 @@ Type of the wrapped event.
111111

112112

113113

114-
<a name="error-proto"></a>
114+
<a name="events/error.proto"></a>
115115
<p align="right"><a href="#top">Top</a></p>
116116

117-
## error.proto
117+
## events/error.proto
118118

119119

120120

121-
<a name="events-Error"></a>
121+
<a name="events.Error"></a>
122122

123123
### Error
124124
An Error event represents an error in the originating process.
@@ -144,14 +144,14 @@ An Error event represents an error in the originating process.
144144

145145

146146

147-
<a name="http-proto"></a>
147+
<a name="events/http.proto"></a>
148148
<p align="right"><a href="#top">Top</a></p>
149149

150-
## http.proto
150+
## events/http.proto
151151

152152

153153

154-
<a name="events-HttpStartStop"></a>
154+
<a name="events.HttpStartStop"></a>
155155

156156
### HttpStartStop
157157
An HttpStartStop event represents the whole lifecycle of an HTTP request.
@@ -161,15 +161,15 @@ An HttpStartStop event represents the whole lifecycle of an HTTP request.
161161
| ----- | ---- | ----- | ----------- |
162162
| startTimestamp | [int64](#int64) | required | UNIX timestamp (in nanoseconds) when the request was sent (by a client) or received (by a server). |
163163
| stopTimestamp | [int64](#int64) | required | UNIX timestamp (in nanoseconds) when the request was received. |
164-
| requestId | [UUID](#events-UUID) | required | ID for tracking lifecycle of request. |
165-
| peerType | [PeerType](#events-PeerType) | required | Role of the emitting process in the request cycle. |
166-
| method | [Method](#events-Method) | required | Method of the request. |
164+
| requestId | [UUID](#events.UUID) | required | ID for tracking lifecycle of request. |
165+
| peerType | [PeerType](#events.PeerType) | required | Role of the emitting process in the request cycle. |
166+
| method | [Method](#events.Method) | required | Method of the request. |
167167
| uri | [string](#string) | required | Destination of the request. |
168168
| remoteAddress | [string](#string) | required | Remote address of the request. (For a server, this should be the origin of the request.) |
169169
| userAgent | [string](#string) | required | Contents of the UserAgent header on the request. |
170170
| statusCode | [int32](#int32) | required | Status code returned with the response to the request. |
171171
| contentLength | [int64](#int64) | required | Length of response (bytes). |
172-
| applicationId | [UUID](#events-UUID) | optional | If this request was made in relation to an appliciation, this field should track that application&#39;s ID. |
172+
| applicationId | [UUID](#events.UUID) | optional | If this request was made in relation to an appliciation, this field should track that application&#39;s ID. |
173173
| instanceIndex | [int32](#int32) | optional | Index of the application instance. |
174174
| instanceId | [string](#string) | optional | ID of the application instance. |
175175
| forwarded | [string](#string) | repeated | This contains http forwarded-for [x-forwarded-for] header from the request. |
@@ -181,7 +181,7 @@ An HttpStartStop event represents the whole lifecycle of an HTTP request.
181181

182182

183183

184-
<a name="events-Method"></a>
184+
<a name="events.Method"></a>
185185

186186
### Method
187187
HTTP method.
@@ -235,7 +235,7 @@ HTTP method.
235235

236236

237237

238-
<a name="events-PeerType"></a>
238+
<a name="events.PeerType"></a>
239239

240240
### PeerType
241241
Type of peer handling request.
@@ -254,14 +254,14 @@ Type of peer handling request.
254254

255255

256256

257-
<a name="log-proto"></a>
257+
<a name="events/log.proto"></a>
258258
<p align="right"><a href="#top">Top</a></p>
259259

260-
## log.proto
260+
## events/log.proto
261261

262262

263263

264-
<a name="events-LogMessage"></a>
264+
<a name="events.LogMessage"></a>
265265

266266
### LogMessage
267267
A LogMessage contains a &#34;log line&#34; and associated metadata.
@@ -270,7 +270,7 @@ A LogMessage contains a &#34;log line&#34; and associated metadata.
270270
| Field | Type | Label | Description |
271271
| ----- | ---- | ----- | ----------- |
272272
| message | [bytes](#bytes) | required | Bytes of the log message. (Note that it is not required to be a single line.) |
273-
| message_type | [LogMessage.MessageType](#events-LogMessage-MessageType) | required | Type of the message (OUT or ERR). |
273+
| message_type | [LogMessage.MessageType](#events.LogMessage.MessageType) | required | Type of the message (OUT or ERR). |
274274
| timestamp | [int64](#int64) | required | UNIX timestamp (in nanoseconds) when the log was written. |
275275
| app_id | [string](#string) | optional | Application that emitted the message (or to which the application is related). |
276276
| source_type | [string](#string) | optional | Source of the message. For Cloud Foundry, this can be &#34;APP&#34;, &#34;RTR&#34;, &#34;DEA&#34;, &#34;STG&#34;, etc. |
@@ -283,7 +283,7 @@ A LogMessage contains a &#34;log line&#34; and associated metadata.
283283

284284

285285

286-
<a name="events-LogMessage-MessageType"></a>
286+
<a name="events.LogMessage.MessageType"></a>
287287

288288
### LogMessage.MessageType
289289
MessageType stores the destination of the message (corresponding to STDOUT or STDERR).
@@ -302,14 +302,14 @@ MessageType stores the destination of the message (corresponding to STDOUT or ST
302302

303303

304304

305-
<a name="metric-proto"></a>
305+
<a name="events/metric.proto"></a>
306306
<p align="right"><a href="#top">Top</a></p>
307307

308-
## metric.proto
308+
## events/metric.proto
309309

310310

311311

312-
<a name="events-ContainerMetric"></a>
312+
<a name="events.ContainerMetric"></a>
313313

314314
### ContainerMetric
315315
A ContainerMetric records resource usage of an app in a container.
@@ -330,7 +330,7 @@ A ContainerMetric records resource usage of an app in a container.
330330

331331

332332

333-
<a name="events-CounterEvent"></a>
333+
<a name="events.CounterEvent"></a>
334334

335335
### CounterEvent
336336
A CounterEvent represents the increment of a counter. It contains only the
@@ -349,7 +349,7 @@ maintain the value of the counter.
349349

350350

351351

352-
<a name="events-ValueMetric"></a>
352+
<a name="events.ValueMetric"></a>
353353

354354
### ValueMetric
355355
A ValueMetric indicates the value of a metric at an instant in time.
@@ -375,14 +375,14 @@ A ValueMetric indicates the value of a metric at an instant in time.
375375

376376

377377

378-
<a name="uuid-proto"></a>
378+
<a name="events/uuid.proto"></a>
379379
<p align="right"><a href="#top">Top</a></p>
380380

381-
## uuid.proto
381+
## events/uuid.proto
382382

383383

384384

385-
<a name="events-UUID"></a>
385+
<a name="events.UUID"></a>
386386

387387
### UUID
388388
Type representing a 128-bit UUID.

events/envelope.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ option go_package = "github.com/cloudfoundry/sonde-go/events";
77
option java_package = "org.cloudfoundry.dropsonde.events";
88
option java_outer_classname = "EventFactory";
99

10-
import "http.proto";
11-
import "log.proto";
12-
import "metric.proto";
13-
import "error.proto";
10+
import "events/http.proto";
11+
import "events/log.proto";
12+
import "events/metric.proto";
13+
import "events/error.proto";
1414

1515
// Envelope wraps an Event and adds metadata.
1616
message Envelope {

events/http.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ option go_package = "github.com/cloudfoundry/sonde-go/events";
77
option java_package = "org.cloudfoundry.dropsonde.events";
88
option java_outer_classname = "HttpFactory";
99

10-
import "uuid.proto";
10+
import "events/uuid.proto";
1111

1212
// Type of peer handling request.
1313
enum PeerType {

0 commit comments

Comments
 (0)