From e7a48fce82547a2f68105a8da98d9e56ce8de654 Mon Sep 17 00:00:00 2001 From: hendriknielaender Date: Thu, 25 Sep 2025 22:41:31 +0200 Subject: [PATCH 1/3] build: upgrade to zig 0.15.1 --- build.zig.zon | 7 +- .../proto/collector/logs/v1.pb.zig | 181 ++- .../proto/collector/metrics/v1.pb.zig | 181 ++- .../proto/collector/trace/v1.pb.zig | 181 ++- src/opentelemetry/proto/common/v1.pb.zig | 402 +++++- src/opentelemetry/proto/logs/v1.pb.zig | 280 ++++- src/opentelemetry/proto/metrics/v1.pb.zig | 1106 +++++++++++++++-- src/opentelemetry/proto/resource/v1.pb.zig | 69 +- src/opentelemetry/proto/trace/v1.pb.zig | 499 +++++++- 9 files changed, 2576 insertions(+), 330 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 0189d3e..0eae915 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -7,15 +7,14 @@ .fingerprint = 0x83b04c56bb34864b, // Changing this has security and trust implications. - .minimum_zig_version = "0.14.1", + .minimum_zig_version = "0.15.1", .dependencies = .{ .protobuf = .{ - .url = "https://github.com/Arwalk/zig-protobuf/archive/da4d17264fcfdd793e71b3a8b466fb0f05bc6fd3.tar.gz", - .hash = "protobuf-2.0.0-0e82asubGwBS6OnkIzYh6-uiIV35Lbt4OHvmGTvcJNo_", + .url = "git+https://github.com/Arwalk/zig-protobuf?ref=v3.0.0#b2b5e70d7669b45cdbb42ed8ebab512e982ee5d5", + .hash = "protobuf-2.0.0-0e82an3rJACrCrLX7sohjL3qQIcDUV_x7NgEo1AORXUD", }, }, - // Paths must include the generated code. .paths = .{ "build.zig", "build.zig.zon", diff --git a/src/opentelemetry/proto/collector/logs/v1.pb.zig b/src/opentelemetry/proto/collector/logs/v1.pb.zig index a367004..5c21627 100644 --- a/src/opentelemetry/proto/collector/logs/v1.pb.zig +++ b/src/opentelemetry/proto/collector/logs/v1.pb.zig @@ -1,44 +1,199 @@ // Code generated by protoc-gen-zig ///! package opentelemetry.proto.collector.logs.v1 const std = @import("std"); -const Allocator = std.mem.Allocator; -const ArrayList = std.ArrayList; const protobuf = @import("protobuf"); -const ManagedString = protobuf.ManagedString; const fd = protobuf.fd; -const ManagedStruct = protobuf.ManagedStruct; /// import package opentelemetry.proto.logs.v1 const opentelemetry_proto_logs_v1 = @import("../../logs/v1.pb.zig"); pub const ExportLogsServiceRequest = struct { - resource_logs: ArrayList(opentelemetry_proto_logs_v1.ResourceLogs), + resource_logs: std.ArrayListUnmanaged(opentelemetry_proto_logs_v1.ResourceLogs) = .empty, pub const _desc_table = .{ - .resource_logs = fd(1, .{ .List = .{ .SubMessage = {} } }), + .resource_logs = fd(1, .{ .repeated = .submessage }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ExportLogsServiceResponse = struct { partial_success: ?ExportLogsPartialSuccess = null, pub const _desc_table = .{ - .partial_success = fd(1, .{ .SubMessage = {} }), + .partial_success = fd(1, .submessage), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ExportLogsPartialSuccess = struct { rejected_log_records: i64 = 0, - error_message: ManagedString = .Empty, + error_message: []const u8 = &.{}, pub const _desc_table = .{ - .rejected_log_records = fd(1, .{ .Varint = .Simple }), - .error_message = fd(2, .String), + .rejected_log_records = fd(1, .{ .scalar = .int64 }), + .error_message = fd(2, .{ .scalar = .string }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; diff --git a/src/opentelemetry/proto/collector/metrics/v1.pb.zig b/src/opentelemetry/proto/collector/metrics/v1.pb.zig index 8c97c56..aab18e1 100644 --- a/src/opentelemetry/proto/collector/metrics/v1.pb.zig +++ b/src/opentelemetry/proto/collector/metrics/v1.pb.zig @@ -1,44 +1,199 @@ // Code generated by protoc-gen-zig ///! package opentelemetry.proto.collector.metrics.v1 const std = @import("std"); -const Allocator = std.mem.Allocator; -const ArrayList = std.ArrayList; const protobuf = @import("protobuf"); -const ManagedString = protobuf.ManagedString; const fd = protobuf.fd; -const ManagedStruct = protobuf.ManagedStruct; /// import package opentelemetry.proto.metrics.v1 const opentelemetry_proto_metrics_v1 = @import("../../metrics/v1.pb.zig"); pub const ExportMetricsServiceRequest = struct { - resource_metrics: ArrayList(opentelemetry_proto_metrics_v1.ResourceMetrics), + resource_metrics: std.ArrayListUnmanaged(opentelemetry_proto_metrics_v1.ResourceMetrics) = .empty, pub const _desc_table = .{ - .resource_metrics = fd(1, .{ .List = .{ .SubMessage = {} } }), + .resource_metrics = fd(1, .{ .repeated = .submessage }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ExportMetricsServiceResponse = struct { partial_success: ?ExportMetricsPartialSuccess = null, pub const _desc_table = .{ - .partial_success = fd(1, .{ .SubMessage = {} }), + .partial_success = fd(1, .submessage), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ExportMetricsPartialSuccess = struct { rejected_data_points: i64 = 0, - error_message: ManagedString = .Empty, + error_message: []const u8 = &.{}, pub const _desc_table = .{ - .rejected_data_points = fd(1, .{ .Varint = .Simple }), - .error_message = fd(2, .String), + .rejected_data_points = fd(1, .{ .scalar = .int64 }), + .error_message = fd(2, .{ .scalar = .string }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; diff --git a/src/opentelemetry/proto/collector/trace/v1.pb.zig b/src/opentelemetry/proto/collector/trace/v1.pb.zig index 4442508..661111c 100644 --- a/src/opentelemetry/proto/collector/trace/v1.pb.zig +++ b/src/opentelemetry/proto/collector/trace/v1.pb.zig @@ -1,44 +1,199 @@ // Code generated by protoc-gen-zig ///! package opentelemetry.proto.collector.trace.v1 const std = @import("std"); -const Allocator = std.mem.Allocator; -const ArrayList = std.ArrayList; const protobuf = @import("protobuf"); -const ManagedString = protobuf.ManagedString; const fd = protobuf.fd; -const ManagedStruct = protobuf.ManagedStruct; /// import package opentelemetry.proto.trace.v1 const opentelemetry_proto_trace_v1 = @import("../../trace/v1.pb.zig"); pub const ExportTraceServiceRequest = struct { - resource_spans: ArrayList(opentelemetry_proto_trace_v1.ResourceSpans), + resource_spans: std.ArrayListUnmanaged(opentelemetry_proto_trace_v1.ResourceSpans) = .empty, pub const _desc_table = .{ - .resource_spans = fd(1, .{ .List = .{ .SubMessage = {} } }), + .resource_spans = fd(1, .{ .repeated = .submessage }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ExportTraceServiceResponse = struct { partial_success: ?ExportTracePartialSuccess = null, pub const _desc_table = .{ - .partial_success = fd(1, .{ .SubMessage = {} }), + .partial_success = fd(1, .submessage), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ExportTracePartialSuccess = struct { rejected_spans: i64 = 0, - error_message: ManagedString = .Empty, + error_message: []const u8 = &.{}, pub const _desc_table = .{ - .rejected_spans = fd(1, .{ .Varint = .Simple }), - .error_message = fd(2, .String), + .rejected_spans = fd(1, .{ .scalar = .int64 }), + .error_message = fd(2, .{ .scalar = .string }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; diff --git a/src/opentelemetry/proto/common/v1.pb.zig b/src/opentelemetry/proto/common/v1.pb.zig index 946dc61..a198918 100644 --- a/src/opentelemetry/proto/common/v1.pb.zig +++ b/src/opentelemetry/proto/common/v1.pb.zig @@ -1,16 +1,12 @@ // Code generated by protoc-gen-zig ///! package opentelemetry.proto.common.v1 const std = @import("std"); -const Allocator = std.mem.Allocator; -const ArrayList = std.ArrayList; const protobuf = @import("protobuf"); -const ManagedString = protobuf.ManagedString; const fd = protobuf.fd; -const ManagedStruct = protobuf.ManagedStruct; pub const AnyValue = struct { - value: ?value_union, + value: ?value_union = null, pub const _value_case = enum { string_value, @@ -22,91 +18,409 @@ pub const AnyValue = struct { bytes_value, }; pub const value_union = union(_value_case) { - string_value: ManagedString, + string_value: []const u8, bool_value: bool, int_value: i64, double_value: f64, array_value: ArrayValue, kvlist_value: KeyValueList, - bytes_value: ManagedString, - pub const _union_desc = .{ - .string_value = fd(1, .String), - .bool_value = fd(2, .{ .Varint = .Simple }), - .int_value = fd(3, .{ .Varint = .Simple }), - .double_value = fd(4, .{ .FixedInt = .I64 }), - .array_value = fd(5, .{ .SubMessage = {} }), - .kvlist_value = fd(6, .{ .SubMessage = {} }), - .bytes_value = fd(7, .Bytes), + bytes_value: []const u8, + pub const _desc_table = .{ + .string_value = fd(1, .{ .scalar = .string }), + .bool_value = fd(2, .{ .scalar = .bool }), + .int_value = fd(3, .{ .scalar = .int64 }), + .double_value = fd(4, .{ .scalar = .double }), + .array_value = fd(5, .submessage), + .kvlist_value = fd(6, .submessage), + .bytes_value = fd(7, .{ .scalar = .bytes }), }; }; pub const _desc_table = .{ - .value = fd(null, .{ .OneOf = value_union }), + .value = fd(null, .{ .oneof = value_union }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ArrayValue = struct { - values: ArrayList(AnyValue), + values: std.ArrayListUnmanaged(AnyValue) = .empty, pub const _desc_table = .{ - .values = fd(1, .{ .List = .{ .SubMessage = {} } }), + .values = fd(1, .{ .repeated = .submessage }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const KeyValueList = struct { - values: ArrayList(KeyValue), + values: std.ArrayListUnmanaged(KeyValue) = .empty, pub const _desc_table = .{ - .values = fd(1, .{ .List = .{ .SubMessage = {} } }), + .values = fd(1, .{ .repeated = .submessage }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const KeyValue = struct { - key: ManagedString = .Empty, + key: []const u8 = &.{}, value: ?AnyValue = null, pub const _desc_table = .{ - .key = fd(1, .String), - .value = fd(2, .{ .SubMessage = {} }), + .key = fd(1, .{ .scalar = .string }), + .value = fd(2, .submessage), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const InstrumentationScope = struct { - name: ManagedString = .Empty, - version: ManagedString = .Empty, - attributes: ArrayList(KeyValue), + name: []const u8 = &.{}, + version: []const u8 = &.{}, + attributes: std.ArrayListUnmanaged(KeyValue) = .empty, dropped_attributes_count: u32 = 0, pub const _desc_table = .{ - .name = fd(1, .String), - .version = fd(2, .String), - .attributes = fd(3, .{ .List = .{ .SubMessage = {} } }), - .dropped_attributes_count = fd(4, .{ .Varint = .Simple }), + .name = fd(1, .{ .scalar = .string }), + .version = fd(2, .{ .scalar = .string }), + .attributes = fd(3, .{ .repeated = .submessage }), + .dropped_attributes_count = fd(4, .{ .scalar = .uint32 }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const EntityRef = struct { - schema_url: ManagedString = .Empty, - type: ManagedString = .Empty, - id_keys: ArrayList(ManagedString), - description_keys: ArrayList(ManagedString), + schema_url: []const u8 = &.{}, + type: []const u8 = &.{}, + id_keys: std.ArrayListUnmanaged([]const u8) = .empty, + description_keys: std.ArrayListUnmanaged([]const u8) = .empty, pub const _desc_table = .{ - .schema_url = fd(1, .String), - .type = fd(2, .String), - .id_keys = fd(3, .{ .List = .String }), - .description_keys = fd(4, .{ .List = .String }), + .schema_url = fd(1, .{ .scalar = .string }), + .type = fd(2, .{ .scalar = .string }), + .id_keys = fd(3, .{ .repeated = .{ .scalar = .string } }), + .description_keys = fd(4, .{ .repeated = .{ .scalar = .string } }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; diff --git a/src/opentelemetry/proto/logs/v1.pb.zig b/src/opentelemetry/proto/logs/v1.pb.zig index f44571a..3fd0afc 100644 --- a/src/opentelemetry/proto/logs/v1.pb.zig +++ b/src/opentelemetry/proto/logs/v1.pb.zig @@ -1,13 +1,9 @@ // Code generated by protoc-gen-zig ///! package opentelemetry.proto.logs.v1 const std = @import("std"); -const Allocator = std.mem.Allocator; -const ArrayList = std.ArrayList; const protobuf = @import("protobuf"); -const ManagedString = protobuf.ManagedString; const fd = protobuf.fd; -const ManagedStruct = protobuf.ManagedStruct; /// import package opentelemetry.proto.common.v1 const opentelemetry_proto_common_v1 = @import("../common/v1.pb.zig"); /// import package opentelemetry.proto.resource.v1 @@ -49,69 +45,281 @@ pub const LogRecordFlags = enum(i32) { }; pub const LogsData = struct { - resource_logs: ArrayList(ResourceLogs), + resource_logs: std.ArrayListUnmanaged(ResourceLogs) = .empty, pub const _desc_table = .{ - .resource_logs = fd(1, .{ .List = .{ .SubMessage = {} } }), + .resource_logs = fd(1, .{ .repeated = .submessage }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ResourceLogs = struct { resource: ?opentelemetry_proto_resource_v1.Resource = null, - scope_logs: ArrayList(ScopeLogs), - schema_url: ManagedString = .Empty, + scope_logs: std.ArrayListUnmanaged(ScopeLogs) = .empty, + schema_url: []const u8 = &.{}, pub const _desc_table = .{ - .resource = fd(1, .{ .SubMessage = {} }), - .scope_logs = fd(2, .{ .List = .{ .SubMessage = {} } }), - .schema_url = fd(3, .String), + .resource = fd(1, .submessage), + .scope_logs = fd(2, .{ .repeated = .submessage }), + .schema_url = fd(3, .{ .scalar = .string }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ScopeLogs = struct { scope: ?opentelemetry_proto_common_v1.InstrumentationScope = null, - log_records: ArrayList(LogRecord), - schema_url: ManagedString = .Empty, + log_records: std.ArrayListUnmanaged(LogRecord) = .empty, + schema_url: []const u8 = &.{}, pub const _desc_table = .{ - .scope = fd(1, .{ .SubMessage = {} }), - .log_records = fd(2, .{ .List = .{ .SubMessage = {} } }), - .schema_url = fd(3, .String), + .scope = fd(1, .submessage), + .log_records = fd(2, .{ .repeated = .submessage }), + .schema_url = fd(3, .{ .scalar = .string }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const LogRecord = struct { time_unix_nano: u64 = 0, observed_time_unix_nano: u64 = 0, severity_number: SeverityNumber = @enumFromInt(0), - severity_text: ManagedString = .Empty, + severity_text: []const u8 = &.{}, body: ?opentelemetry_proto_common_v1.AnyValue = null, - attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue), + attributes: std.ArrayListUnmanaged(opentelemetry_proto_common_v1.KeyValue) = .empty, dropped_attributes_count: u32 = 0, flags: u32 = 0, - trace_id: ManagedString = .Empty, - span_id: ManagedString = .Empty, - event_name: ManagedString = .Empty, + trace_id: []const u8 = &.{}, + span_id: []const u8 = &.{}, + event_name: []const u8 = &.{}, pub const _desc_table = .{ - .time_unix_nano = fd(1, .{ .FixedInt = .I64 }), - .observed_time_unix_nano = fd(11, .{ .FixedInt = .I64 }), - .severity_number = fd(2, .{ .Varint = .Simple }), - .severity_text = fd(3, .String), - .body = fd(5, .{ .SubMessage = {} }), - .attributes = fd(6, .{ .List = .{ .SubMessage = {} } }), - .dropped_attributes_count = fd(7, .{ .Varint = .Simple }), - .flags = fd(8, .{ .FixedInt = .I32 }), - .trace_id = fd(9, .Bytes), - .span_id = fd(10, .Bytes), - .event_name = fd(12, .String), + .time_unix_nano = fd(1, .{ .scalar = .fixed64 }), + .observed_time_unix_nano = fd(11, .{ .scalar = .fixed64 }), + .severity_number = fd(2, .@"enum"), + .severity_text = fd(3, .{ .scalar = .string }), + .body = fd(5, .submessage), + .attributes = fd(6, .{ .repeated = .submessage }), + .dropped_attributes_count = fd(7, .{ .scalar = .uint32 }), + .flags = fd(8, .{ .scalar = .fixed32 }), + .trace_id = fd(9, .{ .scalar = .bytes }), + .span_id = fd(10, .{ .scalar = .bytes }), + .event_name = fd(12, .{ .scalar = .string }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; diff --git a/src/opentelemetry/proto/metrics/v1.pb.zig b/src/opentelemetry/proto/metrics/v1.pb.zig index 63a1ab2..e0839b5 100644 --- a/src/opentelemetry/proto/metrics/v1.pb.zig +++ b/src/opentelemetry/proto/metrics/v1.pb.zig @@ -1,13 +1,9 @@ // Code generated by protoc-gen-zig ///! package opentelemetry.proto.metrics.v1 const std = @import("std"); -const Allocator = std.mem.Allocator; -const ArrayList = std.ArrayList; const protobuf = @import("protobuf"); -const ManagedString = protobuf.ManagedString; const fd = protobuf.fd; -const ManagedStruct = protobuf.ManagedStruct; /// import package opentelemetry.proto.common.v1 const opentelemetry_proto_common_v1 = @import("../common/v1.pb.zig"); /// import package opentelemetry.proto.resource.v1 @@ -27,49 +23,208 @@ pub const DataPointFlags = enum(i32) { }; pub const MetricsData = struct { - resource_metrics: ArrayList(ResourceMetrics), + resource_metrics: std.ArrayListUnmanaged(ResourceMetrics) = .empty, pub const _desc_table = .{ - .resource_metrics = fd(1, .{ .List = .{ .SubMessage = {} } }), + .resource_metrics = fd(1, .{ .repeated = .submessage }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ResourceMetrics = struct { resource: ?opentelemetry_proto_resource_v1.Resource = null, - scope_metrics: ArrayList(ScopeMetrics), - schema_url: ManagedString = .Empty, + scope_metrics: std.ArrayListUnmanaged(ScopeMetrics) = .empty, + schema_url: []const u8 = &.{}, pub const _desc_table = .{ - .resource = fd(1, .{ .SubMessage = {} }), - .scope_metrics = fd(2, .{ .List = .{ .SubMessage = {} } }), - .schema_url = fd(3, .String), + .resource = fd(1, .submessage), + .scope_metrics = fd(2, .{ .repeated = .submessage }), + .schema_url = fd(3, .{ .scalar = .string }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ScopeMetrics = struct { scope: ?opentelemetry_proto_common_v1.InstrumentationScope = null, - metrics: ArrayList(Metric), - schema_url: ManagedString = .Empty, + metrics: std.ArrayListUnmanaged(Metric) = .empty, + schema_url: []const u8 = &.{}, pub const _desc_table = .{ - .scope = fd(1, .{ .SubMessage = {} }), - .metrics = fd(2, .{ .List = .{ .SubMessage = {} } }), - .schema_url = fd(3, .String), + .scope = fd(1, .submessage), + .metrics = fd(2, .{ .repeated = .submessage }), + .schema_url = fd(3, .{ .scalar = .string }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const Metric = struct { - name: ManagedString = .Empty, - description: ManagedString = .Empty, - unit: ManagedString = .Empty, - metadata: ArrayList(opentelemetry_proto_common_v1.KeyValue), - data: ?data_union, + name: []const u8 = &.{}, + description: []const u8 = &.{}, + unit: []const u8 = &.{}, + metadata: std.ArrayListUnmanaged(opentelemetry_proto_common_v1.KeyValue) = .empty, + data: ?data_union = null, pub const _data_case = enum { gauge, @@ -84,91 +239,409 @@ pub const Metric = struct { histogram: Histogram, exponential_histogram: ExponentialHistogram, summary: Summary, - pub const _union_desc = .{ - .gauge = fd(5, .{ .SubMessage = {} }), - .sum = fd(7, .{ .SubMessage = {} }), - .histogram = fd(9, .{ .SubMessage = {} }), - .exponential_histogram = fd(10, .{ .SubMessage = {} }), - .summary = fd(11, .{ .SubMessage = {} }), + pub const _desc_table = .{ + .gauge = fd(5, .submessage), + .sum = fd(7, .submessage), + .histogram = fd(9, .submessage), + .exponential_histogram = fd(10, .submessage), + .summary = fd(11, .submessage), }; }; pub const _desc_table = .{ - .name = fd(1, .String), - .description = fd(2, .String), - .unit = fd(3, .String), - .metadata = fd(12, .{ .List = .{ .SubMessage = {} } }), - .data = fd(null, .{ .OneOf = data_union }), + .name = fd(1, .{ .scalar = .string }), + .description = fd(2, .{ .scalar = .string }), + .unit = fd(3, .{ .scalar = .string }), + .metadata = fd(12, .{ .repeated = .submessage }), + .data = fd(null, .{ .oneof = data_union }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const Gauge = struct { - data_points: ArrayList(NumberDataPoint), + data_points: std.ArrayListUnmanaged(NumberDataPoint) = .empty, pub const _desc_table = .{ - .data_points = fd(1, .{ .List = .{ .SubMessage = {} } }), + .data_points = fd(1, .{ .repeated = .submessage }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const Sum = struct { - data_points: ArrayList(NumberDataPoint), + data_points: std.ArrayListUnmanaged(NumberDataPoint) = .empty, aggregation_temporality: AggregationTemporality = @enumFromInt(0), is_monotonic: bool = false, pub const _desc_table = .{ - .data_points = fd(1, .{ .List = .{ .SubMessage = {} } }), - .aggregation_temporality = fd(2, .{ .Varint = .Simple }), - .is_monotonic = fd(3, .{ .Varint = .Simple }), + .data_points = fd(1, .{ .repeated = .submessage }), + .aggregation_temporality = fd(2, .@"enum"), + .is_monotonic = fd(3, .{ .scalar = .bool }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const Histogram = struct { - data_points: ArrayList(HistogramDataPoint), + data_points: std.ArrayListUnmanaged(HistogramDataPoint) = .empty, aggregation_temporality: AggregationTemporality = @enumFromInt(0), pub const _desc_table = .{ - .data_points = fd(1, .{ .List = .{ .SubMessage = {} } }), - .aggregation_temporality = fd(2, .{ .Varint = .Simple }), + .data_points = fd(1, .{ .repeated = .submessage }), + .aggregation_temporality = fd(2, .@"enum"), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ExponentialHistogram = struct { - data_points: ArrayList(ExponentialHistogramDataPoint), + data_points: std.ArrayListUnmanaged(ExponentialHistogramDataPoint) = .empty, aggregation_temporality: AggregationTemporality = @enumFromInt(0), pub const _desc_table = .{ - .data_points = fd(1, .{ .List = .{ .SubMessage = {} } }), - .aggregation_temporality = fd(2, .{ .Varint = .Simple }), + .data_points = fd(1, .{ .repeated = .submessage }), + .aggregation_temporality = fd(2, .@"enum"), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const Summary = struct { - data_points: ArrayList(SummaryDataPoint), + data_points: std.ArrayListUnmanaged(SummaryDataPoint) = .empty, pub const _desc_table = .{ - .data_points = fd(1, .{ .List = .{ .SubMessage = {} } }), + .data_points = fd(1, .{ .repeated = .submessage }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const NumberDataPoint = struct { - attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue), + attributes: std.ArrayListUnmanaged(opentelemetry_proto_common_v1.KeyValue) = .empty, start_time_unix_nano: u64 = 0, time_unix_nano: u64 = 0, - exemplars: ArrayList(Exemplar), + exemplars: std.ArrayListUnmanaged(Exemplar) = .empty, flags: u32 = 0, - value: ?value_union, + value: ?value_union = null, pub const _value_case = enum { as_double, @@ -177,56 +650,162 @@ pub const NumberDataPoint = struct { pub const value_union = union(_value_case) { as_double: f64, as_int: i64, - pub const _union_desc = .{ - .as_double = fd(4, .{ .FixedInt = .I64 }), - .as_int = fd(6, .{ .FixedInt = .I64 }), + pub const _desc_table = .{ + .as_double = fd(4, .{ .scalar = .double }), + .as_int = fd(6, .{ .scalar = .sfixed64 }), }; }; pub const _desc_table = .{ - .attributes = fd(7, .{ .List = .{ .SubMessage = {} } }), - .start_time_unix_nano = fd(2, .{ .FixedInt = .I64 }), - .time_unix_nano = fd(3, .{ .FixedInt = .I64 }), - .exemplars = fd(5, .{ .List = .{ .SubMessage = {} } }), - .flags = fd(8, .{ .Varint = .Simple }), - .value = fd(null, .{ .OneOf = value_union }), + .attributes = fd(7, .{ .repeated = .submessage }), + .start_time_unix_nano = fd(2, .{ .scalar = .fixed64 }), + .time_unix_nano = fd(3, .{ .scalar = .fixed64 }), + .exemplars = fd(5, .{ .repeated = .submessage }), + .flags = fd(8, .{ .scalar = .uint32 }), + .value = fd(null, .{ .oneof = value_union }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const HistogramDataPoint = struct { - attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue), + attributes: std.ArrayListUnmanaged(opentelemetry_proto_common_v1.KeyValue) = .empty, start_time_unix_nano: u64 = 0, time_unix_nano: u64 = 0, count: u64 = 0, sum: ?f64 = null, - bucket_counts: ArrayList(u64), - explicit_bounds: ArrayList(f64), - exemplars: ArrayList(Exemplar), + bucket_counts: std.ArrayListUnmanaged(u64) = .empty, + explicit_bounds: std.ArrayListUnmanaged(f64) = .empty, + exemplars: std.ArrayListUnmanaged(Exemplar) = .empty, flags: u32 = 0, min: ?f64 = null, max: ?f64 = null, pub const _desc_table = .{ - .attributes = fd(9, .{ .List = .{ .SubMessage = {} } }), - .start_time_unix_nano = fd(2, .{ .FixedInt = .I64 }), - .time_unix_nano = fd(3, .{ .FixedInt = .I64 }), - .count = fd(4, .{ .FixedInt = .I64 }), - .sum = fd(5, .{ .FixedInt = .I64 }), - .bucket_counts = fd(6, .{ .PackedList = .{ .FixedInt = .I64 } }), - .explicit_bounds = fd(7, .{ .PackedList = .{ .FixedInt = .I64 } }), - .exemplars = fd(8, .{ .List = .{ .SubMessage = {} } }), - .flags = fd(10, .{ .Varint = .Simple }), - .min = fd(11, .{ .FixedInt = .I64 }), - .max = fd(12, .{ .FixedInt = .I64 }), + .attributes = fd(9, .{ .repeated = .submessage }), + .start_time_unix_nano = fd(2, .{ .scalar = .fixed64 }), + .time_unix_nano = fd(3, .{ .scalar = .fixed64 }), + .count = fd(4, .{ .scalar = .fixed64 }), + .sum = fd(5, .{ .scalar = .double }), + .bucket_counts = fd(6, .{ .packed_repeated = .{ .scalar = .fixed64 } }), + .explicit_bounds = fd(7, .{ .packed_repeated = .{ .scalar = .double } }), + .exemplars = fd(8, .{ .repeated = .submessage }), + .flags = fd(10, .{ .scalar = .uint32 }), + .min = fd(11, .{ .scalar = .double }), + .max = fd(12, .{ .scalar = .double }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ExponentialHistogramDataPoint = struct { - attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue), + attributes: std.ArrayListUnmanaged(opentelemetry_proto_common_v1.KeyValue) = .empty, start_time_unix_nano: u64 = 0, time_unix_nano: u64 = 0, count: u64 = 0, @@ -236,60 +815,166 @@ pub const ExponentialHistogramDataPoint = struct { positive: ?ExponentialHistogramDataPoint.Buckets = null, negative: ?ExponentialHistogramDataPoint.Buckets = null, flags: u32 = 0, - exemplars: ArrayList(Exemplar), + exemplars: std.ArrayListUnmanaged(Exemplar) = .empty, min: ?f64 = null, max: ?f64 = null, zero_threshold: f64 = 0, pub const _desc_table = .{ - .attributes = fd(1, .{ .List = .{ .SubMessage = {} } }), - .start_time_unix_nano = fd(2, .{ .FixedInt = .I64 }), - .time_unix_nano = fd(3, .{ .FixedInt = .I64 }), - .count = fd(4, .{ .FixedInt = .I64 }), - .sum = fd(5, .{ .FixedInt = .I64 }), - .scale = fd(6, .{ .Varint = .ZigZagOptimized }), - .zero_count = fd(7, .{ .FixedInt = .I64 }), - .positive = fd(8, .{ .SubMessage = {} }), - .negative = fd(9, .{ .SubMessage = {} }), - .flags = fd(10, .{ .Varint = .Simple }), - .exemplars = fd(11, .{ .List = .{ .SubMessage = {} } }), - .min = fd(12, .{ .FixedInt = .I64 }), - .max = fd(13, .{ .FixedInt = .I64 }), - .zero_threshold = fd(14, .{ .FixedInt = .I64 }), + .attributes = fd(1, .{ .repeated = .submessage }), + .start_time_unix_nano = fd(2, .{ .scalar = .fixed64 }), + .time_unix_nano = fd(3, .{ .scalar = .fixed64 }), + .count = fd(4, .{ .scalar = .fixed64 }), + .sum = fd(5, .{ .scalar = .double }), + .scale = fd(6, .{ .scalar = .sint32 }), + .zero_count = fd(7, .{ .scalar = .fixed64 }), + .positive = fd(8, .submessage), + .negative = fd(9, .submessage), + .flags = fd(10, .{ .scalar = .uint32 }), + .exemplars = fd(11, .{ .repeated = .submessage }), + .min = fd(12, .{ .scalar = .double }), + .max = fd(13, .{ .scalar = .double }), + .zero_threshold = fd(14, .{ .scalar = .double }), }; pub const Buckets = struct { offset: i32 = 0, - bucket_counts: ArrayList(u64), + bucket_counts: std.ArrayListUnmanaged(u64) = .empty, pub const _desc_table = .{ - .offset = fd(1, .{ .Varint = .ZigZagOptimized }), - .bucket_counts = fd(2, .{ .PackedList = .{ .Varint = .Simple } }), + .offset = fd(1, .{ .scalar = .sint32 }), + .bucket_counts = fd(2, .{ .packed_repeated = .{ .scalar = .uint64 } }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const SummaryDataPoint = struct { - attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue), + attributes: std.ArrayListUnmanaged(opentelemetry_proto_common_v1.KeyValue) = .empty, start_time_unix_nano: u64 = 0, time_unix_nano: u64 = 0, count: u64 = 0, sum: f64 = 0, - quantile_values: ArrayList(SummaryDataPoint.ValueAtQuantile), + quantile_values: std.ArrayListUnmanaged(SummaryDataPoint.ValueAtQuantile) = .empty, flags: u32 = 0, pub const _desc_table = .{ - .attributes = fd(7, .{ .List = .{ .SubMessage = {} } }), - .start_time_unix_nano = fd(2, .{ .FixedInt = .I64 }), - .time_unix_nano = fd(3, .{ .FixedInt = .I64 }), - .count = fd(4, .{ .FixedInt = .I64 }), - .sum = fd(5, .{ .FixedInt = .I64 }), - .quantile_values = fd(6, .{ .List = .{ .SubMessage = {} } }), - .flags = fd(8, .{ .Varint = .Simple }), + .attributes = fd(7, .{ .repeated = .submessage }), + .start_time_unix_nano = fd(2, .{ .scalar = .fixed64 }), + .time_unix_nano = fd(3, .{ .scalar = .fixed64 }), + .count = fd(4, .{ .scalar = .fixed64 }), + .sum = fd(5, .{ .scalar = .double }), + .quantile_values = fd(6, .{ .repeated = .submessage }), + .flags = fd(8, .{ .scalar = .uint32 }), }; pub const ValueAtQuantile = struct { @@ -297,22 +982,128 @@ pub const SummaryDataPoint = struct { value: f64 = 0, pub const _desc_table = .{ - .quantile = fd(1, .{ .FixedInt = .I64 }), - .value = fd(2, .{ .FixedInt = .I64 }), + .quantile = fd(1, .{ .scalar = .double }), + .value = fd(2, .{ .scalar = .double }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const Exemplar = struct { - filtered_attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue), + filtered_attributes: std.ArrayListUnmanaged(opentelemetry_proto_common_v1.KeyValue) = .empty, time_unix_nano: u64 = 0, - span_id: ManagedString = .Empty, - trace_id: ManagedString = .Empty, - value: ?value_union, + span_id: []const u8 = &.{}, + trace_id: []const u8 = &.{}, + value: ?value_union = null, pub const _value_case = enum { as_double, @@ -321,19 +1112,72 @@ pub const Exemplar = struct { pub const value_union = union(_value_case) { as_double: f64, as_int: i64, - pub const _union_desc = .{ - .as_double = fd(3, .{ .FixedInt = .I64 }), - .as_int = fd(6, .{ .FixedInt = .I64 }), + pub const _desc_table = .{ + .as_double = fd(3, .{ .scalar = .double }), + .as_int = fd(6, .{ .scalar = .sfixed64 }), }; }; pub const _desc_table = .{ - .filtered_attributes = fd(7, .{ .List = .{ .SubMessage = {} } }), - .time_unix_nano = fd(2, .{ .FixedInt = .I64 }), - .span_id = fd(4, .Bytes), - .trace_id = fd(5, .Bytes), - .value = fd(null, .{ .OneOf = value_union }), + .filtered_attributes = fd(7, .{ .repeated = .submessage }), + .time_unix_nano = fd(2, .{ .scalar = .fixed64 }), + .span_id = fd(4, .{ .scalar = .bytes }), + .trace_id = fd(5, .{ .scalar = .bytes }), + .value = fd(null, .{ .oneof = value_union }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; diff --git a/src/opentelemetry/proto/resource/v1.pb.zig b/src/opentelemetry/proto/resource/v1.pb.zig index fc752f6..0722831 100644 --- a/src/opentelemetry/proto/resource/v1.pb.zig +++ b/src/opentelemetry/proto/resource/v1.pb.zig @@ -1,26 +1,75 @@ // Code generated by protoc-gen-zig ///! package opentelemetry.proto.resource.v1 const std = @import("std"); -const Allocator = std.mem.Allocator; -const ArrayList = std.ArrayList; const protobuf = @import("protobuf"); -const ManagedString = protobuf.ManagedString; const fd = protobuf.fd; -const ManagedStruct = protobuf.ManagedStruct; /// import package opentelemetry.proto.common.v1 const opentelemetry_proto_common_v1 = @import("../common/v1.pb.zig"); pub const Resource = struct { - attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue), + attributes: std.ArrayListUnmanaged(opentelemetry_proto_common_v1.KeyValue) = .empty, dropped_attributes_count: u32 = 0, - entity_refs: ArrayList(opentelemetry_proto_common_v1.EntityRef), + entity_refs: std.ArrayListUnmanaged(opentelemetry_proto_common_v1.EntityRef) = .empty, pub const _desc_table = .{ - .attributes = fd(1, .{ .List = .{ .SubMessage = {} } }), - .dropped_attributes_count = fd(2, .{ .Varint = .Simple }), - .entity_refs = fd(3, .{ .List = .{ .SubMessage = {} } }), + .attributes = fd(1, .{ .repeated = .submessage }), + .dropped_attributes_count = fd(2, .{ .scalar = .uint32 }), + .entity_refs = fd(3, .{ .repeated = .submessage }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; diff --git a/src/opentelemetry/proto/trace/v1.pb.zig b/src/opentelemetry/proto/trace/v1.pb.zig index 0940b2c..0ac5ee0 100644 --- a/src/opentelemetry/proto/trace/v1.pb.zig +++ b/src/opentelemetry/proto/trace/v1.pb.zig @@ -1,13 +1,9 @@ // Code generated by protoc-gen-zig ///! package opentelemetry.proto.trace.v1 const std = @import("std"); -const Allocator = std.mem.Allocator; -const ArrayList = std.ArrayList; const protobuf = @import("protobuf"); -const ManagedString = protobuf.ManagedString; const fd = protobuf.fd; -const ManagedStruct = protobuf.ManagedStruct; /// import package opentelemetry.proto.common.v1 const opentelemetry_proto_common_v1 = @import("../common/v1.pb.zig"); /// import package opentelemetry.proto.resource.v1 @@ -22,78 +18,237 @@ pub const SpanFlags = enum(i32) { }; pub const TracesData = struct { - resource_spans: ArrayList(ResourceSpans), + resource_spans: std.ArrayListUnmanaged(ResourceSpans) = .empty, pub const _desc_table = .{ - .resource_spans = fd(1, .{ .List = .{ .SubMessage = {} } }), + .resource_spans = fd(1, .{ .repeated = .submessage }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ResourceSpans = struct { resource: ?opentelemetry_proto_resource_v1.Resource = null, - scope_spans: ArrayList(ScopeSpans), - schema_url: ManagedString = .Empty, + scope_spans: std.ArrayListUnmanaged(ScopeSpans) = .empty, + schema_url: []const u8 = &.{}, pub const _desc_table = .{ - .resource = fd(1, .{ .SubMessage = {} }), - .scope_spans = fd(2, .{ .List = .{ .SubMessage = {} } }), - .schema_url = fd(3, .String), + .resource = fd(1, .submessage), + .scope_spans = fd(2, .{ .repeated = .submessage }), + .schema_url = fd(3, .{ .scalar = .string }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const ScopeSpans = struct { scope: ?opentelemetry_proto_common_v1.InstrumentationScope = null, - spans: ArrayList(Span), - schema_url: ManagedString = .Empty, + spans: std.ArrayListUnmanaged(Span) = .empty, + schema_url: []const u8 = &.{}, pub const _desc_table = .{ - .scope = fd(1, .{ .SubMessage = {} }), - .spans = fd(2, .{ .List = .{ .SubMessage = {} } }), - .schema_url = fd(3, .String), + .scope = fd(1, .submessage), + .spans = fd(2, .{ .repeated = .submessage }), + .schema_url = fd(3, .{ .scalar = .string }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const Span = struct { - trace_id: ManagedString = .Empty, - span_id: ManagedString = .Empty, - trace_state: ManagedString = .Empty, - parent_span_id: ManagedString = .Empty, + trace_id: []const u8 = &.{}, + span_id: []const u8 = &.{}, + trace_state: []const u8 = &.{}, + parent_span_id: []const u8 = &.{}, flags: u32 = 0, - name: ManagedString = .Empty, + name: []const u8 = &.{}, kind: Span.SpanKind = @enumFromInt(0), start_time_unix_nano: u64 = 0, end_time_unix_nano: u64 = 0, - attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue), + attributes: std.ArrayListUnmanaged(opentelemetry_proto_common_v1.KeyValue) = .empty, dropped_attributes_count: u32 = 0, - events: ArrayList(Span.Event), + events: std.ArrayListUnmanaged(Span.Event) = .empty, dropped_events_count: u32 = 0, - links: ArrayList(Span.Link), + links: std.ArrayListUnmanaged(Span.Link) = .empty, dropped_links_count: u32 = 0, status: ?Status = null, pub const _desc_table = .{ - .trace_id = fd(1, .Bytes), - .span_id = fd(2, .Bytes), - .trace_state = fd(3, .String), - .parent_span_id = fd(4, .Bytes), - .flags = fd(16, .{ .FixedInt = .I32 }), - .name = fd(5, .String), - .kind = fd(6, .{ .Varint = .Simple }), - .start_time_unix_nano = fd(7, .{ .FixedInt = .I64 }), - .end_time_unix_nano = fd(8, .{ .FixedInt = .I64 }), - .attributes = fd(9, .{ .List = .{ .SubMessage = {} } }), - .dropped_attributes_count = fd(10, .{ .Varint = .Simple }), - .events = fd(11, .{ .List = .{ .SubMessage = {} } }), - .dropped_events_count = fd(12, .{ .Varint = .Simple }), - .links = fd(13, .{ .List = .{ .SubMessage = {} } }), - .dropped_links_count = fd(14, .{ .Varint = .Simple }), - .status = fd(15, .{ .SubMessage = {} }), + .trace_id = fd(1, .{ .scalar = .bytes }), + .span_id = fd(2, .{ .scalar = .bytes }), + .trace_state = fd(3, .{ .scalar = .string }), + .parent_span_id = fd(4, .{ .scalar = .bytes }), + .flags = fd(16, .{ .scalar = .fixed32 }), + .name = fd(5, .{ .scalar = .string }), + .kind = fd(6, .@"enum"), + .start_time_unix_nano = fd(7, .{ .scalar = .fixed64 }), + .end_time_unix_nano = fd(8, .{ .scalar = .fixed64 }), + .attributes = fd(9, .{ .repeated = .submessage }), + .dropped_attributes_count = fd(10, .{ .scalar = .uint32 }), + .events = fd(11, .{ .repeated = .submessage }), + .dropped_events_count = fd(12, .{ .scalar = .uint32 }), + .links = fd(13, .{ .repeated = .submessage }), + .dropped_links_count = fd(14, .{ .scalar = .uint32 }), + .status = fd(15, .submessage), }; pub const SpanKind = enum(i32) { @@ -108,50 +263,209 @@ pub const Span = struct { pub const Event = struct { time_unix_nano: u64 = 0, - name: ManagedString = .Empty, - attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue), + name: []const u8 = &.{}, + attributes: std.ArrayListUnmanaged(opentelemetry_proto_common_v1.KeyValue) = .empty, dropped_attributes_count: u32 = 0, pub const _desc_table = .{ - .time_unix_nano = fd(1, .{ .FixedInt = .I64 }), - .name = fd(2, .String), - .attributes = fd(3, .{ .List = .{ .SubMessage = {} } }), - .dropped_attributes_count = fd(4, .{ .Varint = .Simple }), + .time_unix_nano = fd(1, .{ .scalar = .fixed64 }), + .name = fd(2, .{ .scalar = .string }), + .attributes = fd(3, .{ .repeated = .submessage }), + .dropped_attributes_count = fd(4, .{ .scalar = .uint32 }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const Link = struct { - trace_id: ManagedString = .Empty, - span_id: ManagedString = .Empty, - trace_state: ManagedString = .Empty, - attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue), + trace_id: []const u8 = &.{}, + span_id: []const u8 = &.{}, + trace_state: []const u8 = &.{}, + attributes: std.ArrayListUnmanaged(opentelemetry_proto_common_v1.KeyValue) = .empty, dropped_attributes_count: u32 = 0, flags: u32 = 0, pub const _desc_table = .{ - .trace_id = fd(1, .Bytes), - .span_id = fd(2, .Bytes), - .trace_state = fd(3, .String), - .attributes = fd(4, .{ .List = .{ .SubMessage = {} } }), - .dropped_attributes_count = fd(5, .{ .Varint = .Simple }), - .flags = fd(6, .{ .FixedInt = .I32 }), + .trace_id = fd(1, .{ .scalar = .bytes }), + .span_id = fd(2, .{ .scalar = .bytes }), + .trace_state = fd(3, .{ .scalar = .string }), + .attributes = fd(4, .{ .repeated = .submessage }), + .dropped_attributes_count = fd(5, .{ .scalar = .uint32 }), + .flags = fd(6, .{ .scalar = .fixed32 }), }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; pub const Status = struct { - message: ManagedString = .Empty, + message: []const u8 = &.{}, code: Status.StatusCode = @enumFromInt(0), pub const _desc_table = .{ - .message = fd(2, .String), - .code = fd(3, .{ .Varint = .Simple }), + .message = fd(2, .{ .scalar = .string }), + .code = fd(3, .@"enum"), }; pub const StatusCode = enum(i32) { @@ -161,5 +475,58 @@ pub const Status = struct { _, }; - pub usingnamespace protobuf.MessageMixins(@This()); + pub fn encode( + self: @This(), + writer: *std.Io.Writer, + allocator: std.mem.Allocator, + ) (std.Io.Writer.Error || std.mem.Allocator.Error)!void { + return protobuf.encode(writer, allocator, self); + } + + pub fn decode( + reader: *std.Io.Reader, + allocator: std.mem.Allocator, + ) (protobuf.DecodingError || std.Io.Reader.Error || std.mem.Allocator.Error)!@This() { + return protobuf.decode(@This(), reader, allocator); + } + + pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void { + return protobuf.deinit(allocator, self); + } + + pub fn dupe(self: @This(), allocator: std.mem.Allocator) std.mem.Allocator.Error!@This() { + return protobuf.dupe(@This(), self, allocator); + } + + pub fn jsonDecode( + input: []const u8, + options: std.json.ParseOptions, + allocator: std.mem.Allocator, + ) !std.json.Parsed(@This()) { + return protobuf.json.decode(@This(), input, options, allocator); + } + + pub fn jsonEncode( + self: @This(), + options: std.json.Stringify.Options, + allocator: std.mem.Allocator, + ) ![]const u8 { + return protobuf.json.encode(self, options, allocator); + } + + // This method is used by std.json + // internally for deserialization. DO NOT RENAME! + pub fn jsonParse( + allocator: std.mem.Allocator, + source: anytype, + options: std.json.ParseOptions, + ) !@This() { + return protobuf.json.parse(@This(), allocator, source, options); + } + + // This method is used by std.json + // internally for serialization. DO NOT RENAME! + pub fn jsonStringify(self: *const @This(), jws: anytype) !void { + return protobuf.json.stringify(@This(), self, jws); + } }; From e4e5411a070fbe70bb5ce119e076b98044a9b7a7 Mon Sep 17 00:00:00 2001 From: hendriknielaender Date: Thu, 25 Sep 2025 22:48:50 +0200 Subject: [PATCH 2/3] update otel proto version --- build.zig.zon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig.zon b/build.zig.zon index 0eae915..5ea8b8b 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -3,7 +3,7 @@ // Mirror the version from the `opentelemetry-proto` repository. // This is a [Semantic Version](https://semver.org/). - .version = "1.7.0", + .version = "1.8.0", .fingerprint = 0x83b04c56bb34864b, // Changing this has security and trust implications. From 651c102ecb6f2f90a823141f1c676a11b66d51e7 Mon Sep 17 00:00:00 2001 From: hendriknielaender Date: Thu, 25 Sep 2025 22:50:12 +0200 Subject: [PATCH 3/3] update otel proto version --- proto-src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto-src b/proto-src index 8654ab7..c0a98a1 160000 --- a/proto-src +++ b/proto-src @@ -1 +1 @@ -Subproject commit 8654ab7a5a43ca25fe8046e59dcd6935c3f76de0 +Subproject commit c0a98a1847d3124ac5f9ecd02d0e2d2732bbb590