2022-11-02 20:16:48 +00:00
|
|
|
// Copyright (C) 2022 The OKit Authors
|
2022-11-01 16:21:43 +00:00
|
|
|
//
|
2022-11-02 20:16:48 +00:00
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
// of this software and associated documentation files (the "Software"), to deal
|
|
|
|
// in the Software without restriction, including without limitation the rights
|
|
|
|
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
// copies of the Software, and to permit persons to whom the Software is
|
|
|
|
// furnished to do so, subject to the following conditions:
|
2022-11-01 16:21:43 +00:00
|
|
|
//
|
2022-11-02 20:16:48 +00:00
|
|
|
// The above copyright notice and this permission notice shall be included in all
|
|
|
|
// copies or substantial portions of the Software.
|
2022-11-01 16:21:43 +00:00
|
|
|
//
|
2022-11-02 20:16:48 +00:00
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
|
|
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
|
|
|
// OR OTHER DEALINGS IN THE SOFTWARE.
|
2022-11-01 16:21:43 +00:00
|
|
|
|
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package obkit;
|
|
|
|
|
|
|
|
option go_package = "code.pitz.tech/mya/okit/pb";
|
|
|
|
|
|
|
|
// Duration provides a protocol local implementation of a duration.
|
|
|
|
message Duration {
|
|
|
|
int64 nanos = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Timestamp provides a protocol local implementation of a timestamp.
|
|
|
|
message Timestamp {
|
|
|
|
int64 seconds = 1;
|
|
|
|
int32 nanos = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tag defines a key-value element eligible for indexing.
|
|
|
|
message Tag {
|
|
|
|
string key = 1;
|
|
|
|
|
|
|
|
oneof value {
|
|
|
|
string string = 5;
|
|
|
|
int64 int64 = 6;
|
|
|
|
double double = 7;
|
|
|
|
bytes bytes = 8;
|
|
|
|
bool bool = 9;
|
|
|
|
Duration duration = 10;
|
|
|
|
Timestamp timestamp = 11;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Kind represents the various types of elements that we're collecting.
|
|
|
|
enum Kind {
|
|
|
|
Unknown = 0;
|
|
|
|
Event = 1;
|
|
|
|
Metric = 2;
|
|
|
|
Trace = 3;
|
|
|
|
Log = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Wire represents a common structure for communicating common observability elements. To help illustrate this, let us
|
|
|
|
// consider the following.
|
|
|
|
//
|
|
|
|
// - An Event is an Entry who's name is set and contains optional tags.
|
|
|
|
// - A Log is an Entry who's value is set to the verbosity of the message.
|
|
|
|
// - A Metric is an Event that has a value associated with the entry.
|
|
|
|
// - A Trace is a Metric whose tags have a specific structure that allow multiple to be correlated.
|
|
|
|
//
|
|
|
|
message Entry {
|
|
|
|
// Timestamp defines when the entry was emit. This system assumes the client clock is accurate enough.
|
|
|
|
Timestamp timestamp = 1;
|
|
|
|
|
|
|
|
// Kind is used to indicate what type of entry this is.
|
|
|
|
Kind kind = 3;
|
|
|
|
|
|
|
|
// Name is used to identify the metric name, log message, or traced function.
|
|
|
|
string name = 4;
|
|
|
|
|
|
|
|
// Tags is an optional field that contains a list of metadata associated with the entry.
|
|
|
|
repeated Tag tags = 5;
|
|
|
|
|
|
|
|
// Value is an optional field that defines a value associated with the entry (e.g. in the case of a log, metric, or trace).
|
|
|
|
oneof value {
|
|
|
|
string string = 6; // used for logs
|
|
|
|
double double = 7; // used for metrics
|
|
|
|
Duration duration = 8; // used for traces
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClientInfo is used to capture specific information about the client application that is emitting information.
|
|
|
|
message ClientInfo {
|
2022-11-02 20:16:48 +00:00
|
|
|
// Name is the canonical, simple name of the application (redis, mysql, etc...).
|
2022-11-01 16:21:43 +00:00
|
|
|
string name = 1;
|
2022-11-02 20:16:48 +00:00
|
|
|
|
|
|
|
// Instance is a unique identifier assigned to the process. This can be a hostname in the case of containers. It could
|
|
|
|
// also be a mac address in the case of physical machines.
|
|
|
|
string instance = 2;
|
2022-11-01 16:21:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Packet defines the set of data that is contained within each message sent to the server.
|
|
|
|
message Packet {
|
|
|
|
// Client contains information that identifies the emitting client.
|
|
|
|
ClientInfo client = 1;
|
|
|
|
|
|
|
|
// Entries are processed in batches, allowing local clients to buffer if necessary.
|
|
|
|
repeated Entry entries = 2;
|
|
|
|
}
|