From c6871333d63e296bee6772e6b7d8f3a4df85ebb1 Mon Sep 17 00:00:00 2001 From: Tyler Kenna Date: Wed, 25 Sep 2024 13:15:18 -0700 Subject: [PATCH] refactor: Moved proto files to their own repo (#1) Proto files should be in their own repo so that developers can generate clients without depending on the main project. --- .DS_Store | Bin 0 -> 6148 bytes proto/span.proto | 90 +++++++++++++ proto/span_query_request.proto | 224 ++++++++++++++++++++++++++++++++ proto/span_query_response.proto | 9 ++ proto/span_query_service.proto | 13 ++ proto/span_reset_request.proto | 5 + proto/span_reset_response.proto | 5 + 7 files changed, 346 insertions(+) create mode 100644 .DS_Store create mode 100644 proto/span.proto create mode 100644 proto/span_query_request.proto create mode 100644 proto/span_query_response.proto create mode 100644 proto/span_query_service.proto create mode 100644 proto/span_reset_request.proto create mode 100644 proto/span_reset_response.proto diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a2b76981534904f1953af65aa01a8407fe6d2d0a GIT binary patch literal 6148 zcmeHK!EVz)5S>j^VpAdI01_OKEOCuOXiF=^#Z8k#CE!paH~wzsXj2E9_mGU`<{wBt5 zI9$VLbS`cFV>Hb(osSXa44=*+;0g8UDX>i!lvL#5^)J6F48=qNQ9u;fu7Ep?yuIxd znGpp 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 attributes = 2; + string version = 3; + string schemaUrl = 4; + Resource resource = 5; +} + +message Resource { + map attributes = 1; + string schemaUrl = 2; +} + +message SpanEvent { + string name = 1; + map 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 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; +} \ No newline at end of file diff --git a/proto/span_query_request.proto b/proto/span_query_request.proto new file mode 100644 index 0000000..f85991f --- /dev/null +++ b/proto/span_query_request.proto @@ -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; + +} \ No newline at end of file diff --git a/proto/span_query_response.proto b/proto/span_query_response.proto new file mode 100644 index 0000000..658f972 --- /dev/null +++ b/proto/span_query_response.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +option csharp_namespace = "OddDotNet"; + +import "span.proto"; + +message SpanQueryResponse { + repeated Span spans = 1; +} \ No newline at end of file diff --git a/proto/span_query_service.proto b/proto/span_query_service.proto new file mode 100644 index 0000000..aaf54ad --- /dev/null +++ b/proto/span_query_service.proto @@ -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); +} \ No newline at end of file diff --git a/proto/span_reset_request.proto b/proto/span_reset_request.proto new file mode 100644 index 0000000..ac6cd07 --- /dev/null +++ b/proto/span_reset_request.proto @@ -0,0 +1,5 @@ +syntax = "proto3"; + +option csharp_namespace = "OddDotNet"; + +message SpanResetRequest{} \ No newline at end of file diff --git a/proto/span_reset_response.proto b/proto/span_reset_response.proto new file mode 100644 index 0000000..0fc424b --- /dev/null +++ b/proto/span_reset_response.proto @@ -0,0 +1,5 @@ +syntax = "proto3"; + +option csharp_namespace = "OddDotNet"; + +message SpanResetResponse{} \ No newline at end of file