okit/pb/obkit.proto

101 lines
3.1 KiB
Protocol Buffer
Raw Normal View History

2022-11-01 16:21:43 +00:00
// Copyright (C) 2022 Mya Pitzeruse
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
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 {
string name = 1;
string hostname = 2;
}
// 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;
}