├── .gitignore ├── CODEOWNERS ├── LICENSE ├── NOTICE ├── README.md ├── events ├── README.md ├── envelope.proto ├── error.proto ├── http.proto ├── log.proto ├── metric.proto └── uuid.proto └── generate-java.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @cloudfoundry/wg-app-runtime-platform-logging-and-metrics-approvers 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Dropsonde-Protocol 2 | 3 | Copyright (c) 2015-Present CloudFoundry.org Foundation, Inc. All Rights Reserved. 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | If you have any questions, or want to get attention for a PR or issue please reach out on the [#logging-and-metrics channel in the cloudfoundry slack](https://cloudfoundry.slack.com/archives/CUW93AF3M) 2 | 3 | # dropsonde-protocol 4 | 5 | Dropsonde is a two-way protocol for emitting events and metrics in one direction. Messages are encoded in the Google [Protocol Buffer](https://developers.google.com/protocol-buffers) binary wire format. 6 | 7 | It is a goal of the system to reduce the need for low-level metric events (e.g. `ValueMetric` and `CounterEvent` messages). Though in the early stages, we include types such as `HttpStartEvent`, `HttpStopEvent` and `HttpStartStopEvent` to allow metric generation and aggregation at a higher level of abstraction, and to offload the work of aggregation to downstream receivers. Emitting applications should focus on delivering events, not processing them or computing statistics. 8 | 9 | This protocol forms the backbone of the [Doppler](https://github.com/cloudfoundry/loggregator) system of Cloud Foundry. 10 | 11 | ## Message types 12 | 13 | Please see the following for detailed descriptions of each type: 14 | 15 | * [events README](events/README.md) 16 | 17 | ## Library using this protocol 18 | 19 | * [Sonde-Go](https://github.com/cloudfoundry/sonde-go) is a generated Go library for components that wish to emit messages to or consume messages from the Cloud Foundry [metric system](https://github.com/cloudfoundry/loggregator). 20 | 21 | ## Generating code 22 | 23 | ### Setup 24 | 25 | Install protobuf. 26 | 27 | *Note: Due to [maps not being supported in protoc v2.X](https://github.com/google/protobuf/issues/799#issuecomment-138207911), the proto definitions in this repository require protoc v3.0.0 or higher.* 28 | 29 | On mac: 30 | ``` 31 | brew install protobuf 32 | ``` 33 | 34 | ### Go 35 | 36 | The [Sonde-Go](https://github.com/cloudfoundry/sonde-go) library can be used instead. 37 | 38 | Or, from your working directory, where `$DST_DIR` is the desired destination: 39 | ``` 40 | go install google.golang.org/protobuf/cmd/protoc-gen-go@latest 41 | protoc --go_out=. dropsonde-protocol/events/*.proto 42 | mv github.com/cloudfoundry/sonde-go/events/*.pb.go $DST_DIR 43 | rm -rf github.com 44 | ``` 45 | 46 | ### Java 47 | 48 | From your working directory, where `$DST_DIR` is the desired destination: 49 | ``` 50 | protoc --java_out=. dropsonde-protocol/events/*.proto 51 | mv org/cloudfoundry/dropsonde/events/*.java $DST_DIR 52 | rm -rf org 53 | ``` 54 | 55 | ### Other languages 56 | 57 | For C++ and Python, Google provides [tutorials](https://developers.google.com/protocol-buffers/docs/tutorials). 58 | 59 | Please see [this list](https://github.com/protocolbuffers/protobuf/blob/master/docs/third_party.md) for working with protocol buffers in other languages. 60 | 61 | ### Message documentation 62 | 63 | Each package's documentation is auto-generated with [protoc-gen-doc](https://github.com/estan/protoc-gen-doc). After installing the tool, run the following from your working directory: 64 | ``` 65 | protoc --doc_out=markdown,README.md:dropsonde-protocol/events dropsonde-protocol/events/*.proto 66 | ``` 67 | 68 | ## Communication protocols 69 | 70 | ### Event emission 71 | 72 | Dropsonde is intended to be a "fire and forget" protocol, in the sense that an emitter should send events to its receiver with no expectation of acknowledgement. There is no "handshake" step; the emitter simply begins emitting to a known address of an expected recipient. 73 | -------------------------------------------------------------------------------- /events/README.md: -------------------------------------------------------------------------------- 1 | # Protocol Documentation 2 | 3 | 4 | ## Table of Contents 5 | 6 | - [dropsonde-protocol/events/envelope.proto](#dropsonde-protocol_events_envelope-proto) 7 | - [Envelope](#events-Envelope) 8 | - [Envelope.TagsEntry](#events-Envelope-TagsEntry) 9 | 10 | - [Envelope.EventType](#events-Envelope-EventType) 11 | 12 | - [dropsonde-protocol/events/error.proto](#dropsonde-protocol_events_error-proto) 13 | - [Error](#events-Error) 14 | 15 | - [dropsonde-protocol/events/http.proto](#dropsonde-protocol_events_http-proto) 16 | - [HttpStartStop](#events-HttpStartStop) 17 | 18 | - [Method](#events-Method) 19 | - [PeerType](#events-PeerType) 20 | 21 | - [dropsonde-protocol/events/log.proto](#dropsonde-protocol_events_log-proto) 22 | - [LogMessage](#events-LogMessage) 23 | 24 | - [LogMessage.MessageType](#events-LogMessage-MessageType) 25 | 26 | - [dropsonde-protocol/events/metric.proto](#dropsonde-protocol_events_metric-proto) 27 | - [ContainerMetric](#events-ContainerMetric) 28 | - [CounterEvent](#events-CounterEvent) 29 | - [ValueMetric](#events-ValueMetric) 30 | 31 | - [dropsonde-protocol/events/uuid.proto](#dropsonde-protocol_events_uuid-proto) 32 | - [UUID](#events-UUID) 33 | 34 | - [Scalar Value Types](#scalar-value-types) 35 | 36 | 37 | 38 | 39 |

Top

40 | 41 | ## dropsonde-protocol/events/envelope.proto 42 | 43 | 44 | 45 | 46 | 47 | ### Envelope 48 | Envelope wraps an Event and adds metadata. 49 | 50 | 51 | | Field | Type | Label | Description | 52 | | ----- | ---- | ----- | ----------- | 53 | | 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. | 55 | | timestamp | [int64](#int64) | optional | UNIX timestamp (in nanoseconds) event was wrapped in this Envelope. | 56 | | deployment | [string](#string) | optional | Deployment name (used to uniquely identify source). | 57 | | job | [string](#string) | optional | Job name (used to uniquely identify source). | 58 | | index | [string](#string) | optional | Index of job (used to uniquely identify source). | 59 | | 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 | | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | ### Envelope.TagsEntry 76 | 77 | 78 | 79 | | Field | Type | Label | Description | 80 | | ----- | ---- | ----- | ----------- | 81 | | key | [string](#string) | optional | | 82 | | value | [string](#string) | optional | | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | ### Envelope.EventType 94 | Type of the wrapped event. 95 | 96 | | Name | Number | Description | 97 | | ---- | ------ | ----------- | 98 | | HttpStartStop | 4 | | 99 | | LogMessage | 5 | | 100 | | ValueMetric | 6 | | 101 | | CounterEvent | 7 | | 102 | | Error | 8 | | 103 | | ContainerMetric | 9 | | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 |

Top

116 | 117 | ## dropsonde-protocol/events/error.proto 118 | 119 | 120 | 121 | 122 | 123 | ### Error 124 | An Error event represents an error in the originating process. 125 | 126 | 127 | | Field | Type | Label | Description | 128 | | ----- | ---- | ----- | ----------- | 129 | | source | [string](#string) | required | Source of the error. This may or may not be the same as the Origin in the envelope. | 130 | | code | [int32](#int32) | required | Numeric error code. This is provided for programmatic responses to the error. | 131 | | message | [string](#string) | required | Error description (preferably human-readable). | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 |

Top

149 | 150 | ## dropsonde-protocol/events/http.proto 151 | 152 | 153 | 154 | 155 | 156 | ### HttpStartStop 157 | An HttpStartStop event represents the whole lifecycle of an HTTP request. 158 | 159 | 160 | | Field | Type | Label | Description | 161 | | ----- | ---- | ----- | ----------- | 162 | | startTimestamp | [int64](#int64) | required | UNIX timestamp (in nanoseconds) when the request was sent (by a client) or received (by a server). | 163 | | 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. | 167 | | uri | [string](#string) | required | Destination of the request. | 168 | | remoteAddress | [string](#string) | required | Remote address of the request. (For a server, this should be the origin of the request.) | 169 | | userAgent | [string](#string) | required | Contents of the UserAgent header on the request. | 170 | | statusCode | [int32](#int32) | required | Status code returned with the response to the request. | 171 | | 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's ID. | 173 | | instanceIndex | [int32](#int32) | optional | Index of the application instance. | 174 | | instanceId | [string](#string) | optional | ID of the application instance. | 175 | | forwarded | [string](#string) | repeated | This contains http forwarded-for [x-forwarded-for] header from the request. | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | ### Method 187 | HTTP method. 188 | 189 | | Name | Number | Description | 190 | | ---- | ------ | ----------- | 191 | | GET | 1 | | 192 | | POST | 2 | | 193 | | PUT | 3 | | 194 | | DELETE | 4 | | 195 | | HEAD | 5 | | 196 | | ACL | 6 | | 197 | | BASELINE_CONTROL | 7 | | 198 | | BIND | 8 | | 199 | | CHECKIN | 9 | | 200 | | CHECKOUT | 10 | | 201 | | CONNECT | 11 | | 202 | | COPY | 12 | | 203 | | DEBUG | 13 | | 204 | | LABEL | 14 | | 205 | | LINK | 15 | | 206 | | LOCK | 16 | | 207 | | MERGE | 17 | | 208 | | MKACTIVITY | 18 | | 209 | | MKCALENDAR | 19 | | 210 | | MKCOL | 20 | | 211 | | MKREDIRECTREF | 21 | | 212 | | MKWORKSPACE | 22 | | 213 | | MOVE | 23 | | 214 | | OPTIONS | 24 | | 215 | | ORDERPATCH | 25 | | 216 | | PATCH | 26 | | 217 | | PRI | 27 | | 218 | | PROPFIND | 28 | | 219 | | PROPPATCH | 29 | | 220 | | REBIND | 30 | | 221 | | REPORT | 31 | | 222 | | SEARCH | 32 | | 223 | | SHOWMETHOD | 33 | | 224 | | SPACEJUMP | 34 | | 225 | | TEXTSEARCH | 35 | | 226 | | TRACE | 36 | | 227 | | TRACK | 37 | | 228 | | UNBIND | 38 | | 229 | | UNCHECKOUT | 39 | | 230 | | UNLINK | 40 | | 231 | | UNLOCK | 41 | | 232 | | UPDATE | 42 | | 233 | | UPDATEREDIRECTREF | 43 | | 234 | | VERSION_CONTROL | 44 | | 235 | 236 | 237 | 238 | 239 | 240 | ### PeerType 241 | Type of peer handling request. 242 | 243 | | Name | Number | Description | 244 | | ---- | ------ | ----------- | 245 | | Client | 1 | Request is made by this process. | 246 | | Server | 2 | Request is received by this process. | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 |

Top

259 | 260 | ## dropsonde-protocol/events/log.proto 261 | 262 | 263 | 264 | 265 | 266 | ### LogMessage 267 | A LogMessage contains a "log line" and associated metadata. 268 | 269 | 270 | | Field | Type | Label | Description | 271 | | ----- | ---- | ----- | ----------- | 272 | | 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). | 274 | | timestamp | [int64](#int64) | required | UNIX timestamp (in nanoseconds) when the log was written. | 275 | | app_id | [string](#string) | optional | Application that emitted the message (or to which the application is related). | 276 | | source_type | [string](#string) | optional | Source of the message. For Cloud Foundry, this can be "APP", "RTR", "DEA", "STG", etc. | 277 | | source_instance | [string](#string) | optional | Instance that emitted the message. | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | ### LogMessage.MessageType 289 | MessageType stores the destination of the message (corresponding to STDOUT or STDERR). 290 | 291 | | Name | Number | Description | 292 | | ---- | ------ | ----------- | 293 | | OUT | 1 | | 294 | | ERR | 2 | | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 |

Top

307 | 308 | ## dropsonde-protocol/events/metric.proto 309 | 310 | 311 | 312 | 313 | 314 | ### ContainerMetric 315 | A ContainerMetric records resource usage of an app in a container. 316 | 317 | 318 | | Field | Type | Label | Description | 319 | | ----- | ---- | ----- | ----------- | 320 | | applicationId | [string](#string) | required | ID of the contained application. | 321 | | instanceIndex | [int32](#int32) | required | Instance index of the contained application. (This, with applicationId, should uniquely identify a container.) | 322 | | cpuPercentage | [double](#double) | required | CPU based on number of cores. | 323 | | memoryBytes | [uint64](#uint64) | required | Bytes of memory used. | 324 | | diskBytes | [uint64](#uint64) | required | Bytes of disk used. | 325 | | memoryBytesQuota | [uint64](#uint64) | optional | Maximum bytes of memory allocated to container. | 326 | | diskBytesQuota | [uint64](#uint64) | optional | Maximum bytes of disk allocated to container. | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | ### CounterEvent 336 | A CounterEvent represents the increment of a counter. It contains only the 337 | change in the value; it is the responsibility of downstream consumers to 338 | maintain the value of the counter. 339 | 340 | 341 | | Field | Type | Label | Description | 342 | | ----- | ---- | ----- | ----------- | 343 | | name | [string](#string) | required | Name of the counter. Must be consistent for downstream consumers to associate events semantically. | 344 | | delta | [uint64](#uint64) | required | Amount by which to increment the counter. | 345 | | total | [uint64](#uint64) | optional | Total value of the counter. This will be overridden by Metron, which internally tracks the total of each named Counter it receives. | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | ### ValueMetric 355 | A ValueMetric indicates the value of a metric at an instant in time. 356 | 357 | 358 | | Field | Type | Label | Description | 359 | | ----- | ---- | ----- | ----------- | 360 | | name | [string](#string) | required | Name of the metric. Must be consistent for downstream consumers to associate events semantically. | 361 | | value | [double](#double) | required | Value at the time of event emission. | 362 | | unit | [string](#string) | required | Unit of the metric. Please see http://metrics20.org/spec/#units for ideas; SI units/prefixes are recommended where applicable. Should be consistent for the life of the metric (consumers are expected to report, but not interpret, prefixes). | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 |

Top

380 | 381 | ## dropsonde-protocol/events/uuid.proto 382 | 383 | 384 | 385 | 386 | 387 | ### UUID 388 | Type representing a 128-bit UUID. 389 | 390 | The bytes of the UUID should be packed in little-endian **byte** (not bit) 391 | order. For example, the UUID `f47ac10b-58cc-4372-a567-0e02b2c3d479` should 392 | be encoded as `UUID{ low: 0x7243cc580bc17af4, high: 0x79d4c3b2020e67a5 }` 393 | 394 | 395 | | Field | Type | Label | Description | 396 | | ----- | ---- | ----- | ----------- | 397 | | low | [uint64](#uint64) | required | | 398 | | high | [uint64](#uint64) | required | | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | ## Scalar Value Types 415 | 416 | | .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | 417 | | ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | 418 | | double | | double | double | float | float64 | double | float | Float | 419 | | float | | float | float | float | float32 | float | float | Float | 420 | | int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | 421 | | int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | 422 | | uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | 423 | | uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | 424 | | sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | 425 | | sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | 426 | | fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | 427 | | fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | 428 | | sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | 429 | | sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | 430 | | bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | 431 | | string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | 432 | | bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | 433 | 434 | -------------------------------------------------------------------------------- /events/envelope.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package events; 4 | 5 | option go_package = "github.com/cloudfoundry/sonde-go/events"; 6 | 7 | option java_package = "org.cloudfoundry.dropsonde.events"; 8 | option java_outer_classname = "EventFactory"; 9 | 10 | import "dropsonde-protocol/events/http.proto"; 11 | import "dropsonde-protocol/events/log.proto"; 12 | import "dropsonde-protocol/events/metric.proto"; 13 | import "dropsonde-protocol/events/error.proto"; 14 | 15 | // Envelope wraps an Event and adds metadata. 16 | message Envelope { 17 | // Type of the wrapped event. 18 | enum EventType { 19 | reserved 1 to 3; 20 | reserved "Heartbeat", "HttpStart", "HttpStop"; 21 | HttpStartStop = 4; 22 | LogMessage = 5; 23 | ValueMetric = 6; 24 | CounterEvent = 7; 25 | Error = 8; 26 | ContainerMetric = 9; 27 | } 28 | 29 | // Unique description of the origin of this event. 30 | required string origin = 1; 31 | 32 | // Type of wrapped event. Only the optional field corresponding to the 33 | // value of eventType should be set. 34 | required EventType eventType = 2; 35 | 36 | // UNIX timestamp (in nanoseconds) event was wrapped in this Envelope. 37 | optional int64 timestamp = 6; 38 | 39 | // Deployment name (used to uniquely identify source). 40 | optional string deployment = 13; 41 | 42 | // Job name (used to uniquely identify source). 43 | optional string job = 14; 44 | 45 | // Index of job (used to uniquely identify source). 46 | optional string index = 15; 47 | 48 | // IP address (used to uniquely identify source). 49 | optional string ip = 16; 50 | 51 | // key/value tags to include additional identifying information. 52 | map tags = 17; 53 | 54 | reserved 3 to 5; 55 | reserved "Heartbeat", "HttpStart", "HttpStop"; 56 | 57 | optional HttpStartStop httpStartStop = 7; 58 | optional LogMessage logMessage = 8; 59 | optional ValueMetric valueMetric = 9; 60 | optional CounterEvent counterEvent = 10; 61 | optional Error error = 11; 62 | optional ContainerMetric containerMetric = 12; 63 | } 64 | -------------------------------------------------------------------------------- /events/error.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package events; 4 | 5 | option go_package = "github.com/cloudfoundry/sonde-go/events"; 6 | 7 | option java_package = "org.cloudfoundry.dropsonde.events"; 8 | option java_outer_classname = "ErrorFactory"; 9 | 10 | // An Error event represents an error in the originating process. 11 | message Error { 12 | // Source of the error. This may or may not be the same as the Origin in 13 | // the envelope. 14 | required string source = 1; 15 | 16 | // Numeric error code. This is provided for programmatic responses to the 17 | // error. 18 | required int32 code = 2; 19 | 20 | // Error description (preferably human-readable). 21 | required string message = 3; 22 | } 23 | -------------------------------------------------------------------------------- /events/http.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package events; 4 | 5 | option go_package = "github.com/cloudfoundry/sonde-go/events"; 6 | 7 | option java_package = "org.cloudfoundry.dropsonde.events"; 8 | option java_outer_classname = "HttpFactory"; 9 | 10 | import "dropsonde-protocol/events/uuid.proto"; 11 | 12 | // Type of peer handling request. 13 | enum PeerType { 14 | // Request is made by this process. 15 | Client = 1; 16 | 17 | // Request is received by this process. 18 | Server = 2; 19 | } 20 | 21 | // HTTP method. 22 | enum Method { 23 | GET = 1; 24 | POST = 2; 25 | PUT = 3; 26 | DELETE = 4; 27 | HEAD = 5; 28 | 29 | ACL = 6; 30 | BASELINE_CONTROL = 7; 31 | BIND = 8; 32 | CHECKIN = 9; 33 | CHECKOUT = 10; 34 | CONNECT = 11; 35 | COPY = 12; 36 | DEBUG = 13; 37 | LABEL = 14; 38 | LINK = 15; 39 | LOCK = 16; 40 | MERGE = 17; 41 | MKACTIVITY = 18; 42 | MKCALENDAR = 19; 43 | MKCOL = 20; 44 | MKREDIRECTREF = 21; 45 | MKWORKSPACE = 22; 46 | MOVE = 23; 47 | OPTIONS = 24; 48 | ORDERPATCH = 25; 49 | PATCH = 26; 50 | PRI = 27; 51 | PROPFIND = 28; 52 | PROPPATCH = 29; 53 | REBIND = 30; 54 | REPORT = 31; 55 | SEARCH = 32; 56 | SHOWMETHOD = 33; 57 | SPACEJUMP = 34; 58 | TEXTSEARCH = 35; 59 | TRACE = 36; 60 | TRACK = 37; 61 | UNBIND = 38; 62 | UNCHECKOUT = 39; 63 | UNLINK = 40; 64 | UNLOCK = 41; 65 | UPDATE = 42; 66 | UPDATEREDIRECTREF = 43; 67 | VERSION_CONTROL = 44; 68 | } 69 | 70 | // An HttpStartStop event represents the whole lifecycle of an HTTP request. 71 | message HttpStartStop { 72 | // UNIX timestamp (in nanoseconds) when the request was sent (by a client) 73 | // or received (by a server). 74 | required int64 startTimestamp = 1; 75 | 76 | // UNIX timestamp (in nanoseconds) when the request was received. 77 | required int64 stopTimestamp = 2; 78 | 79 | // ID for tracking lifecycle of request. 80 | required UUID requestId = 3; 81 | 82 | // Role of the emitting process in the request cycle. 83 | required PeerType peerType = 4; 84 | 85 | // Method of the request. 86 | required Method method = 5; 87 | 88 | // Destination of the request. 89 | required string uri = 6; 90 | 91 | // Remote address of the request. (For a server, this should be the origin 92 | // of the request.) 93 | required string remoteAddress = 7; 94 | 95 | // Contents of the UserAgent header on the request. 96 | required string userAgent = 8; 97 | 98 | // Status code returned with the response to the request. 99 | required int32 statusCode = 9; 100 | 101 | // Length of response (bytes). 102 | required int64 contentLength = 10; 103 | 104 | reserved 11; 105 | reserved "parentRequestId"; 106 | 107 | // If this request was made in relation to an appliciation, this field 108 | // should track that application's ID. 109 | optional UUID applicationId = 12; 110 | 111 | // Index of the application instance. 112 | optional int32 instanceIndex = 13; 113 | 114 | // ID of the application instance. 115 | optional string instanceId = 14; 116 | 117 | // This contains http forwarded-for [x-forwarded-for] header from the 118 | // request. 119 | repeated string forwarded = 15; 120 | } 121 | -------------------------------------------------------------------------------- /events/log.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package events; 4 | 5 | option go_package = "github.com/cloudfoundry/sonde-go/events"; 6 | 7 | option java_package = "org.cloudfoundry.dropsonde.events"; 8 | option java_outer_classname = "LogFactory"; 9 | 10 | // A LogMessage contains a "log line" and associated metadata. 11 | message LogMessage { 12 | // MessageType stores the destination of the message (corresponding to STDOUT or STDERR). 13 | enum MessageType { 14 | OUT = 1; 15 | ERR = 2; 16 | } 17 | 18 | // Bytes of the log message. (Note that it is not required to be a single line.) 19 | required bytes message = 1; 20 | 21 | // Type of the message (OUT or ERR). 22 | required MessageType message_type = 2; 23 | 24 | // UNIX timestamp (in nanoseconds) when the log was written. 25 | required int64 timestamp = 3; 26 | 27 | // Application that emitted the message (or to which the application is related). 28 | optional string app_id = 4; 29 | 30 | // Source of the message. For Cloud Foundry, this can be "APP", "RTR", "DEA", "STG", etc. 31 | optional string source_type = 5; 32 | 33 | // Instance that emitted the message. 34 | optional string source_instance = 6; 35 | } 36 | -------------------------------------------------------------------------------- /events/metric.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package events; 4 | 5 | option go_package = "github.com/cloudfoundry/sonde-go/events"; 6 | 7 | option java_package = "org.cloudfoundry.dropsonde.events"; 8 | option java_outer_classname = "MetricFactory"; 9 | 10 | // A ValueMetric indicates the value of a metric at an instant in time. 11 | message ValueMetric { 12 | // Name of the metric. Must be consistent for downstream consumers to 13 | // associate events semantically. 14 | required string name = 1; 15 | 16 | // Value at the time of event emission. 17 | required double value = 2; 18 | 19 | // Unit of the metric. Please see http://metrics20.org/spec/#units for 20 | // ideas; SI units/prefixes are recommended where applicable. Should be 21 | // consistent for the life of the metric (consumers are expected to report, 22 | // but not interpret, prefixes). 23 | required string unit = 3; 24 | } 25 | 26 | // A CounterEvent represents the increment of a counter. It contains only the 27 | // change in the value; it is the responsibility of downstream consumers to 28 | // maintain the value of the counter. 29 | message CounterEvent { 30 | // Name of the counter. Must be consistent for downstream consumers to 31 | // associate events semantically. 32 | required string name = 1; 33 | 34 | // Amount by which to increment the counter. 35 | required uint64 delta = 2; 36 | 37 | // Total value of the counter. This will be overridden by Metron, which 38 | // internally tracks the total of each named Counter it receives. 39 | optional uint64 total = 3; 40 | } 41 | 42 | // A ContainerMetric records resource usage of an app in a container. 43 | message ContainerMetric { 44 | // ID of the contained application. 45 | required string applicationId = 1; 46 | 47 | // Instance index of the contained application. (This, with applicationId, 48 | // should uniquely identify a container.) 49 | required int32 instanceIndex = 2; 50 | 51 | // CPU based on number of cores. 52 | required double cpuPercentage = 3; 53 | 54 | // Bytes of memory used. 55 | required uint64 memoryBytes = 4; 56 | 57 | // Bytes of disk used. 58 | required uint64 diskBytes = 5; 59 | 60 | // Maximum bytes of memory allocated to container. 61 | optional uint64 memoryBytesQuota = 6; 62 | 63 | // Maximum bytes of disk allocated to container. 64 | optional uint64 diskBytesQuota = 7; 65 | } 66 | -------------------------------------------------------------------------------- /events/uuid.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | package events; 4 | 5 | option go_package = "github.com/cloudfoundry/sonde-go/events"; 6 | 7 | option java_package = "org.cloudfoundry.dropsonde.events"; 8 | option java_outer_classname = "UuidFactory"; 9 | 10 | // Type representing a 128-bit UUID. 11 | // 12 | // The bytes of the UUID should be packed in little-endian **byte** (not bit) 13 | // order. For example, the UUID `f47ac10b-58cc-4372-a567-0e02b2c3d479` should 14 | // be encoded as `UUID{ low: 0x7243cc580bc17af4, high: 0x79d4c3b2020e67a5 }` 15 | message UUID { 16 | required uint64 low = 1; 17 | required uint64 high = 2; 18 | } 19 | -------------------------------------------------------------------------------- /generate-java.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dir_resolve() 4 | { 5 | [ "$1" != "" ] && mkdir -p "$1" 6 | cd "$1" 2>/dev/null || return $? # cd to desired directory; if fail, quell any error messages but return exit status 7 | echo "`pwd -P`" # output full, link-resolved path 8 | } 9 | 10 | set -e 11 | 12 | TARGET=`dir_resolve $1` 13 | if [ -z "$TARGET" ]; then 14 | echo 'USAGE: `generate-java.sh TARGET_PATH`' 15 | echo '' 16 | echo 'TARGET_PATH is where you would like the control and events packages to be generated.' 17 | exit 1 18 | fi 19 | 20 | pushd events 21 | mkdir -p $TARGET 22 | protoc -I=. --java_out=$TARGET --proto_path=$GOPATH/src:$GOPATH/src/github.com/gogo/protobuf/protobuf:. *.proto 23 | popd 24 | --------------------------------------------------------------------------------