diff --git a/src/proto/Project.toml b/src/proto/Project.toml index d344044e..073df4c7 100644 --- a/src/proto/Project.toml +++ b/src/proto/Project.toml @@ -1,7 +1,7 @@ name = "OpenTelemetryProto" uuid = "cc651e92-2989-4f95-bcc3-32e6fb6ac025" authors = ["Jun Tian "] -version = "0.20.0" +version = "0.20.1" [deps] ProtoBuf = "3349acd9-ac6a-5e09-bcdb-63829b23a429" diff --git a/src/proto/dev/Project.toml b/src/proto/dev/Project.toml index 63993db7..53ceed4c 100644 --- a/src/proto/dev/Project.toml +++ b/src/proto/dev/Project.toml @@ -1,2 +1,5 @@ [deps] +CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193" +Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" ProtoBuf = "3349acd9-ac6a-5e09-bcdb-63829b23a429" +Tar = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" diff --git a/src/proto/src/OpenTelemetryProto.jl b/src/proto/src/OpenTelemetryProto.jl index 27be66dd..a2c7f9be 100644 --- a/src/proto/src/OpenTelemetryProto.jl +++ b/src/proto/src/OpenTelemetryProto.jl @@ -1,5 +1,19 @@ module OpenTelemetryProto +import ProtoBuf + +# Compat shim: ProtoBuf 1.3 changed the decoder helper signature from +# `message_done(d)` to `message_done(d, endpos, group)`. Regenerated code +# uses the 3-arg form; provide a fallback when running against ProtoBuf <1.3 +# so the package keeps working across the full `ProtoBuf = "1"` compat range. +# OTLP is proto3 (no groups) and all length-delimited sub-messages are decoded +# through ProtoBuf.decode!, which constructs a LengthDelimitedProtoDecoder on +# older ProtoBuf releases, so the `endpos`/`group` parameters are unused there. +if !hasmethod(ProtoBuf.message_done, Tuple{ProtoBuf.AbstractProtoDecoder,Int,Bool}) + ProtoBuf.message_done(d::ProtoBuf.AbstractProtoDecoder, ::Int, ::Bool) = + ProtoBuf.message_done(d) +end + include("opentelemetry/opentelemetry.jl") end diff --git a/src/proto/src/opentelemetry/proto/collector/logs/v1/logs_service_pb.jl b/src/proto/src/opentelemetry/proto/collector/logs/v1/logs_service_pb.jl index 6fe279a4..f789ad8b 100644 --- a/src/proto/src/opentelemetry/proto/collector/logs/v1/logs_service_pb.jl +++ b/src/proto/src/opentelemetry/proto/collector/logs/v1/logs_service_pb.jl @@ -1,12 +1,12 @@ -# Autogenerated using ProtoBuf.jl v1.0.9 on 2023-03-01T12:24:55.830 -# original file: /home/tj/workspace/git/OpenTelemetry.jl/src/proto/dev/opentelemetry-proto-0.19.0/opentelemetry/proto/collector/logs/v1/logs_service.proto (proto3 syntax) +# Autogenerated using ProtoBuf.jl v1.3.0 +# original file: opentelemetry/proto/collector/logs/v1/logs_service.proto (proto3 syntax) import ProtoBuf as PB using ProtoBuf: OneOf using ProtoBuf.EnumX: @enumx export ExportLogsServiceRequest, ExportLogsPartialSuccess, ExportLogsServiceResponse -export LogsService + struct ExportLogsServiceRequest resource_logs::Vector{opentelemetry.proto.logs.v1.ResourceLogs} @@ -14,14 +14,14 @@ end PB.default_values(::Type{ExportLogsServiceRequest}) = (;resource_logs = Vector{opentelemetry.proto.logs.v1.ResourceLogs}()) PB.field_numbers(::Type{ExportLogsServiceRequest}) = (;resource_logs = 1) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportLogsServiceRequest}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportLogsServiceRequest}, _endpos::Int=0, _group::Bool=false) resource_logs = PB.BufferedVector{opentelemetry.proto.logs.v1.ResourceLogs}() - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, resource_logs) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ExportLogsServiceRequest(resource_logs[]) @@ -45,17 +45,17 @@ end PB.default_values(::Type{ExportLogsPartialSuccess}) = (;rejected_log_records = zero(Int64), error_message = "") PB.field_numbers(::Type{ExportLogsPartialSuccess}) = (;rejected_log_records = 1, error_message = 2) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportLogsPartialSuccess}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportLogsPartialSuccess}, _endpos::Int=0, _group::Bool=false) rejected_log_records = zero(Int64) error_message = "" - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 rejected_log_records = PB.decode(d, Int64) elseif field_number == 2 error_message = PB.decode(d, String) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ExportLogsPartialSuccess(rejected_log_records, error_message) @@ -80,14 +80,14 @@ end PB.default_values(::Type{ExportLogsServiceResponse}) = (;partial_success = nothing) PB.field_numbers(::Type{ExportLogsServiceResponse}) = (;partial_success = 1) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportLogsServiceResponse}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportLogsServiceResponse}, _endpos::Int=0, _group::Bool=false) partial_success = Ref{Union{Nothing,ExportLogsPartialSuccess}}(nothing) - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, partial_success) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ExportLogsServiceResponse(partial_success[]) @@ -104,5 +104,5 @@ function PB._encoded_size(x::ExportLogsServiceResponse) return encoded_size end -# TODO: SERVICE +# SERVICE: No codegen handlers registered # LogsService diff --git a/src/proto/src/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.jl b/src/proto/src/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.jl index df7ff30e..0dc4f39d 100644 --- a/src/proto/src/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.jl +++ b/src/proto/src/opentelemetry/proto/collector/metrics/v1/metrics_service_pb.jl @@ -1,12 +1,13 @@ -# Autogenerated using ProtoBuf.jl v1.0.9 on 2023-03-01T12:24:36.205 -# original file: /home/tj/workspace/git/OpenTelemetry.jl/src/proto/dev/opentelemetry-proto-0.19.0/opentelemetry/proto/collector/metrics/v1/metrics_service.proto (proto3 syntax) +# Autogenerated using ProtoBuf.jl v1.3.0 +# original file: opentelemetry/proto/collector/metrics/v1/metrics_service.proto (proto3 syntax) import ProtoBuf as PB using ProtoBuf: OneOf using ProtoBuf.EnumX: @enumx export ExportMetricsServiceRequest, ExportMetricsPartialSuccess -export ExportMetricsServiceResponse, MetricsService +export ExportMetricsServiceResponse + struct ExportMetricsServiceRequest resource_metrics::Vector{opentelemetry.proto.metrics.v1.ResourceMetrics} @@ -14,14 +15,14 @@ end PB.default_values(::Type{ExportMetricsServiceRequest}) = (;resource_metrics = Vector{opentelemetry.proto.metrics.v1.ResourceMetrics}()) PB.field_numbers(::Type{ExportMetricsServiceRequest}) = (;resource_metrics = 1) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportMetricsServiceRequest}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportMetricsServiceRequest}, _endpos::Int=0, _group::Bool=false) resource_metrics = PB.BufferedVector{opentelemetry.proto.metrics.v1.ResourceMetrics}() - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, resource_metrics) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ExportMetricsServiceRequest(resource_metrics[]) @@ -45,17 +46,17 @@ end PB.default_values(::Type{ExportMetricsPartialSuccess}) = (;rejected_data_points = zero(Int64), error_message = "") PB.field_numbers(::Type{ExportMetricsPartialSuccess}) = (;rejected_data_points = 1, error_message = 2) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportMetricsPartialSuccess}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportMetricsPartialSuccess}, _endpos::Int=0, _group::Bool=false) rejected_data_points = zero(Int64) error_message = "" - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 rejected_data_points = PB.decode(d, Int64) elseif field_number == 2 error_message = PB.decode(d, String) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ExportMetricsPartialSuccess(rejected_data_points, error_message) @@ -80,14 +81,14 @@ end PB.default_values(::Type{ExportMetricsServiceResponse}) = (;partial_success = nothing) PB.field_numbers(::Type{ExportMetricsServiceResponse}) = (;partial_success = 1) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportMetricsServiceResponse}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportMetricsServiceResponse}, _endpos::Int=0, _group::Bool=false) partial_success = Ref{Union{Nothing,ExportMetricsPartialSuccess}}(nothing) - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, partial_success) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ExportMetricsServiceResponse(partial_success[]) @@ -104,5 +105,5 @@ function PB._encoded_size(x::ExportMetricsServiceResponse) return encoded_size end -# TODO: SERVICE +# SERVICE: No codegen handlers registered # MetricsService diff --git a/src/proto/src/opentelemetry/proto/collector/trace/v1/trace_service_pb.jl b/src/proto/src/opentelemetry/proto/collector/trace/v1/trace_service_pb.jl index 72cebec7..081a4197 100644 --- a/src/proto/src/opentelemetry/proto/collector/trace/v1/trace_service_pb.jl +++ b/src/proto/src/opentelemetry/proto/collector/trace/v1/trace_service_pb.jl @@ -1,12 +1,12 @@ -# Autogenerated using ProtoBuf.jl v1.0.9 on 2023-03-01T12:14:45.357 -# original file: /home/tj/workspace/git/OpenTelemetry.jl/src/proto/dev/opentelemetry-proto-0.19.0/opentelemetry/proto/collector/trace/v1/trace_service.proto (proto3 syntax) +# Autogenerated using ProtoBuf.jl v1.3.0 +# original file: opentelemetry/proto/collector/trace/v1/trace_service.proto (proto3 syntax) import ProtoBuf as PB using ProtoBuf: OneOf using ProtoBuf.EnumX: @enumx export ExportTracePartialSuccess, ExportTraceServiceRequest, ExportTraceServiceResponse -export TraceService + struct ExportTracePartialSuccess rejected_spans::Int64 @@ -15,17 +15,17 @@ end PB.default_values(::Type{ExportTracePartialSuccess}) = (;rejected_spans = zero(Int64), error_message = "") PB.field_numbers(::Type{ExportTracePartialSuccess}) = (;rejected_spans = 1, error_message = 2) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportTracePartialSuccess}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportTracePartialSuccess}, _endpos::Int=0, _group::Bool=false) rejected_spans = zero(Int64) error_message = "" - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 rejected_spans = PB.decode(d, Int64) elseif field_number == 2 error_message = PB.decode(d, String) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ExportTracePartialSuccess(rejected_spans, error_message) @@ -50,14 +50,14 @@ end PB.default_values(::Type{ExportTraceServiceRequest}) = (;resource_spans = Vector{opentelemetry.proto.trace.v1.ResourceSpans}()) PB.field_numbers(::Type{ExportTraceServiceRequest}) = (;resource_spans = 1) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportTraceServiceRequest}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportTraceServiceRequest}, _endpos::Int=0, _group::Bool=false) resource_spans = PB.BufferedVector{opentelemetry.proto.trace.v1.ResourceSpans}() - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, resource_spans) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ExportTraceServiceRequest(resource_spans[]) @@ -80,14 +80,14 @@ end PB.default_values(::Type{ExportTraceServiceResponse}) = (;partial_success = nothing) PB.field_numbers(::Type{ExportTraceServiceResponse}) = (;partial_success = 1) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportTraceServiceResponse}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExportTraceServiceResponse}, _endpos::Int=0, _group::Bool=false) partial_success = Ref{Union{Nothing,ExportTracePartialSuccess}}(nothing) - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, partial_success) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ExportTraceServiceResponse(partial_success[]) @@ -104,5 +104,5 @@ function PB._encoded_size(x::ExportTraceServiceResponse) return encoded_size end -# TODO: SERVICE +# SERVICE: No codegen handlers registered # TraceService diff --git a/src/proto/src/opentelemetry/proto/common/v1/common_pb.jl b/src/proto/src/opentelemetry/proto/common/v1/common_pb.jl index d24333d9..4ffb8f14 100644 --- a/src/proto/src/opentelemetry/proto/common/v1/common_pb.jl +++ b/src/proto/src/opentelemetry/proto/common/v1/common_pb.jl @@ -1,34 +1,55 @@ -# Autogenerated using ProtoBuf.jl v1.0.9 on 2023-03-01T12:24:55.831 -# original file: /home/tj/workspace/git/OpenTelemetry.jl/src/proto/dev/opentelemetry-proto-0.19.0/opentelemetry/proto/common/v1/common.proto (proto3 syntax) +# Autogenerated using ProtoBuf.jl v1.3.0 +# original file: opentelemetry/proto/common/v1/common.proto (proto3 syntax) import ProtoBuf as PB using ProtoBuf: OneOf using ProtoBuf.EnumX: @enumx -export ArrayValue, InstrumentationScope, KeyValueList, AnyValue, KeyValue +export ArrayValue, InstrumentationScope, KeyValue, KeyValueList, AnyValue +abstract type var"##Abstract#ArrayValue" end +abstract type var"##Abstract#InstrumentationScope" end +abstract type var"##Abstract#KeyValueList" end +abstract type var"##Abstract#AnyValue" end +abstract type var"##Abstract#KeyValue" end -# Abstract types to help resolve mutually recursive definitions -abstract type var"##AbstractArrayValue" end -abstract type var"##AbstractInstrumentationScope" end -abstract type var"##AbstractKeyValueList" end -abstract type var"##AbstractAnyValue" end -abstract type var"##AbstractKeyValue" end - -struct ArrayValue{T1<:Union{Nothing,var"##AbstractAnyValue"}} <: var"##AbstractArrayValue" +# Stub definitions for cyclic types +struct var"##Stub#ArrayValue"{T1<:var"##Abstract#AnyValue"} <: var"##Abstract#ArrayValue" values::Vector{T1} end + +struct var"##Stub#InstrumentationScope"{T1<:var"##Abstract#KeyValue"} <: var"##Abstract#InstrumentationScope" + name::String + version::String + attributes::Vector{T1} + dropped_attributes_count::UInt32 +end + +struct var"##Stub#KeyValue"{T1<:var"##Abstract#AnyValue"} <: var"##Abstract#KeyValue" + key::String + value::Union{Nothing,T1} +end + +struct var"##Stub#KeyValueList"{T1<:var"##Abstract#AnyValue"} <: var"##Abstract#KeyValueList" + values::Vector{var"##Stub#KeyValue"{T1}} +end + +struct var"##Stub#AnyValue" <: var"##Abstract#AnyValue" + value::Union{Nothing,OneOf{<:Union{String,Bool,Int64,Float64,var"##Stub#ArrayValue"{var"##Stub#AnyValue"},var"##Stub#KeyValueList"{var"##Stub#AnyValue"},Vector{UInt8}}}} +end + +const ArrayValue = var"##Stub#ArrayValue"{var"##Stub#AnyValue"} PB.default_values(::Type{ArrayValue}) = (;values = Vector{AnyValue}()) PB.field_numbers(::Type{ArrayValue}) = (;values = 1) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ArrayValue}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ArrayValue}, _endpos::Int=0, _group::Bool=false) values = PB.BufferedVector{AnyValue}() - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, values) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ArrayValue(values[]) @@ -45,21 +66,16 @@ function PB._encoded_size(x::ArrayValue) return encoded_size end -struct InstrumentationScope{T1<:Union{Nothing,var"##AbstractKeyValue"}} <: var"##AbstractInstrumentationScope" - name::String - version::String - attributes::Vector{T1} - dropped_attributes_count::UInt32 -end +const InstrumentationScope = var"##Stub#InstrumentationScope"{var"##Stub#KeyValue"{var"##Stub#AnyValue"}} PB.default_values(::Type{InstrumentationScope}) = (;name = "", version = "", attributes = Vector{KeyValue}(), dropped_attributes_count = zero(UInt32)) PB.field_numbers(::Type{InstrumentationScope}) = (;name = 1, version = 2, attributes = 3, dropped_attributes_count = 4) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:InstrumentationScope}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:InstrumentationScope}, _endpos::Int=0, _group::Bool=false) name = "" version = "" attributes = PB.BufferedVector{KeyValue}() dropped_attributes_count = zero(UInt32) - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 name = PB.decode(d, String) @@ -70,7 +86,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:InstrumentationScope}) elseif field_number == 4 dropped_attributes_count = PB.decode(d, UInt32) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return InstrumentationScope(name, version, attributes[], dropped_attributes_count) @@ -93,20 +109,51 @@ function PB._encoded_size(x::InstrumentationScope) return encoded_size end -struct KeyValueList{T1<:Union{Nothing,var"##AbstractKeyValue"}} <: var"##AbstractKeyValueList" - values::Vector{T1} +const KeyValue = var"##Stub#KeyValue"{var"##Stub#AnyValue"} +PB.default_values(::Type{KeyValue}) = (;key = "", value = nothing) +PB.field_numbers(::Type{KeyValue}) = (;key = 1, value = 2) + +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:KeyValue}, _endpos::Int=0, _group::Bool=false) + key = "" + value = Ref{Union{Nothing,AnyValue}}(nothing) + while !PB.message_done(d, _endpos, _group) + field_number, wire_type = PB.decode_tag(d) + if field_number == 1 + key = PB.decode(d, String) + elseif field_number == 2 + PB.decode!(d, value) + else + Base.skip(d, wire_type) + end + end + return KeyValue(key, value[]) end + +function PB.encode(e::PB.AbstractProtoEncoder, x::KeyValue) + initpos = position(e.io) + !isempty(x.key) && PB.encode(e, 1, x.key) + !isnothing(x.value) && PB.encode(e, 2, x.value) + return position(e.io) - initpos +end +function PB._encoded_size(x::KeyValue) + encoded_size = 0 + !isempty(x.key) && (encoded_size += PB._encoded_size(x.key, 1)) + !isnothing(x.value) && (encoded_size += PB._encoded_size(x.value, 2)) + return encoded_size +end + +const KeyValueList = var"##Stub#KeyValueList"{var"##Stub#AnyValue"} PB.default_values(::Type{KeyValueList}) = (;values = Vector{KeyValue}()) PB.field_numbers(::Type{KeyValueList}) = (;values = 1) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:KeyValueList}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:KeyValueList}, _endpos::Int=0, _group::Bool=false) values = PB.BufferedVector{KeyValue}() - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, values) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return KeyValueList(values[]) @@ -123,18 +170,16 @@ function PB._encoded_size(x::KeyValueList) return encoded_size end -struct AnyValue <: var"##AbstractAnyValue" - value::Union{Nothing,OneOf{<:Union{String,Bool,Int64,Float64,var"##AbstractArrayValue",var"##AbstractKeyValueList",Vector{UInt8}}}} -end +const AnyValue = var"##Stub#AnyValue" PB.oneof_field_types(::Type{AnyValue}) = (; value = (;string_value=String, bool_value=Bool, int_value=Int64, double_value=Float64, array_value=ArrayValue, kvlist_value=KeyValueList, bytes_value=Vector{UInt8}), ) PB.default_values(::Type{AnyValue}) = (;string_value = "", bool_value = false, int_value = zero(Int64), double_value = zero(Float64), array_value = nothing, kvlist_value = nothing, bytes_value = UInt8[]) PB.field_numbers(::Type{AnyValue}) = (;string_value = 1, bool_value = 2, int_value = 3, double_value = 4, array_value = 5, kvlist_value = 6, bytes_value = 7) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:AnyValue}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:AnyValue}, _endpos::Int=0, _group::Bool=false) value = nothing - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 value = OneOf(:string_value, PB.decode(d, String)) @@ -151,7 +196,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:AnyValue}) elseif field_number == 7 value = OneOf(:bytes_value, PB.decode(d, Vector{UInt8})) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return AnyValue(value) @@ -197,39 +242,3 @@ function PB._encoded_size(x::AnyValue) end return encoded_size end - -struct KeyValue <: var"##AbstractKeyValue" - key::String - value::Union{Nothing,AnyValue} -end -PB.default_values(::Type{KeyValue}) = (;key = "", value = nothing) -PB.field_numbers(::Type{KeyValue}) = (;key = 1, value = 2) - -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:KeyValue}) - key = "" - value = Ref{Union{Nothing,AnyValue}}(nothing) - while !PB.message_done(d) - field_number, wire_type = PB.decode_tag(d) - if field_number == 1 - key = PB.decode(d, String) - elseif field_number == 2 - PB.decode!(d, value) - else - PB.skip(d, wire_type) - end - end - return KeyValue(key, value[]) -end - -function PB.encode(e::PB.AbstractProtoEncoder, x::KeyValue) - initpos = position(e.io) - !isempty(x.key) && PB.encode(e, 1, x.key) - !isnothing(x.value) && PB.encode(e, 2, x.value) - return position(e.io) - initpos -end -function PB._encoded_size(x::KeyValue) - encoded_size = 0 - !isempty(x.key) && (encoded_size += PB._encoded_size(x.key, 1)) - !isnothing(x.value) && (encoded_size += PB._encoded_size(x.value, 2)) - return encoded_size -end diff --git a/src/proto/src/opentelemetry/proto/logs/v1/logs_pb.jl b/src/proto/src/opentelemetry/proto/logs/v1/logs_pb.jl index e5d807a2..1935d839 100644 --- a/src/proto/src/opentelemetry/proto/logs/v1/logs_pb.jl +++ b/src/proto/src/opentelemetry/proto/logs/v1/logs_pb.jl @@ -1,5 +1,5 @@ -# Autogenerated using ProtoBuf.jl v1.0.9 on 2023-03-01T12:24:55.791 -# original file: /home/tj/workspace/git/OpenTelemetry.jl/src/proto/dev/opentelemetry-proto-0.19.0/opentelemetry/proto/logs/v1/logs.proto (proto3 syntax) +# Autogenerated using ProtoBuf.jl v1.3.0 +# original file: opentelemetry/proto/logs/v1/logs.proto (proto3 syntax) import ProtoBuf as PB using ProtoBuf: OneOf @@ -7,6 +7,7 @@ using ProtoBuf.EnumX: @enumx export LogRecordFlags, SeverityNumber, LogRecord, ScopeLogs, ResourceLogs, LogsData + @enumx LogRecordFlags LOG_RECORD_FLAG_UNSPECIFIED=0 LOG_RECORD_FLAG_TRACE_FLAGS_MASK=255 @enumx SeverityNumber SEVERITY_NUMBER_UNSPECIFIED=0 SEVERITY_NUMBER_TRACE=1 SEVERITY_NUMBER_TRACE2=2 SEVERITY_NUMBER_TRACE3=3 SEVERITY_NUMBER_TRACE4=4 SEVERITY_NUMBER_DEBUG=5 SEVERITY_NUMBER_DEBUG2=6 SEVERITY_NUMBER_DEBUG3=7 SEVERITY_NUMBER_DEBUG4=8 SEVERITY_NUMBER_INFO=9 SEVERITY_NUMBER_INFO2=10 SEVERITY_NUMBER_INFO3=11 SEVERITY_NUMBER_INFO4=12 SEVERITY_NUMBER_WARN=13 SEVERITY_NUMBER_WARN2=14 SEVERITY_NUMBER_WARN3=15 SEVERITY_NUMBER_WARN4=16 SEVERITY_NUMBER_ERROR=17 SEVERITY_NUMBER_ERROR2=18 SEVERITY_NUMBER_ERROR3=19 SEVERITY_NUMBER_ERROR4=20 SEVERITY_NUMBER_FATAL=21 SEVERITY_NUMBER_FATAL2=22 SEVERITY_NUMBER_FATAL3=23 SEVERITY_NUMBER_FATAL4=24 @@ -27,7 +28,7 @@ PB.reserved_fields(::Type{LogRecord}) = (names = String[], numbers = Union{Int,U PB.default_values(::Type{LogRecord}) = (;time_unix_nano = zero(UInt64), observed_time_unix_nano = zero(UInt64), severity_number = SeverityNumber.SEVERITY_NUMBER_UNSPECIFIED, severity_text = "", body = nothing, attributes = Vector{opentelemetry.proto.common.v1.KeyValue}(), dropped_attributes_count = zero(UInt32), flags = zero(UInt32), trace_id = UInt8[], span_id = UInt8[]) PB.field_numbers(::Type{LogRecord}) = (;time_unix_nano = 1, observed_time_unix_nano = 11, severity_number = 2, severity_text = 3, body = 5, attributes = 6, dropped_attributes_count = 7, flags = 8, trace_id = 9, span_id = 10) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:LogRecord}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:LogRecord}, _endpos::Int=0, _group::Bool=false) time_unix_nano = zero(UInt64) observed_time_unix_nano = zero(UInt64) severity_number = SeverityNumber.SEVERITY_NUMBER_UNSPECIFIED @@ -38,7 +39,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:LogRecord}) flags = zero(UInt32) trace_id = UInt8[] span_id = UInt8[] - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 time_unix_nano = PB.decode(d, UInt64, Val{:fixed}) @@ -61,7 +62,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:LogRecord}) elseif field_number == 10 span_id = PB.decode(d, Vector{UInt8}) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return LogRecord(time_unix_nano, observed_time_unix_nano, severity_number, severity_text, body[], attributes[], dropped_attributes_count, flags, trace_id, span_id) @@ -104,11 +105,11 @@ end PB.default_values(::Type{ScopeLogs}) = (;scope = nothing, log_records = Vector{LogRecord}(), schema_url = "") PB.field_numbers(::Type{ScopeLogs}) = (;scope = 1, log_records = 2, schema_url = 3) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ScopeLogs}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ScopeLogs}, _endpos::Int=0, _group::Bool=false) scope = Ref{Union{Nothing,opentelemetry.proto.common.v1.InstrumentationScope}}(nothing) log_records = PB.BufferedVector{LogRecord}() schema_url = "" - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, scope) @@ -117,7 +118,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ScopeLogs}) elseif field_number == 3 schema_url = PB.decode(d, String) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ScopeLogs(scope[], log_records[], schema_url) @@ -147,11 +148,11 @@ PB.reserved_fields(::Type{ResourceLogs}) = (names = String[], numbers = Union{In PB.default_values(::Type{ResourceLogs}) = (;resource = nothing, scope_logs = Vector{ScopeLogs}(), schema_url = "") PB.field_numbers(::Type{ResourceLogs}) = (;resource = 1, scope_logs = 2, schema_url = 3) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ResourceLogs}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ResourceLogs}, _endpos::Int=0, _group::Bool=false) resource = Ref{Union{Nothing,opentelemetry.proto.resource.v1.Resource}}(nothing) scope_logs = PB.BufferedVector{ScopeLogs}() schema_url = "" - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, resource) @@ -160,7 +161,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ResourceLogs}) elseif field_number == 3 schema_url = PB.decode(d, String) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ResourceLogs(resource[], scope_logs[], schema_url) @@ -187,14 +188,14 @@ end PB.default_values(::Type{LogsData}) = (;resource_logs = Vector{ResourceLogs}()) PB.field_numbers(::Type{LogsData}) = (;resource_logs = 1) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:LogsData}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:LogsData}, _endpos::Int=0, _group::Bool=false) resource_logs = PB.BufferedVector{ResourceLogs}() - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, resource_logs) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return LogsData(resource_logs[]) diff --git a/src/proto/src/opentelemetry/proto/metrics/v1/metrics_pb.jl b/src/proto/src/opentelemetry/proto/metrics/v1/metrics_pb.jl index 83775e75..5574528d 100644 --- a/src/proto/src/opentelemetry/proto/metrics/v1/metrics_pb.jl +++ b/src/proto/src/opentelemetry/proto/metrics/v1/metrics_pb.jl @@ -1,5 +1,5 @@ -# Autogenerated using ProtoBuf.jl v1.0.9 on 2023-03-01T12:24:35.952 -# original file: /home/tj/workspace/git/OpenTelemetry.jl/src/proto/dev/opentelemetry-proto-0.19.0/opentelemetry/proto/metrics/v1/metrics.proto (proto3 syntax) +# Autogenerated using ProtoBuf.jl v1.3.0 +# original file: opentelemetry/proto/metrics/v1/metrics.proto (proto3 syntax) import ProtoBuf as PB using ProtoBuf: OneOf @@ -11,6 +11,7 @@ export NumberDataPoint, HistogramDataPoint, ExponentialHistogramDataPoint, Summa export Gauge, Sum, Histogram, ExponentialHistogram, Summary, Metric, ScopeMetrics export ResourceMetrics, MetricsData + struct Exemplar filtered_attributes::Vector{opentelemetry.proto.common.v1.KeyValue} time_unix_nano::UInt64 @@ -25,13 +26,13 @@ PB.oneof_field_types(::Type{Exemplar}) = (; PB.default_values(::Type{Exemplar}) = (;filtered_attributes = Vector{opentelemetry.proto.common.v1.KeyValue}(), time_unix_nano = zero(UInt64), as_double = zero(Float64), as_int = zero(Int64), span_id = UInt8[], trace_id = UInt8[]) PB.field_numbers(::Type{Exemplar}) = (;filtered_attributes = 7, time_unix_nano = 2, as_double = 3, as_int = 6, span_id = 4, trace_id = 5) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Exemplar}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Exemplar}, _endpos::Int=0, _group::Bool=false) filtered_attributes = PB.BufferedVector{opentelemetry.proto.common.v1.KeyValue}() time_unix_nano = zero(UInt64) value = nothing span_id = UInt8[] trace_id = UInt8[] - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 7 PB.decode!(d, filtered_attributes) @@ -46,7 +47,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Exemplar}) elseif field_number == 5 trace_id = PB.decode(d, Vector{UInt8}) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return Exemplar(filtered_attributes[], time_unix_nano, value, span_id, trace_id) @@ -92,17 +93,17 @@ end PB.default_values(::Type{var"ExponentialHistogramDataPoint.Buckets"}) = (;offset = zero(Int32), bucket_counts = Vector{UInt64}()) PB.field_numbers(::Type{var"ExponentialHistogramDataPoint.Buckets"}) = (;offset = 1, bucket_counts = 2) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:var"ExponentialHistogramDataPoint.Buckets"}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:var"ExponentialHistogramDataPoint.Buckets"}, _endpos::Int=0, _group::Bool=false) offset = zero(Int32) bucket_counts = PB.BufferedVector{UInt64}() - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 offset = PB.decode(d, Int32, Val{:zigzag}) elseif field_number == 2 PB.decode!(d, wire_type, bucket_counts) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return var"ExponentialHistogramDataPoint.Buckets"(offset, bucket_counts[]) @@ -128,17 +129,17 @@ end PB.default_values(::Type{var"SummaryDataPoint.ValueAtQuantile"}) = (;quantile = zero(Float64), value = zero(Float64)) PB.field_numbers(::Type{var"SummaryDataPoint.ValueAtQuantile"}) = (;quantile = 1, value = 2) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:var"SummaryDataPoint.ValueAtQuantile"}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:var"SummaryDataPoint.ValueAtQuantile"}, _endpos::Int=0, _group::Bool=false) quantile = zero(Float64) value = zero(Float64) - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 quantile = PB.decode(d, Float64) elseif field_number == 2 value = PB.decode(d, Float64) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return var"SummaryDataPoint.ValueAtQuantile"(quantile, value) @@ -146,14 +147,14 @@ end function PB.encode(e::PB.AbstractProtoEncoder, x::var"SummaryDataPoint.ValueAtQuantile") initpos = position(e.io) - x.quantile != zero(Float64) && PB.encode(e, 1, x.quantile) - x.value != zero(Float64) && PB.encode(e, 2, x.value) + x.quantile !== zero(Float64) && PB.encode(e, 1, x.quantile) + x.value !== zero(Float64) && PB.encode(e, 2, x.value) return position(e.io) - initpos end function PB._encoded_size(x::var"SummaryDataPoint.ValueAtQuantile") encoded_size = 0 - x.quantile != zero(Float64) && (encoded_size += PB._encoded_size(x.quantile, 1)) - x.value != zero(Float64) && (encoded_size += PB._encoded_size(x.value, 2)) + x.quantile !== zero(Float64) && (encoded_size += PB._encoded_size(x.quantile, 1)) + x.value !== zero(Float64) && (encoded_size += PB._encoded_size(x.value, 2)) return encoded_size end @@ -172,14 +173,14 @@ PB.oneof_field_types(::Type{NumberDataPoint}) = (; PB.default_values(::Type{NumberDataPoint}) = (;attributes = Vector{opentelemetry.proto.common.v1.KeyValue}(), start_time_unix_nano = zero(UInt64), time_unix_nano = zero(UInt64), as_double = zero(Float64), as_int = zero(Int64), exemplars = Vector{Exemplar}(), flags = zero(UInt32)) PB.field_numbers(::Type{NumberDataPoint}) = (;attributes = 7, start_time_unix_nano = 2, time_unix_nano = 3, as_double = 4, as_int = 6, exemplars = 5, flags = 8) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:NumberDataPoint}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:NumberDataPoint}, _endpos::Int=0, _group::Bool=false) attributes = PB.BufferedVector{opentelemetry.proto.common.v1.KeyValue}() start_time_unix_nano = zero(UInt64) time_unix_nano = zero(UInt64) value = nothing exemplars = PB.BufferedVector{Exemplar}() flags = zero(UInt32) - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 7 PB.decode!(d, attributes) @@ -196,7 +197,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:NumberDataPoint}) elseif field_number == 8 flags = PB.decode(d, UInt32) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return NumberDataPoint(attributes[], start_time_unix_nano, time_unix_nano, value, exemplars[], flags) @@ -250,7 +251,7 @@ PB.reserved_fields(::Type{HistogramDataPoint}) = (names = String[], numbers = Un PB.default_values(::Type{HistogramDataPoint}) = (;attributes = Vector{opentelemetry.proto.common.v1.KeyValue}(), start_time_unix_nano = zero(UInt64), time_unix_nano = zero(UInt64), count = zero(UInt64), sum = zero(Float64), bucket_counts = Vector{UInt64}(), explicit_bounds = Vector{Float64}(), exemplars = Vector{Exemplar}(), flags = zero(UInt32), min = zero(Float64), max = zero(Float64)) PB.field_numbers(::Type{HistogramDataPoint}) = (;attributes = 9, start_time_unix_nano = 2, time_unix_nano = 3, count = 4, sum = 5, bucket_counts = 6, explicit_bounds = 7, exemplars = 8, flags = 10, min = 11, max = 12) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:HistogramDataPoint}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:HistogramDataPoint}, _endpos::Int=0, _group::Bool=false) attributes = PB.BufferedVector{opentelemetry.proto.common.v1.KeyValue}() start_time_unix_nano = zero(UInt64) time_unix_nano = zero(UInt64) @@ -262,7 +263,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:HistogramDataPoint}) flags = zero(UInt32) min = zero(Float64) max = zero(Float64) - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 9 PB.decode!(d, attributes) @@ -287,7 +288,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:HistogramDataPoint}) elseif field_number == 12 max = PB.decode(d, Float64) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return HistogramDataPoint(attributes[], start_time_unix_nano, time_unix_nano, count, sum, bucket_counts[], explicit_bounds[], exemplars[], flags, min, max) @@ -299,13 +300,13 @@ function PB.encode(e::PB.AbstractProtoEncoder, x::HistogramDataPoint) x.start_time_unix_nano != zero(UInt64) && PB.encode(e, 2, x.start_time_unix_nano, Val{:fixed}) x.time_unix_nano != zero(UInt64) && PB.encode(e, 3, x.time_unix_nano, Val{:fixed}) x.count != zero(UInt64) && PB.encode(e, 4, x.count, Val{:fixed}) - x.sum != zero(Float64) && PB.encode(e, 5, x.sum) + x.sum !== zero(Float64) && PB.encode(e, 5, x.sum) !isempty(x.bucket_counts) && PB.encode(e, 6, x.bucket_counts, Val{:fixed}) !isempty(x.explicit_bounds) && PB.encode(e, 7, x.explicit_bounds) !isempty(x.exemplars) && PB.encode(e, 8, x.exemplars) x.flags != zero(UInt32) && PB.encode(e, 10, x.flags) - x.min != zero(Float64) && PB.encode(e, 11, x.min) - x.max != zero(Float64) && PB.encode(e, 12, x.max) + x.min !== zero(Float64) && PB.encode(e, 11, x.min) + x.max !== zero(Float64) && PB.encode(e, 12, x.max) return position(e.io) - initpos end function PB._encoded_size(x::HistogramDataPoint) @@ -314,13 +315,13 @@ function PB._encoded_size(x::HistogramDataPoint) x.start_time_unix_nano != zero(UInt64) && (encoded_size += PB._encoded_size(x.start_time_unix_nano, 2, Val{:fixed})) x.time_unix_nano != zero(UInt64) && (encoded_size += PB._encoded_size(x.time_unix_nano, 3, Val{:fixed})) x.count != zero(UInt64) && (encoded_size += PB._encoded_size(x.count, 4, Val{:fixed})) - x.sum != zero(Float64) && (encoded_size += PB._encoded_size(x.sum, 5)) + x.sum !== zero(Float64) && (encoded_size += PB._encoded_size(x.sum, 5)) !isempty(x.bucket_counts) && (encoded_size += PB._encoded_size(x.bucket_counts, 6, Val{:fixed})) !isempty(x.explicit_bounds) && (encoded_size += PB._encoded_size(x.explicit_bounds, 7)) !isempty(x.exemplars) && (encoded_size += PB._encoded_size(x.exemplars, 8)) x.flags != zero(UInt32) && (encoded_size += PB._encoded_size(x.flags, 10)) - x.min != zero(Float64) && (encoded_size += PB._encoded_size(x.min, 11)) - x.max != zero(Float64) && (encoded_size += PB._encoded_size(x.max, 12)) + x.min !== zero(Float64) && (encoded_size += PB._encoded_size(x.min, 11)) + x.max !== zero(Float64) && (encoded_size += PB._encoded_size(x.max, 12)) return encoded_size end @@ -342,7 +343,7 @@ end PB.default_values(::Type{ExponentialHistogramDataPoint}) = (;attributes = Vector{opentelemetry.proto.common.v1.KeyValue}(), start_time_unix_nano = zero(UInt64), time_unix_nano = zero(UInt64), count = zero(UInt64), sum = zero(Float64), scale = zero(Int32), zero_count = zero(UInt64), positive = nothing, negative = nothing, flags = zero(UInt32), exemplars = Vector{Exemplar}(), min = zero(Float64), max = zero(Float64)) PB.field_numbers(::Type{ExponentialHistogramDataPoint}) = (;attributes = 1, start_time_unix_nano = 2, time_unix_nano = 3, count = 4, sum = 5, scale = 6, zero_count = 7, positive = 8, negative = 9, flags = 10, exemplars = 11, min = 12, max = 13) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExponentialHistogramDataPoint}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExponentialHistogramDataPoint}, _endpos::Int=0, _group::Bool=false) attributes = PB.BufferedVector{opentelemetry.proto.common.v1.KeyValue}() start_time_unix_nano = zero(UInt64) time_unix_nano = zero(UInt64) @@ -356,7 +357,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExponentialHistogramData exemplars = PB.BufferedVector{Exemplar}() min = zero(Float64) max = zero(Float64) - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, attributes) @@ -385,7 +386,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExponentialHistogramData elseif field_number == 13 max = PB.decode(d, Float64) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ExponentialHistogramDataPoint(attributes[], start_time_unix_nano, time_unix_nano, count, sum, scale, zero_count, positive[], negative[], flags, exemplars[], min, max) @@ -397,15 +398,15 @@ function PB.encode(e::PB.AbstractProtoEncoder, x::ExponentialHistogramDataPoint) x.start_time_unix_nano != zero(UInt64) && PB.encode(e, 2, x.start_time_unix_nano, Val{:fixed}) x.time_unix_nano != zero(UInt64) && PB.encode(e, 3, x.time_unix_nano, Val{:fixed}) x.count != zero(UInt64) && PB.encode(e, 4, x.count, Val{:fixed}) - x.sum != zero(Float64) && PB.encode(e, 5, x.sum) + x.sum !== zero(Float64) && PB.encode(e, 5, x.sum) x.scale != zero(Int32) && PB.encode(e, 6, x.scale, Val{:zigzag}) x.zero_count != zero(UInt64) && PB.encode(e, 7, x.zero_count, Val{:fixed}) !isnothing(x.positive) && PB.encode(e, 8, x.positive) !isnothing(x.negative) && PB.encode(e, 9, x.negative) x.flags != zero(UInt32) && PB.encode(e, 10, x.flags) !isempty(x.exemplars) && PB.encode(e, 11, x.exemplars) - x.min != zero(Float64) && PB.encode(e, 12, x.min) - x.max != zero(Float64) && PB.encode(e, 13, x.max) + x.min !== zero(Float64) && PB.encode(e, 12, x.min) + x.max !== zero(Float64) && PB.encode(e, 13, x.max) return position(e.io) - initpos end function PB._encoded_size(x::ExponentialHistogramDataPoint) @@ -414,15 +415,15 @@ function PB._encoded_size(x::ExponentialHistogramDataPoint) x.start_time_unix_nano != zero(UInt64) && (encoded_size += PB._encoded_size(x.start_time_unix_nano, 2, Val{:fixed})) x.time_unix_nano != zero(UInt64) && (encoded_size += PB._encoded_size(x.time_unix_nano, 3, Val{:fixed})) x.count != zero(UInt64) && (encoded_size += PB._encoded_size(x.count, 4, Val{:fixed})) - x.sum != zero(Float64) && (encoded_size += PB._encoded_size(x.sum, 5)) + x.sum !== zero(Float64) && (encoded_size += PB._encoded_size(x.sum, 5)) x.scale != zero(Int32) && (encoded_size += PB._encoded_size(x.scale, 6, Val{:zigzag})) x.zero_count != zero(UInt64) && (encoded_size += PB._encoded_size(x.zero_count, 7, Val{:fixed})) !isnothing(x.positive) && (encoded_size += PB._encoded_size(x.positive, 8)) !isnothing(x.negative) && (encoded_size += PB._encoded_size(x.negative, 9)) x.flags != zero(UInt32) && (encoded_size += PB._encoded_size(x.flags, 10)) !isempty(x.exemplars) && (encoded_size += PB._encoded_size(x.exemplars, 11)) - x.min != zero(Float64) && (encoded_size += PB._encoded_size(x.min, 12)) - x.max != zero(Float64) && (encoded_size += PB._encoded_size(x.max, 13)) + x.min !== zero(Float64) && (encoded_size += PB._encoded_size(x.min, 12)) + x.max !== zero(Float64) && (encoded_size += PB._encoded_size(x.max, 13)) return encoded_size end @@ -439,7 +440,7 @@ PB.reserved_fields(::Type{SummaryDataPoint}) = (names = String[], numbers = Unio PB.default_values(::Type{SummaryDataPoint}) = (;attributes = Vector{opentelemetry.proto.common.v1.KeyValue}(), start_time_unix_nano = zero(UInt64), time_unix_nano = zero(UInt64), count = zero(UInt64), sum = zero(Float64), quantile_values = Vector{var"SummaryDataPoint.ValueAtQuantile"}(), flags = zero(UInt32)) PB.field_numbers(::Type{SummaryDataPoint}) = (;attributes = 7, start_time_unix_nano = 2, time_unix_nano = 3, count = 4, sum = 5, quantile_values = 6, flags = 8) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:SummaryDataPoint}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:SummaryDataPoint}, _endpos::Int=0, _group::Bool=false) attributes = PB.BufferedVector{opentelemetry.proto.common.v1.KeyValue}() start_time_unix_nano = zero(UInt64) time_unix_nano = zero(UInt64) @@ -447,7 +448,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:SummaryDataPoint}) sum = zero(Float64) quantile_values = PB.BufferedVector{var"SummaryDataPoint.ValueAtQuantile"}() flags = zero(UInt32) - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 7 PB.decode!(d, attributes) @@ -464,7 +465,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:SummaryDataPoint}) elseif field_number == 8 flags = PB.decode(d, UInt32) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return SummaryDataPoint(attributes[], start_time_unix_nano, time_unix_nano, count, sum, quantile_values[], flags) @@ -476,7 +477,7 @@ function PB.encode(e::PB.AbstractProtoEncoder, x::SummaryDataPoint) x.start_time_unix_nano != zero(UInt64) && PB.encode(e, 2, x.start_time_unix_nano, Val{:fixed}) x.time_unix_nano != zero(UInt64) && PB.encode(e, 3, x.time_unix_nano, Val{:fixed}) x.count != zero(UInt64) && PB.encode(e, 4, x.count, Val{:fixed}) - x.sum != zero(Float64) && PB.encode(e, 5, x.sum) + x.sum !== zero(Float64) && PB.encode(e, 5, x.sum) !isempty(x.quantile_values) && PB.encode(e, 6, x.quantile_values) x.flags != zero(UInt32) && PB.encode(e, 8, x.flags) return position(e.io) - initpos @@ -487,7 +488,7 @@ function PB._encoded_size(x::SummaryDataPoint) x.start_time_unix_nano != zero(UInt64) && (encoded_size += PB._encoded_size(x.start_time_unix_nano, 2, Val{:fixed})) x.time_unix_nano != zero(UInt64) && (encoded_size += PB._encoded_size(x.time_unix_nano, 3, Val{:fixed})) x.count != zero(UInt64) && (encoded_size += PB._encoded_size(x.count, 4, Val{:fixed})) - x.sum != zero(Float64) && (encoded_size += PB._encoded_size(x.sum, 5)) + x.sum !== zero(Float64) && (encoded_size += PB._encoded_size(x.sum, 5)) !isempty(x.quantile_values) && (encoded_size += PB._encoded_size(x.quantile_values, 6)) x.flags != zero(UInt32) && (encoded_size += PB._encoded_size(x.flags, 8)) return encoded_size @@ -499,14 +500,14 @@ end PB.default_values(::Type{Gauge}) = (;data_points = Vector{NumberDataPoint}()) PB.field_numbers(::Type{Gauge}) = (;data_points = 1) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Gauge}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Gauge}, _endpos::Int=0, _group::Bool=false) data_points = PB.BufferedVector{NumberDataPoint}() - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, data_points) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return Gauge(data_points[]) @@ -531,11 +532,11 @@ end PB.default_values(::Type{Sum}) = (;data_points = Vector{NumberDataPoint}(), aggregation_temporality = AggregationTemporality.AGGREGATION_TEMPORALITY_UNSPECIFIED, is_monotonic = false) PB.field_numbers(::Type{Sum}) = (;data_points = 1, aggregation_temporality = 2, is_monotonic = 3) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Sum}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Sum}, _endpos::Int=0, _group::Bool=false) data_points = PB.BufferedVector{NumberDataPoint}() aggregation_temporality = AggregationTemporality.AGGREGATION_TEMPORALITY_UNSPECIFIED is_monotonic = false - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, data_points) @@ -544,7 +545,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Sum}) elseif field_number == 3 is_monotonic = PB.decode(d, Bool) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return Sum(data_points[], aggregation_temporality, is_monotonic) @@ -572,17 +573,17 @@ end PB.default_values(::Type{Histogram}) = (;data_points = Vector{HistogramDataPoint}(), aggregation_temporality = AggregationTemporality.AGGREGATION_TEMPORALITY_UNSPECIFIED) PB.field_numbers(::Type{Histogram}) = (;data_points = 1, aggregation_temporality = 2) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Histogram}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Histogram}, _endpos::Int=0, _group::Bool=false) data_points = PB.BufferedVector{HistogramDataPoint}() aggregation_temporality = AggregationTemporality.AGGREGATION_TEMPORALITY_UNSPECIFIED - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, data_points) elseif field_number == 2 aggregation_temporality = PB.decode(d, AggregationTemporality.T) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return Histogram(data_points[], aggregation_temporality) @@ -608,17 +609,17 @@ end PB.default_values(::Type{ExponentialHistogram}) = (;data_points = Vector{ExponentialHistogramDataPoint}(), aggregation_temporality = AggregationTemporality.AGGREGATION_TEMPORALITY_UNSPECIFIED) PB.field_numbers(::Type{ExponentialHistogram}) = (;data_points = 1, aggregation_temporality = 2) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExponentialHistogram}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ExponentialHistogram}, _endpos::Int=0, _group::Bool=false) data_points = PB.BufferedVector{ExponentialHistogramDataPoint}() aggregation_temporality = AggregationTemporality.AGGREGATION_TEMPORALITY_UNSPECIFIED - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, data_points) elseif field_number == 2 aggregation_temporality = PB.decode(d, AggregationTemporality.T) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ExponentialHistogram(data_points[], aggregation_temporality) @@ -643,14 +644,14 @@ end PB.default_values(::Type{Summary}) = (;data_points = Vector{SummaryDataPoint}()) PB.field_numbers(::Type{Summary}) = (;data_points = 1) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Summary}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Summary}, _endpos::Int=0, _group::Bool=false) data_points = PB.BufferedVector{SummaryDataPoint}() - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, data_points) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return Summary(data_points[]) @@ -680,12 +681,12 @@ PB.oneof_field_types(::Type{Metric}) = (; PB.default_values(::Type{Metric}) = (;name = "", description = "", unit = "", gauge = nothing, sum = nothing, histogram = nothing, exponential_histogram = nothing, summary = nothing) PB.field_numbers(::Type{Metric}) = (;name = 1, description = 2, unit = 3, gauge = 5, sum = 7, histogram = 9, exponential_histogram = 10, summary = 11) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Metric}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Metric}, _endpos::Int=0, _group::Bool=false) name = "" description = "" unit = "" data = nothing - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 name = PB.decode(d, String) @@ -704,7 +705,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Metric}) elseif field_number == 11 data = OneOf(:summary, PB.decode(d, Ref{Summary})) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return Metric(name, description, unit, data) @@ -757,11 +758,11 @@ end PB.default_values(::Type{ScopeMetrics}) = (;scope = nothing, metrics = Vector{Metric}(), schema_url = "") PB.field_numbers(::Type{ScopeMetrics}) = (;scope = 1, metrics = 2, schema_url = 3) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ScopeMetrics}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ScopeMetrics}, _endpos::Int=0, _group::Bool=false) scope = Ref{Union{Nothing,opentelemetry.proto.common.v1.InstrumentationScope}}(nothing) metrics = PB.BufferedVector{Metric}() schema_url = "" - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, scope) @@ -770,7 +771,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ScopeMetrics}) elseif field_number == 3 schema_url = PB.decode(d, String) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ScopeMetrics(scope[], metrics[], schema_url) @@ -800,11 +801,11 @@ PB.reserved_fields(::Type{ResourceMetrics}) = (names = String[], numbers = Union PB.default_values(::Type{ResourceMetrics}) = (;resource = nothing, scope_metrics = Vector{ScopeMetrics}(), schema_url = "") PB.field_numbers(::Type{ResourceMetrics}) = (;resource = 1, scope_metrics = 2, schema_url = 3) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ResourceMetrics}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ResourceMetrics}, _endpos::Int=0, _group::Bool=false) resource = Ref{Union{Nothing,opentelemetry.proto.resource.v1.Resource}}(nothing) scope_metrics = PB.BufferedVector{ScopeMetrics}() schema_url = "" - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, resource) @@ -813,7 +814,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ResourceMetrics}) elseif field_number == 3 schema_url = PB.decode(d, String) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ResourceMetrics(resource[], scope_metrics[], schema_url) @@ -840,14 +841,14 @@ end PB.default_values(::Type{MetricsData}) = (;resource_metrics = Vector{ResourceMetrics}()) PB.field_numbers(::Type{MetricsData}) = (;resource_metrics = 1) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:MetricsData}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:MetricsData}, _endpos::Int=0, _group::Bool=false) resource_metrics = PB.BufferedVector{ResourceMetrics}() - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, resource_metrics) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return MetricsData(resource_metrics[]) diff --git a/src/proto/src/opentelemetry/proto/resource/v1/resource_pb.jl b/src/proto/src/opentelemetry/proto/resource/v1/resource_pb.jl index 52104b44..1afdd5fe 100644 --- a/src/proto/src/opentelemetry/proto/resource/v1/resource_pb.jl +++ b/src/proto/src/opentelemetry/proto/resource/v1/resource_pb.jl @@ -1,5 +1,5 @@ -# Autogenerated using ProtoBuf.jl v1.0.9 on 2023-03-01T12:24:55.791 -# original file: /home/tj/workspace/git/OpenTelemetry.jl/src/proto/dev/opentelemetry-proto-0.19.0/opentelemetry/proto/resource/v1/resource.proto (proto3 syntax) +# Autogenerated using ProtoBuf.jl v1.3.0 +# original file: opentelemetry/proto/resource/v1/resource.proto (proto3 syntax) import ProtoBuf as PB using ProtoBuf: OneOf @@ -7,6 +7,7 @@ using ProtoBuf.EnumX: @enumx export Resource + struct Resource attributes::Vector{opentelemetry.proto.common.v1.KeyValue} dropped_attributes_count::UInt32 @@ -14,17 +15,17 @@ end PB.default_values(::Type{Resource}) = (;attributes = Vector{opentelemetry.proto.common.v1.KeyValue}(), dropped_attributes_count = zero(UInt32)) PB.field_numbers(::Type{Resource}) = (;attributes = 1, dropped_attributes_count = 2) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Resource}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Resource}, _endpos::Int=0, _group::Bool=false) attributes = PB.BufferedVector{opentelemetry.proto.common.v1.KeyValue}() dropped_attributes_count = zero(UInt32) - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, attributes) elseif field_number == 2 dropped_attributes_count = PB.decode(d, UInt32) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return Resource(attributes[], dropped_attributes_count) diff --git a/src/proto/src/opentelemetry/proto/trace/v1/trace_pb.jl b/src/proto/src/opentelemetry/proto/trace/v1/trace_pb.jl index 15a304f5..1dea66b2 100644 --- a/src/proto/src/opentelemetry/proto/trace/v1/trace_pb.jl +++ b/src/proto/src/opentelemetry/proto/trace/v1/trace_pb.jl @@ -1,5 +1,5 @@ -# Autogenerated using ProtoBuf.jl v1.0.9 on 2023-03-01T12:14:45.168 -# original file: /home/tj/workspace/git/OpenTelemetry.jl/src/proto/dev/opentelemetry-proto-0.19.0/opentelemetry/proto/trace/v1/trace.proto (proto3 syntax) +# Autogenerated using ProtoBuf.jl v1.3.0 +# original file: opentelemetry/proto/trace/v1/trace.proto (proto3 syntax) import ProtoBuf as PB using ProtoBuf: OneOf @@ -8,6 +8,7 @@ using ProtoBuf.EnumX: @enumx export var"Span.SpanKind", var"Span.Event", var"Status.StatusCode", var"Span.Link", Status export Span, ScopeSpans, ResourceSpans, TracesData + @enumx var"Span.SpanKind" SPAN_KIND_UNSPECIFIED=0 SPAN_KIND_INTERNAL=1 SPAN_KIND_SERVER=2 SPAN_KIND_CLIENT=3 SPAN_KIND_PRODUCER=4 SPAN_KIND_CONSUMER=5 struct var"Span.Event" @@ -19,12 +20,12 @@ end PB.default_values(::Type{var"Span.Event"}) = (;time_unix_nano = zero(UInt64), name = "", attributes = Vector{opentelemetry.proto.common.v1.KeyValue}(), dropped_attributes_count = zero(UInt32)) PB.field_numbers(::Type{var"Span.Event"}) = (;time_unix_nano = 1, name = 2, attributes = 3, dropped_attributes_count = 4) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:var"Span.Event"}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:var"Span.Event"}, _endpos::Int=0, _group::Bool=false) time_unix_nano = zero(UInt64) name = "" attributes = PB.BufferedVector{opentelemetry.proto.common.v1.KeyValue}() dropped_attributes_count = zero(UInt32) - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 time_unix_nano = PB.decode(d, UInt64, Val{:fixed}) @@ -35,7 +36,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:var"Span.Event"}) elseif field_number == 4 dropped_attributes_count = PB.decode(d, UInt32) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return var"Span.Event"(time_unix_nano, name, attributes[], dropped_attributes_count) @@ -70,13 +71,13 @@ end PB.default_values(::Type{var"Span.Link"}) = (;trace_id = UInt8[], span_id = UInt8[], trace_state = "", attributes = Vector{opentelemetry.proto.common.v1.KeyValue}(), dropped_attributes_count = zero(UInt32)) PB.field_numbers(::Type{var"Span.Link"}) = (;trace_id = 1, span_id = 2, trace_state = 3, attributes = 4, dropped_attributes_count = 5) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:var"Span.Link"}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:var"Span.Link"}, _endpos::Int=0, _group::Bool=false) trace_id = UInt8[] span_id = UInt8[] trace_state = "" attributes = PB.BufferedVector{opentelemetry.proto.common.v1.KeyValue}() dropped_attributes_count = zero(UInt32) - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 trace_id = PB.decode(d, Vector{UInt8}) @@ -89,7 +90,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:var"Span.Link"}) elseif field_number == 5 dropped_attributes_count = PB.decode(d, UInt32) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return var"Span.Link"(trace_id, span_id, trace_state, attributes[], dropped_attributes_count) @@ -122,17 +123,17 @@ PB.reserved_fields(::Type{Status}) = (names = String[], numbers = Union{Int,Unit PB.default_values(::Type{Status}) = (;message = "", code = var"Status.StatusCode".STATUS_CODE_UNSET) PB.field_numbers(::Type{Status}) = (;message = 2, code = 3) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Status}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Status}, _endpos::Int=0, _group::Bool=false) message = "" code = var"Status.StatusCode".STATUS_CODE_UNSET - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 2 message = PB.decode(d, String) elseif field_number == 3 code = PB.decode(d, var"Status.StatusCode".T) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return Status(message, code) @@ -171,7 +172,7 @@ end PB.default_values(::Type{Span}) = (;trace_id = UInt8[], span_id = UInt8[], trace_state = "", parent_span_id = UInt8[], name = "", kind = var"Span.SpanKind".SPAN_KIND_UNSPECIFIED, start_time_unix_nano = zero(UInt64), end_time_unix_nano = zero(UInt64), attributes = Vector{opentelemetry.proto.common.v1.KeyValue}(), dropped_attributes_count = zero(UInt32), events = Vector{var"Span.Event"}(), dropped_events_count = zero(UInt32), links = Vector{var"Span.Link"}(), dropped_links_count = zero(UInt32), status = nothing) PB.field_numbers(::Type{Span}) = (;trace_id = 1, span_id = 2, trace_state = 3, parent_span_id = 4, name = 5, kind = 6, start_time_unix_nano = 7, end_time_unix_nano = 8, attributes = 9, dropped_attributes_count = 10, events = 11, dropped_events_count = 12, links = 13, dropped_links_count = 14, status = 15) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Span}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Span}, _endpos::Int=0, _group::Bool=false) trace_id = UInt8[] span_id = UInt8[] trace_state = "" @@ -187,7 +188,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Span}) links = PB.BufferedVector{var"Span.Link"}() dropped_links_count = zero(UInt32) status = Ref{Union{Nothing,Status}}(nothing) - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 trace_id = PB.decode(d, Vector{UInt8}) @@ -220,10 +221,10 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:Span}) elseif field_number == 15 PB.decode!(d, status) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end - return Span(trace_id, span_id, trace_state, parent_span_id, name, kind, start_time_unix_nano, end_time_unix_nano, attributes[], dropped_attributes_count, events[], dropped_events_count, links[], dropped_links_count, status) + return Span(trace_id, span_id, trace_state, parent_span_id, name, kind, start_time_unix_nano, end_time_unix_nano, attributes[], dropped_attributes_count, events[], dropped_events_count, links[], dropped_links_count, status[]) end function PB.encode(e::PB.AbstractProtoEncoder, x::Span) @@ -273,11 +274,11 @@ end PB.default_values(::Type{ScopeSpans}) = (;scope = nothing, spans = Vector{Span}(), schema_url = "") PB.field_numbers(::Type{ScopeSpans}) = (;scope = 1, spans = 2, schema_url = 3) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ScopeSpans}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ScopeSpans}, _endpos::Int=0, _group::Bool=false) scope = Ref{Union{Nothing,opentelemetry.proto.common.v1.InstrumentationScope}}(nothing) spans = PB.BufferedVector{Span}() schema_url = "" - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, scope) @@ -286,7 +287,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ScopeSpans}) elseif field_number == 3 schema_url = PB.decode(d, String) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ScopeSpans(scope[], spans[], schema_url) @@ -316,11 +317,11 @@ PB.reserved_fields(::Type{ResourceSpans}) = (names = String[], numbers = Union{I PB.default_values(::Type{ResourceSpans}) = (;resource = nothing, scope_spans = Vector{ScopeSpans}(), schema_url = "") PB.field_numbers(::Type{ResourceSpans}) = (;resource = 1, scope_spans = 2, schema_url = 3) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ResourceSpans}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ResourceSpans}, _endpos::Int=0, _group::Bool=false) resource = Ref{Union{Nothing,opentelemetry.proto.resource.v1.Resource}}(nothing) scope_spans = PB.BufferedVector{ScopeSpans}() schema_url = "" - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, resource) @@ -329,7 +330,7 @@ function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:ResourceSpans}) elseif field_number == 3 schema_url = PB.decode(d, String) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return ResourceSpans(resource[], scope_spans[], schema_url) @@ -356,14 +357,14 @@ end PB.default_values(::Type{TracesData}) = (;resource_spans = Vector{ResourceSpans}()) PB.field_numbers(::Type{TracesData}) = (;resource_spans = 1) -function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:TracesData}) +function PB.decode(d::PB.AbstractProtoDecoder, ::Type{<:TracesData}, _endpos::Int=0, _group::Bool=false) resource_spans = PB.BufferedVector{ResourceSpans}() - while !PB.message_done(d) + while !PB.message_done(d, _endpos, _group) field_number, wire_type = PB.decode_tag(d) if field_number == 1 PB.decode!(d, resource_spans) else - PB.skip(d, wire_type) + Base.skip(d, wire_type) end end return TracesData(resource_spans[]) diff --git a/src/proto/test/runtests.jl b/src/proto/test/runtests.jl index 5e272585..78cd4222 100644 --- a/src/proto/test/runtests.jl +++ b/src/proto/test/runtests.jl @@ -1,4 +1,257 @@ using OpenTelemetryProto +using ProtoBuf using Test -@testset "OpenTelemetryProto.jl" begin end +const C = OpenTelemetryProto.opentelemetry.proto.common.v1 +const R = OpenTelemetryProto.opentelemetry.proto.resource.v1 +const T = OpenTelemetryProto.opentelemetry.proto.trace.v1 +const COLL_T = OpenTelemetryProto.opentelemetry.proto.collector.trace.v1 +const L = OpenTelemetryProto.opentelemetry.proto.logs.v1 +const COLL_L = OpenTelemetryProto.opentelemetry.proto.collector.logs.v1 +const M = OpenTelemetryProto.opentelemetry.proto.metrics.v1 +const COLL_M = OpenTelemetryProto.opentelemetry.proto.collector.metrics.v1 + +roundtrip(x::T) where {T} = begin + io = IOBuffer() + ProtoBuf.encode(ProtoEncoder(io), x) + seekstart(io) + ProtoBuf.decode(ProtoDecoder(io), T) +end + +@testset "OpenTelemetryProto.jl" begin + @testset "KeyValue scalar roundtrip" begin + for (sym, val) in ( + (:string_value, "hello"), + (:bool_value, true), + (:int_value, Int64(-7)), + (:double_value, 3.14), + (:bytes_value, UInt8[0x01, 0x02, 0x03]), + ) + kv = C.KeyValue("k", C.AnyValue(OneOf(sym, val))) + kv2 = roundtrip(kv) + @test kv2.key == "k" + @test kv2.value.value.name === sym + @test kv2.value.value[] == val + end + end + + @testset "Nested ArrayValue and KeyValueList" begin + arr = C.AnyValue(OneOf(:array_value, C.ArrayValue([ + C.AnyValue(OneOf(:string_value, "a")), + C.AnyValue(OneOf(:int_value, Int64(1))), + ]))) + kv = C.KeyValue("arr", arr) + kv2 = roundtrip(kv) + @test kv2.value.value.name === :array_value + @test length(kv2.value.value[].values) == 2 + @test kv2.value.value[].values[1].value[] == "a" + @test kv2.value.value[].values[2].value[] == Int64(1) + + kvl = C.AnyValue(OneOf(:kvlist_value, C.KeyValueList([ + C.KeyValue("k1", C.AnyValue(OneOf(:string_value, "v1"))), + C.KeyValue("k2", C.AnyValue(OneOf(:int_value, Int64(2)))), + ]))) + kv3 = roundtrip(C.KeyValue("kvl", kvl)) + @test kv3.value.value.name === :kvlist_value + @test kv3.value.value[].values[1].key == "k1" + @test kv3.value.value[].values[2].value.value[] == Int64(2) + end + + @testset "ExportTraceServiceRequest deeply nested" begin + attrs = [ + C.KeyValue("service.name", C.AnyValue(OneOf(:string_value, "demo"))), + C.KeyValue("count", C.AnyValue(OneOf(:int_value, Int64(42)))), + ] + res = R.Resource(attrs, UInt32(0)) + ins = C.InstrumentationScope("mylib", "1.0", C.KeyValue[], UInt32(0)) + sp = T.Span( + UInt8[i for i in 1:16], + UInt8[i for i in 1:8], + "", + UInt8[], + "my-span", + T.var"Span.SpanKind".SPAN_KIND_INTERNAL, + UInt64(1), + UInt64(2), + attrs, + UInt32(0), + T.var"Span.Event"[], + UInt32(0), + T.var"Span.Link"[], + UInt32(0), + T.Status("ok", T.var"Status.StatusCode".STATUS_CODE_OK), + ) + rs = T.ResourceSpans(res, [T.ScopeSpans(ins, [sp], "")], "") + req = COLL_T.ExportTraceServiceRequest([rs]) + req2 = roundtrip(req) + + @test length(req2.resource_spans) == 1 + rs2 = req2.resource_spans[1] + @test rs2.resource.attributes[1].key == "service.name" + @test rs2.resource.attributes[1].value.value[] == "demo" + @test rs2.resource.attributes[2].value.value[] == Int64(42) + @test length(rs2.scope_spans) == 1 + ss = rs2.scope_spans[1] + @test ss.scope.name == "mylib" + @test ss.scope.version == "1.0" + @test length(ss.spans) == 1 + s = ss.spans[1] + @test s.name == "my-span" + @test s.kind == T.var"Span.SpanKind".SPAN_KIND_INTERNAL + @test s.start_time_unix_nano == 1 + @test s.end_time_unix_nano == 2 + @test s.status.code == T.var"Status.StatusCode".STATUS_CODE_OK + @test s.status.message == "ok" + end + + @testset "ExportLogsServiceRequest with body" begin + attrs = [C.KeyValue("a", C.AnyValue(OneOf(:string_value, "b")))] + res = R.Resource(attrs, UInt32(0)) + ins = C.InstrumentationScope("logger", "0.1", C.KeyValue[], UInt32(0)) + lr = L.LogRecord( + UInt64(100), + UInt64(101), + L.SeverityNumber.SEVERITY_NUMBER_INFO, + "INFO", + C.AnyValue(OneOf(:string_value, "hello log")), + attrs, + UInt32(0), + UInt32(1), + UInt8[i for i in 1:16], + UInt8[i for i in 1:8], + ) + rl = L.ResourceLogs(res, [L.ScopeLogs(ins, [lr], "")], "") + req = COLL_L.ExportLogsServiceRequest([rl]) + req2 = roundtrip(req) + + rl2 = req2.resource_logs[1] + @test rl2.resource.attributes[1].key == "a" + lr2 = rl2.scope_logs[1].log_records[1] + @test lr2.body.value[] == "hello log" + @test lr2.severity_number == L.SeverityNumber.SEVERITY_NUMBER_INFO + @test lr2.severity_text == "INFO" + end + + @testset "ExportMetricsServiceRequest sum + histogram" begin + attrs = [C.KeyValue("env", C.AnyValue(OneOf(:string_value, "prod")))] + res = R.Resource(attrs, UInt32(0)) + ins = C.InstrumentationScope("meter", "2.0", C.KeyValue[], UInt32(0)) + + sum_dp = M.NumberDataPoint( + [C.KeyValue("k", C.AnyValue(OneOf(:string_value, "v")))], + UInt64(10), + UInt64(20), + OneOf(:as_int, Int64(123)), + M.Exemplar[], + UInt32(M.DataPointFlags.FLAG_NONE), + ) + sum_metric = M.Metric( + "requests", + "request count", + "1", + OneOf(:sum, M.Sum( + [sum_dp], + M.AggregationTemporality.AGGREGATION_TEMPORALITY_CUMULATIVE, + true, + )), + ) + + hist_dp = M.HistogramDataPoint( + C.KeyValue[], + UInt64(30), + UInt64(40), + UInt64(5), + 12.5, + UInt64[1, 2, 2], + Float64[1.0, 5.0], + M.Exemplar[], + UInt32(M.DataPointFlags.FLAG_NONE), + 0.5, + 7.5, + ) + hist_metric = M.Metric( + "latency", + "request latency", + "ms", + OneOf(:histogram, M.Histogram( + [hist_dp], + M.AggregationTemporality.AGGREGATION_TEMPORALITY_CUMULATIVE, + )), + ) + + gauge_dp = M.NumberDataPoint( + C.KeyValue[], + UInt64(50), + UInt64(60), + OneOf(:as_double, 3.5), + M.Exemplar[], + UInt32(M.DataPointFlags.FLAG_NONE), + ) + gauge_metric = M.Metric( + "temperature", + "current temperature", + "C", + OneOf(:gauge, M.Gauge([gauge_dp])), + ) + + sm = M.ScopeMetrics(ins, [sum_metric, hist_metric, gauge_metric], "") + rm = M.ResourceMetrics(res, [sm], "") + req = COLL_M.ExportMetricsServiceRequest([rm]) + req2 = roundtrip(req) + + @test length(req2.resource_metrics) == 1 + rm2 = req2.resource_metrics[1] + @test rm2.resource.attributes[1].key == "env" + @test rm2.resource.attributes[1].value.value[] == "prod" + sm2 = rm2.scope_metrics[1] + @test sm2.scope.name == "meter" + @test length(sm2.metrics) == 3 + + sum_m = sm2.metrics[1] + @test sum_m.name == "requests" + @test sum_m.data.name === :sum + sum_data = sum_m.data[] + @test sum_data.is_monotonic == true + @test sum_data.aggregation_temporality == + M.AggregationTemporality.AGGREGATION_TEMPORALITY_CUMULATIVE + @test sum_data.data_points[1].value.name === :as_int + @test sum_data.data_points[1].value[] == Int64(123) + @test sum_data.data_points[1].time_unix_nano == 20 + @test sum_data.data_points[1].attributes[1].key == "k" + + hist_m = sm2.metrics[2] + @test hist_m.name == "latency" + @test hist_m.data.name === :histogram + hd = hist_m.data[].data_points[1] + @test hd.count == 5 + @test hd.sum == 12.5 + @test hd.bucket_counts == UInt64[1, 2, 2] + @test hd.explicit_bounds == Float64[1.0, 5.0] + @test hd.min == 0.5 + @test hd.max == 7.5 + + gauge_m = sm2.metrics[3] + @test gauge_m.data.name === :gauge + @test gauge_m.data[].data_points[1].value.name === :as_double + @test gauge_m.data[].data_points[1].value[] == 3.5 + end + + @testset "Unknown fields are skipped" begin + # Encode a KeyValue, then prepend a stray unknown tag (field 99, varint) + # to verify decoders properly invoke `skip` for unknown wire data. + kv = C.KeyValue("k", C.AnyValue(OneOf(:string_value, "v"))) + io = IOBuffer() + ProtoBuf.encode(ProtoEncoder(io), kv) + body = take!(io) + + io2 = IOBuffer() + # tag for field 99, varint wire type (0): (99 << 3) | 0 = 792 → varint bytes + write(io2, UInt8(0x98), UInt8(0x31)) # 792 as varint + write(io2, UInt8(0x00)) # varint value 0 + write(io2, body) + seekstart(io2) + kv2 = ProtoBuf.decode(ProtoDecoder(io2), C.KeyValue) + @test kv2.key == "k" + @test kv2.value.value[] == "v" + end +end