Skip to content

Commit

Permalink
refactor: Moved proto files to their own repo (#1)
Browse files Browse the repository at this point in the history
Proto files should be in their own repo so that developers can generate
clients without depending on the main project.
  • Loading branch information
DoubleTK authored Sep 25, 2024
1 parent edfba02 commit c687133
Show file tree
Hide file tree
Showing 7 changed files with 346 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
90 changes: 90 additions & 0 deletions proto/span.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
syntax = "proto3";

option csharp_namespace = "OddDotNet";

message Span {
InstrumentationScope instrumentationScope = 1;
string name = 2;
map<string, AnyValue> attributes = 3;
repeated SpanEvent events = 4;
uint32 flags = 5;
SpanKind Kind = 6;
repeated SpanLink links = 7;
SpanStatus status = 8;
bytes spanId = 9;
bytes traceId = 10;
string traceState = 11;
bytes parentSpanId = 12;
uint64 startTimeUnixNano = 13;
uint64 endTimeUnixNano = 14;
}

message InstrumentationScope {
string name = 1;
map<string, AnyValue> attributes = 2;
string version = 3;
string schemaUrl = 4;
Resource resource = 5;
}

message Resource {
map<string, AnyValue> attributes = 1;
string schemaUrl = 2;
}

message SpanEvent {
string name = 1;
map<string, AnyValue> attributes = 2;
uint64 timeUnixNano = 3;
}

enum SpanKind {
UNSPECIFIED = 0;
INTERNAL = 1;
SERVER = 2;
CLIENT = 3;
PRODUCER = 4;
CONSUMER = 5;
}

message SpanLink {
bytes spanId = 1;
map<string, AnyValue> attributes = 2;
uint32 flags = 3;
bytes traceId = 4;
string traceState = 5;
}

message SpanStatus {
SpanStatusCode code = 1;
optional string message = 2;
}

enum SpanStatusCode {
UNSET = 0;
OK = 1;
ERROR = 2;
}

// AnyValue is used to represent any type of attribute value. AnyValue may contain a
// primitive value such as a string or integer or it may contain an arbitrary nested
// object containing arrays, key-value lists and primitives.
message AnyValue {
// The value is one of the listed fields. It is valid for all values to be unspecified
// in which case this AnyValue is considered to be "empty".
oneof value {
string string_value = 1;
bool bool_value = 2;
int64 int_value = 3;
double double_value = 5;
ArrayValue array_value = 6;
bytes bytes_value = 7;
}
}

// ArrayValue is a list of AnyValue messages. We need ArrayValue as a message
// since oneof in AnyValue does not allow repeated fields.
message ArrayValue {
// Array of values. The array may be empty (contain 0 elements).
repeated AnyValue values = 1;
}
224 changes: 224 additions & 0 deletions proto/span_query_request.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
syntax = "proto3";

option csharp_namespace = "OddDotNet";

import "span.proto";

message SpanQueryRequest {
repeated WhereSpanFilter filters = 1;
Take take = 2;
optional Duration duration = 3;
}

message WhereSpanFilter {
oneof Filter {
WhereSpanPropertyFilter spanProperty = 1;
WhereSpanOrFilter spanOr = 2;
}
}

message Take {
oneof TakeType {
TakeFirst takeFirst = 1;
TakeAll takeAll = 2;
TakeExact takeExact = 3;
}
}

message TakeFirst {}

message TakeAll {}

message TakeExact {
int32 count = 1;
}

message WhereSpanPropertyFilter {
oneof property {
StringProperty name = 1;
ByteStringProperty spanId = 2;
ByteStringProperty traceId = 3;
ByteStringProperty parentSpanId = 4;
UInt64Property startTimeUnixNano = 5;
UInt64Property endTimeUnixNano = 6;
SpanStatusCodeProperty statusCode = 7;
SpanKindProperty kind = 8;
KeyValueProperty attribute = 9;
UInt64Property eventTimeUnixNano = 10;
StringProperty eventName = 11;
ByteStringProperty linkTraceId = 12;
ByteStringProperty linkSpanId = 13;
StringProperty linkTraceState = 14;
UInt32Property linkFlags = 15;
UInt32Property flags = 16;
StringProperty traceState = 17;
KeyValueProperty eventAttribute = 18;
KeyValueProperty linkAttribute = 19;
StringProperty instrumentationScopeName = 20;
KeyValueProperty instrumentationScopeAttribute = 21;
StringProperty instrumentationScopeVersion = 22;
StringProperty instrumentationScopeSchemaUrl = 23;
StringProperty ResourceSchemaUrl = 24;
KeyValueProperty resourceAttribute = 25;
}
}

message WhereSpanOrFilter {
repeated WhereSpanFilter filters = 1;
}

message Duration {
oneof value {
uint64 secondsValue = 1;
uint64 millisecondsValue = 2;
uint64 minutesValue = 3;
}
}

message StringProperty {
StringCompareAsType compareAs = 1;
optional string compare = 2;
}

enum StringCompareAsType {
STRING_COMPARE_AS_TYPE_NONE = 0;
STRING_COMPARE_AS_TYPE_EQUALS = 1;
STRING_COMPARE_AS_TYPE_NOT_EQUALS = 2;
STRING_COMPARE_AS_TYPE_CONTAINS = 3;
STRING_COMPARE_AS_TYPE_NOT_CONTAINS = 4;
STRING_COMPARE_AS_TYPE_IS_EMPTY = 5;
STRING_COMPARE_AS_TYPE_IS_NOT_EMPTY = 6;
}

message ByteStringProperty {
ByteStringCompareAsType compareAs = 1;
optional bytes compare = 2;
}

enum ByteStringCompareAsType {
BYTE_STRING_COMPARE_AS_TYPE_NONE = 0;
BYTE_STRING_COMPARE_AS_TYPE_EQUALS = 1;
BYTE_STRING_COMPARE_AS_TYPE_NOT_EQUALS = 2;
BYTE_STRING_COMPARE_AS_TYPE_EMPTY = 3;
BYTE_STRING_COMPARE_AS_TYPE_NOT_EMPTY = 4;
}

message BoolProperty {
BoolCompareAsType compareAs = 1;
optional bool compare = 2;
}

enum BoolCompareAsType {
BOOL_COMPARE_AS_TYPE_NONE = 0;
BOOL_COMPARE_AS_TYPE_EQUALS = 1;
BOOL_COMPARE_AS_TYPE_NOT_EQUALS = 2;
}

message UInt64Property {
UInt64CompareAsType compareAs = 1;
optional uint64 compare = 2;
}

enum UInt64CompareAsType {
U_INT_64_COMPARE_AS_TYPE_NONE = 0;
U_INT_64_COMPARE_AS_TYPE_EQUALS = 1;
U_INT_64_COMPARE_AS_TYPE_NOT_EQUALS = 2;
U_INT_64_COMPARE_AS_TYPE_GREATER_THAN = 3;
U_INT_64_COMPARE_AS_TYPE_GREATER_THAN_EQUALS = 4;
U_INT_64_COMPARE_AS_TYPE_LESS_THAN = 5;
U_INT_64_COMPARE_AS_TYPE_LESS_THAN_EQUALS = 6;
}

message UInt32Property {
UInt32CompareAsType compareAs = 1;
optional uint32 compare = 2;
}

enum UInt32CompareAsType {
U_INT_32_COMPARE_AS_TYPE_NONE = 0;
U_INT_32_COMPARE_AS_TYPE_EQUALS = 1;
U_INT_32_COMPARE_AS_TYPE_NOT_EQUALS = 2;
U_INT_32_COMPARE_AS_TYPE_GREATER_THAN = 3;
U_INT_32_COMPARE_AS_TYPE_GREATER_THAN_EQUALS = 4;
U_INT_32_COMPARE_AS_TYPE_LESS_THAN = 5;
U_INT_32_COMPARE_AS_TYPE_LESS_THAN_EQUALS = 6;
}

message Int64Property {
Int64CompareAsType compareAs = 1;
optional int64 compare = 2;
}

enum Int64CompareAsType {
INT_64_COMPARE_AS_TYPE_NONE = 0;
INT_64_COMPARE_AS_TYPE_EQUALS = 1;
INT_64_COMPARE_AS_TYPE_NOT_EQUALS = 2;
INT_64_COMPARE_AS_TYPE_GREATER_THAN = 3;
INT_64_COMPARE_AS_TYPE_GREATER_THAN_EQUALS = 4;
INT_64_COMPARE_AS_TYPE_LESS_THAN = 5;
INT_64_COMPARE_AS_TYPE_LESS_THAN_EQUALS = 6;
}

message Int32Property {
Int32CompareAsType compareAs = 1;
optional int32 compare = 2;
}

enum Int32CompareAsType {
INT_32_COMPARE_AS_TYPE_NONE = 0;
INT_32_COMPARE_AS_TYPE_EQUALS = 1;
INT_32_COMPARE_AS_TYPE_NOT_EQUALS = 2;
INT_32_COMPARE_AS_TYPE_GREATER_THAN = 3;
INT_32_COMPARE_AS_TYPE_GREATER_THAN_EQUALS = 4;
INT_32_COMPARE_AS_TYPE_LESS_THAN = 5;
INT_32_COMPARE_AS_TYPE_LESS_THAN_EQUALS = 6;
}

message DoubleProperty {
DoubleCompareAsType compareAs = 1;
optional double compare = 2;
}

enum DoubleCompareAsType {
DOUBLE_COMPARE_AS_TYPE_NONE = 0;
DOUBLE_COMPARE_AS_TYPE_EQUALS = 1;
DOUBLE_COMPARE_AS_TYPE_NOT_EQUALS = 2;
DOUBLE_COMPARE_AS_TYPE_GREATER_THAN = 3;
DOUBLE_COMPARE_AS_TYPE_GREATER_THAN_EQUALS = 4;
DOUBLE_COMPARE_AS_TYPE_LESS_THAN = 5;
DOUBLE_COMPARE_AS_TYPE_LESS_THAN_EQUALS = 6;
}

message SpanStatusCodeProperty {
EnumCompareAsType compareAs = 1;
SpanStatusCode compare = 2;
}

message SpanKindProperty {
EnumCompareAsType compareAs = 1;
SpanKind compare = 2;
}

enum EnumCompareAsType {
ENUM_COMPARE_AS_TYPE_NONE = 0;
ENUM_COMPARE_AS_TYPE_EQUALS = 1;
ENUM_COMPARE_AS_TYPE_NOT_EQUALS = 2;
}

message KeyValueProperty {
string key = 1;
oneof value {
StringProperty stringValue = 2;
BoolProperty boolValue = 3;
Int64Property int64Value = 4;
DoubleProperty doubleValue = 5;
ByteStringProperty byteStringValue = 6;
}
}

enum KeyValueCompareAsType {
KEY_VALUE_COMPARE_AS_TYPE_NONE = 0;
KEY_VALUE_COMPARE_AS_TYPE_EQUALS = 1;
KEY_VALUE_COMPARE_AS_TYPE_NOT_EQUALS = 2;

}
9 changes: 9 additions & 0 deletions proto/span_query_response.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";

option csharp_namespace = "OddDotNet";

import "span.proto";

message SpanQueryResponse {
repeated Span spans = 1;
}
13 changes: 13 additions & 0 deletions proto/span_query_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";

option csharp_namespace = "OddDotNet";

import "span_query_request.proto";
import "span_query_response.proto";
import "span_reset_request.proto";
import "span_reset_response.proto";

service SpanQueryService {
rpc Query(SpanQueryRequest) returns (SpanQueryResponse);
rpc Reset(SpanResetRequest) returns (SpanResetResponse);
}
5 changes: 5 additions & 0 deletions proto/span_reset_request.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
syntax = "proto3";

option csharp_namespace = "OddDotNet";

message SpanResetRequest{}
5 changes: 5 additions & 0 deletions proto/span_reset_response.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
syntax = "proto3";

option csharp_namespace = "OddDotNet";

message SpanResetResponse{}

0 comments on commit c687133

Please sign in to comment.