Compare commits

...

1 Commits

Author SHA1 Message Date
Jarred Sumner
aa47d4269b zig 2025-04-01 09:22:40 -07:00
12 changed files with 1259 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ const Arch = std.Target.Cpu.Arch;
const OperatingSystem = @import("src/env.zig").OperatingSystem;
const pathRel = fs.path.relative;
const protobuf = @import("protobuf");
/// Do not rename this constant. It is scanned by some scripts to determine which zig version to install.
const recommended_zig_version = "0.14.0";
@@ -283,6 +284,36 @@ pub fn build(b: *Build) !void {
var bun_obj = addBunObject(b, &build_options);
step.dependOn(&bun_obj.step);
step.dependOn(addInstallObjectFile(b, bun_obj, "bun-zig", obj_format));
const protobuf_dep = b.dependency("protobuf", .{
.target = target,
.optimize = optimize,
});
// and lastly use the dependency as a module
bun_obj.root_module.addImport("protobuf", protobuf_dep.module("protobuf"));
const gen_proto = b.step("gen-proto", "generates zig files from protocol buffer definitions");
const protoc_step = protobuf.RunProtocStep.create(b, protobuf_dep.builder, target, .{
// out directory for the generated zig files
.destination_directory = b.path("src"),
.source_files = &.{
"opentelemetry/proto/collector/logs/v1/logs_service.proto",
"opentelemetry/proto/collector/metrics/v1/metrics_service.proto",
"opentelemetry/proto/collector/profiles/v1development/profiles_service.proto",
"opentelemetry/proto/collector/trace/v1/trace_service.proto",
"opentelemetry/proto/common/v1/common.proto",
"opentelemetry/proto/logs/v1/logs.proto",
"opentelemetry/proto/metrics/v1/metrics.proto",
"opentelemetry/proto/profiles/v1development/profiles.proto",
"opentelemetry/proto/resource/v1/resource.proto",
"opentelemetry/proto/trace/v1/trace.proto",
},
.include_directories = &.{},
});
gen_proto.dependOn(&protoc_step.step);
}
// zig build windows-shim

52
build.zig.zon Normal file
View File

@@ -0,0 +1,52 @@
.{
// This is the default name used by packages depending on this one. For
// example, when a user runs `zig fetch --save <url>`, this field is used
// as the key in the `dependencies` table. Although the user can choose a
// different name, most users will stick with this provided value.
//
// It is redundant to include "zig" in this name because it is already
// within the Zig package namespace.
.name = .bun,
// This is a [Semantic Version](https://semver.org/).
// In a future version of Zig it will be used for package deduplication.
.version = "0.0.0",
// Together with name, this represents a globally unique package
// identifier. This field is generated by the Zig toolchain when the
// package is first created, and then *never changes*. This allows
// unambiguous detection of one package being an updated version of
// another.
//
// When forking a Zig project, this id should be regenerated (delete the
// field and run `zig build`) if the upstream project is still maintained.
// Otherwise, the fork is *hostile*, attempting to take control over the
// original project's identity. Thus it is recommended to leave the comment
// on the following line intact, so that it shows up in code reviews that
// modify the field.
.fingerprint = 0x4c5007b0ab0b4690, // Changing this has security and trust implications.
// Tracks the earliest Zig version that the package considers to be a
// supported use case.
.minimum_zig_version = "0.14.0",
// This field is optional.
// Each dependency must either provide a `url` and `hash`, or a `path`.
// `zig build --fetch` can be used to fetch all dependencies of a package, recursively.
// Once all dependencies are fetched, `zig build` no longer requires
// internet connectivity.
.dependencies = .{
.protobuf = .{
.url = "git+https://github.com/Arwalk/zig-protobuf#27f8910aac3840722817d0bd56750916afd619a4",
.hash = "protobuf-2.0.0-0e82aqCZGwCTEk11MsgMiy1G4ZP2Q1QKX4QJ9dqfF_M6",
},
},
.paths = .{
"build.zig",
"build.zig.zon",
"src",
// For example...
//"LICENSE",
//"README.md",
},
}

View File

@@ -0,0 +1,44 @@
// 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),
pub const _desc_table = .{
.resource_logs = fd(1, .{ .List = .{ .SubMessage = {} } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ExportLogsServiceResponse = struct {
partial_success: ?ExportLogsPartialSuccess = null,
pub const _desc_table = .{
.partial_success = fd(1, .{ .SubMessage = {} }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ExportLogsPartialSuccess = struct {
rejected_log_records: i64 = 0,
error_message: ManagedString = .Empty,
pub const _desc_table = .{
.rejected_log_records = fd(1, .{ .Varint = .Simple }),
.error_message = fd(2, .String),
};
pub usingnamespace protobuf.MessageMixins(@This());
};

View File

@@ -0,0 +1,44 @@
// 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),
pub const _desc_table = .{
.resource_metrics = fd(1, .{ .List = .{ .SubMessage = {} } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ExportMetricsServiceResponse = struct {
partial_success: ?ExportMetricsPartialSuccess = null,
pub const _desc_table = .{
.partial_success = fd(1, .{ .SubMessage = {} }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ExportMetricsPartialSuccess = struct {
rejected_data_points: i64 = 0,
error_message: ManagedString = .Empty,
pub const _desc_table = .{
.rejected_data_points = fd(1, .{ .Varint = .Simple }),
.error_message = fd(2, .String),
};
pub usingnamespace protobuf.MessageMixins(@This());
};

View File

@@ -0,0 +1,44 @@
// Code generated by protoc-gen-zig
///! package opentelemetry.proto.collector.profiles.v1development
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.profiles.v1development
const opentelemetry_proto_profiles_v1development = @import("../../profiles/v1development.pb.zig");
pub const ExportProfilesServiceRequest = struct {
resource_profiles: ArrayList(opentelemetry_proto_profiles_v1development.ResourceProfiles),
pub const _desc_table = .{
.resource_profiles = fd(1, .{ .List = .{ .SubMessage = {} } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ExportProfilesServiceResponse = struct {
partial_success: ?ExportProfilesPartialSuccess = null,
pub const _desc_table = .{
.partial_success = fd(1, .{ .SubMessage = {} }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ExportProfilesPartialSuccess = struct {
rejected_profiles: i64 = 0,
error_message: ManagedString = .Empty,
pub const _desc_table = .{
.rejected_profiles = fd(1, .{ .Varint = .Simple }),
.error_message = fd(2, .String),
};
pub usingnamespace protobuf.MessageMixins(@This());
};

View File

@@ -0,0 +1,44 @@
// 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),
pub const _desc_table = .{
.resource_spans = fd(1, .{ .List = .{ .SubMessage = {} } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ExportTraceServiceResponse = struct {
partial_success: ?ExportTracePartialSuccess = null,
pub const _desc_table = .{
.partial_success = fd(1, .{ .SubMessage = {} }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ExportTracePartialSuccess = struct {
rejected_spans: i64 = 0,
error_message: ManagedString = .Empty,
pub const _desc_table = .{
.rejected_spans = fd(1, .{ .Varint = .Simple }),
.error_message = fd(2, .String),
};
pub usingnamespace protobuf.MessageMixins(@This());
};

View File

@@ -0,0 +1,112 @@
// 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,
pub const _value_case = enum {
string_value,
bool_value,
int_value,
double_value,
array_value,
kvlist_value,
bytes_value,
};
pub const value_union = union(_value_case) {
string_value: ManagedString,
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),
};
};
pub const _desc_table = .{
.value = fd(null, .{ .OneOf = value_union }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ArrayValue = struct {
values: ArrayList(AnyValue),
pub const _desc_table = .{
.values = fd(1, .{ .List = .{ .SubMessage = {} } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const KeyValueList = struct {
values: ArrayList(KeyValue),
pub const _desc_table = .{
.values = fd(1, .{ .List = .{ .SubMessage = {} } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const KeyValue = struct {
key: ManagedString = .Empty,
value: ?AnyValue = null,
pub const _desc_table = .{
.key = fd(1, .String),
.value = fd(2, .{ .SubMessage = {} }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const InstrumentationScope = struct {
name: ManagedString = .Empty,
version: ManagedString = .Empty,
attributes: ArrayList(KeyValue),
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 }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const EntityRef = struct {
schema_url: ManagedString = .Empty,
type: ManagedString = .Empty,
id_keys: ArrayList(ManagedString),
description_keys: ArrayList(ManagedString),
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 }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};

View File

@@ -0,0 +1,117 @@
// 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
const opentelemetry_proto_resource_v1 = @import("../resource/v1.pb.zig");
pub const SeverityNumber = enum(i32) {
SEVERITY_NUMBER_UNSPECIFIED = 0,
SEVERITY_NUMBER_TRACE = 1,
SEVERITY_NUMBER_TRACE2 = 2,
SEVERITY_NUMBER_TRACE3 = 3,
SEVERITY_NUMBER_TRACE4 = 4,
SEVERITY_NUMBER_DEBUG = 5,
SEVERITY_NUMBER_DEBUG2 = 6,
SEVERITY_NUMBER_DEBUG3 = 7,
SEVERITY_NUMBER_DEBUG4 = 8,
SEVERITY_NUMBER_INFO = 9,
SEVERITY_NUMBER_INFO2 = 10,
SEVERITY_NUMBER_INFO3 = 11,
SEVERITY_NUMBER_INFO4 = 12,
SEVERITY_NUMBER_WARN = 13,
SEVERITY_NUMBER_WARN2 = 14,
SEVERITY_NUMBER_WARN3 = 15,
SEVERITY_NUMBER_WARN4 = 16,
SEVERITY_NUMBER_ERROR = 17,
SEVERITY_NUMBER_ERROR2 = 18,
SEVERITY_NUMBER_ERROR3 = 19,
SEVERITY_NUMBER_ERROR4 = 20,
SEVERITY_NUMBER_FATAL = 21,
SEVERITY_NUMBER_FATAL2 = 22,
SEVERITY_NUMBER_FATAL3 = 23,
SEVERITY_NUMBER_FATAL4 = 24,
_,
};
pub const LogRecordFlags = enum(i32) {
LOG_RECORD_FLAGS_DO_NOT_USE = 0,
LOG_RECORD_FLAGS_TRACE_FLAGS_MASK = 255,
_,
};
pub const LogsData = struct {
resource_logs: ArrayList(ResourceLogs),
pub const _desc_table = .{
.resource_logs = fd(1, .{ .List = .{ .SubMessage = {} } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ResourceLogs = struct {
resource: ?opentelemetry_proto_resource_v1.Resource = null,
scope_logs: ArrayList(ScopeLogs),
schema_url: ManagedString = .Empty,
pub const _desc_table = .{
.resource = fd(1, .{ .SubMessage = {} }),
.scope_logs = fd(2, .{ .List = .{ .SubMessage = {} } }),
.schema_url = fd(3, .String),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ScopeLogs = struct {
scope: ?opentelemetry_proto_common_v1.InstrumentationScope = null,
log_records: ArrayList(LogRecord),
schema_url: ManagedString = .Empty,
pub const _desc_table = .{
.scope = fd(1, .{ .SubMessage = {} }),
.log_records = fd(2, .{ .List = .{ .SubMessage = {} } }),
.schema_url = fd(3, .String),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const LogRecord = struct {
time_unix_nano: u64 = 0,
observed_time_unix_nano: u64 = 0,
severity_number: SeverityNumber = @enumFromInt(0),
severity_text: ManagedString = .Empty,
body: ?opentelemetry_proto_common_v1.AnyValue = null,
attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue),
dropped_attributes_count: u32 = 0,
flags: u32 = 0,
trace_id: ManagedString = .Empty,
span_id: ManagedString = .Empty,
event_name: ManagedString = .Empty,
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),
};
pub usingnamespace protobuf.MessageMixins(@This());
};

View File

@@ -0,0 +1,339 @@
// 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
const opentelemetry_proto_resource_v1 = @import("../resource/v1.pb.zig");
pub const AggregationTemporality = enum(i32) {
AGGREGATION_TEMPORALITY_UNSPECIFIED = 0,
AGGREGATION_TEMPORALITY_DELTA = 1,
AGGREGATION_TEMPORALITY_CUMULATIVE = 2,
_,
};
pub const DataPointFlags = enum(i32) {
DATA_POINT_FLAGS_DO_NOT_USE = 0,
DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK = 1,
_,
};
pub const MetricsData = struct {
resource_metrics: ArrayList(ResourceMetrics),
pub const _desc_table = .{
.resource_metrics = fd(1, .{ .List = .{ .SubMessage = {} } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ResourceMetrics = struct {
resource: ?opentelemetry_proto_resource_v1.Resource = null,
scope_metrics: ArrayList(ScopeMetrics),
schema_url: ManagedString = .Empty,
pub const _desc_table = .{
.resource = fd(1, .{ .SubMessage = {} }),
.scope_metrics = fd(2, .{ .List = .{ .SubMessage = {} } }),
.schema_url = fd(3, .String),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ScopeMetrics = struct {
scope: ?opentelemetry_proto_common_v1.InstrumentationScope = null,
metrics: ArrayList(Metric),
schema_url: ManagedString = .Empty,
pub const _desc_table = .{
.scope = fd(1, .{ .SubMessage = {} }),
.metrics = fd(2, .{ .List = .{ .SubMessage = {} } }),
.schema_url = fd(3, .String),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Metric = struct {
name: ManagedString = .Empty,
description: ManagedString = .Empty,
unit: ManagedString = .Empty,
metadata: ArrayList(opentelemetry_proto_common_v1.KeyValue),
data: ?data_union,
pub const _data_case = enum {
gauge,
sum,
histogram,
exponential_histogram,
summary,
};
pub const data_union = union(_data_case) {
gauge: Gauge,
sum: Sum,
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 = .{
.name = fd(1, .String),
.description = fd(2, .String),
.unit = fd(3, .String),
.metadata = fd(12, .{ .List = .{ .SubMessage = {} } }),
.data = fd(null, .{ .OneOf = data_union }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Gauge = struct {
data_points: ArrayList(NumberDataPoint),
pub const _desc_table = .{
.data_points = fd(1, .{ .List = .{ .SubMessage = {} } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Sum = struct {
data_points: ArrayList(NumberDataPoint),
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 }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Histogram = struct {
data_points: ArrayList(HistogramDataPoint),
aggregation_temporality: AggregationTemporality = @enumFromInt(0),
pub const _desc_table = .{
.data_points = fd(1, .{ .List = .{ .SubMessage = {} } }),
.aggregation_temporality = fd(2, .{ .Varint = .Simple }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ExponentialHistogram = struct {
data_points: ArrayList(ExponentialHistogramDataPoint),
aggregation_temporality: AggregationTemporality = @enumFromInt(0),
pub const _desc_table = .{
.data_points = fd(1, .{ .List = .{ .SubMessage = {} } }),
.aggregation_temporality = fd(2, .{ .Varint = .Simple }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Summary = struct {
data_points: ArrayList(SummaryDataPoint),
pub const _desc_table = .{
.data_points = fd(1, .{ .List = .{ .SubMessage = {} } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const NumberDataPoint = struct {
attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue),
start_time_unix_nano: u64 = 0,
time_unix_nano: u64 = 0,
exemplars: ArrayList(Exemplar),
flags: u32 = 0,
value: ?value_union,
pub const _value_case = enum {
as_double,
as_int,
};
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 = .{
.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 }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const HistogramDataPoint = struct {
attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue),
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),
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 }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ExponentialHistogramDataPoint = struct {
attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue),
start_time_unix_nano: u64 = 0,
time_unix_nano: u64 = 0,
count: u64 = 0,
sum: ?f64 = null,
scale: i32 = 0,
zero_count: u64 = 0,
positive: ?Buckets = null,
negative: ?Buckets = null,
flags: u32 = 0,
exemplars: ArrayList(Exemplar),
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 }),
};
pub const Buckets = struct {
offset: i32 = 0,
bucket_counts: ArrayList(u64),
pub const _desc_table = .{
.offset = fd(1, .{ .Varint = .ZigZagOptimized }),
.bucket_counts = fd(2, .{ .PackedList = .{ .Varint = .Simple } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const SummaryDataPoint = struct {
attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue),
start_time_unix_nano: u64 = 0,
time_unix_nano: u64 = 0,
count: u64 = 0,
sum: f64 = 0,
quantile_values: ArrayList(ValueAtQuantile),
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 }),
};
pub const ValueAtQuantile = struct {
quantile: f64 = 0,
value: f64 = 0,
pub const _desc_table = .{
.quantile = fd(1, .{ .FixedInt = .I64 }),
.value = fd(2, .{ .FixedInt = .I64 }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Exemplar = struct {
filtered_attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue),
time_unix_nano: u64 = 0,
span_id: ManagedString = .Empty,
trace_id: ManagedString = .Empty,
value: ?value_union,
pub const _value_case = enum {
as_double,
as_int,
};
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 = .{
.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 }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};

View File

@@ -0,0 +1,241 @@
// Code generated by protoc-gen-zig
///! package opentelemetry.proto.profiles.v1development
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
const opentelemetry_proto_resource_v1 = @import("../resource/v1.pb.zig");
pub const AggregationTemporality = enum(i32) {
AGGREGATION_TEMPORALITY_UNSPECIFIED = 0,
AGGREGATION_TEMPORALITY_DELTA = 1,
AGGREGATION_TEMPORALITY_CUMULATIVE = 2,
_,
};
pub const ProfilesData = struct {
resource_profiles: ArrayList(ResourceProfiles),
pub const _desc_table = .{
.resource_profiles = fd(1, .{ .List = .{ .SubMessage = {} } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ResourceProfiles = struct {
resource: ?opentelemetry_proto_resource_v1.Resource = null,
scope_profiles: ArrayList(ScopeProfiles),
schema_url: ManagedString = .Empty,
pub const _desc_table = .{
.resource = fd(1, .{ .SubMessage = {} }),
.scope_profiles = fd(2, .{ .List = .{ .SubMessage = {} } }),
.schema_url = fd(3, .String),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ScopeProfiles = struct {
scope: ?opentelemetry_proto_common_v1.InstrumentationScope = null,
profiles: ArrayList(Profile),
schema_url: ManagedString = .Empty,
pub const _desc_table = .{
.scope = fd(1, .{ .SubMessage = {} }),
.profiles = fd(2, .{ .List = .{ .SubMessage = {} } }),
.schema_url = fd(3, .String),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Profile = struct {
sample_type: ArrayList(ValueType),
sample: ArrayList(Sample),
mapping_table: ArrayList(Mapping),
location_table: ArrayList(Location),
location_indices: ArrayList(i32),
function_table: ArrayList(Function),
attribute_table: ArrayList(opentelemetry_proto_common_v1.KeyValue),
attribute_units: ArrayList(AttributeUnit),
link_table: ArrayList(Link),
string_table: ArrayList(ManagedString),
time_nanos: i64 = 0,
duration_nanos: i64 = 0,
period_type: ?ValueType = null,
period: i64 = 0,
comment_strindices: ArrayList(i32),
default_sample_type_index: i32 = 0,
profile_id: ManagedString = .Empty,
dropped_attributes_count: u32 = 0,
original_payload_format: ManagedString = .Empty,
original_payload: ManagedString = .Empty,
attribute_indices: ArrayList(i32),
pub const _desc_table = .{
.sample_type = fd(1, .{ .List = .{ .SubMessage = {} } }),
.sample = fd(2, .{ .List = .{ .SubMessage = {} } }),
.mapping_table = fd(3, .{ .List = .{ .SubMessage = {} } }),
.location_table = fd(4, .{ .List = .{ .SubMessage = {} } }),
.location_indices = fd(5, .{ .PackedList = .{ .Varint = .Simple } }),
.function_table = fd(6, .{ .List = .{ .SubMessage = {} } }),
.attribute_table = fd(7, .{ .List = .{ .SubMessage = {} } }),
.attribute_units = fd(8, .{ .List = .{ .SubMessage = {} } }),
.link_table = fd(9, .{ .List = .{ .SubMessage = {} } }),
.string_table = fd(10, .{ .List = .String }),
.time_nanos = fd(11, .{ .Varint = .Simple }),
.duration_nanos = fd(12, .{ .Varint = .Simple }),
.period_type = fd(13, .{ .SubMessage = {} }),
.period = fd(14, .{ .Varint = .Simple }),
.comment_strindices = fd(15, .{ .PackedList = .{ .Varint = .Simple } }),
.default_sample_type_index = fd(16, .{ .Varint = .Simple }),
.profile_id = fd(17, .Bytes),
.dropped_attributes_count = fd(19, .{ .Varint = .Simple }),
.original_payload_format = fd(20, .String),
.original_payload = fd(21, .Bytes),
.attribute_indices = fd(22, .{ .PackedList = .{ .Varint = .Simple } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const AttributeUnit = struct {
attribute_key_strindex: i32 = 0,
unit_strindex: i32 = 0,
pub const _desc_table = .{
.attribute_key_strindex = fd(1, .{ .Varint = .Simple }),
.unit_strindex = fd(2, .{ .Varint = .Simple }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Link = struct {
trace_id: ManagedString = .Empty,
span_id: ManagedString = .Empty,
pub const _desc_table = .{
.trace_id = fd(1, .Bytes),
.span_id = fd(2, .Bytes),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ValueType = struct {
type_strindex: i32 = 0,
unit_strindex: i32 = 0,
aggregation_temporality: AggregationTemporality = @enumFromInt(0),
pub const _desc_table = .{
.type_strindex = fd(1, .{ .Varint = .Simple }),
.unit_strindex = fd(2, .{ .Varint = .Simple }),
.aggregation_temporality = fd(3, .{ .Varint = .Simple }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Sample = struct {
locations_start_index: i32 = 0,
locations_length: i32 = 0,
value: ArrayList(i64),
attribute_indices: ArrayList(i32),
link_index: ?i32 = null,
timestamps_unix_nano: ArrayList(u64),
pub const _desc_table = .{
.locations_start_index = fd(1, .{ .Varint = .Simple }),
.locations_length = fd(2, .{ .Varint = .Simple }),
.value = fd(3, .{ .PackedList = .{ .Varint = .Simple } }),
.attribute_indices = fd(4, .{ .PackedList = .{ .Varint = .Simple } }),
.link_index = fd(5, .{ .Varint = .Simple }),
.timestamps_unix_nano = fd(6, .{ .PackedList = .{ .Varint = .Simple } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Mapping = struct {
memory_start: u64 = 0,
memory_limit: u64 = 0,
file_offset: u64 = 0,
filename_strindex: i32 = 0,
attribute_indices: ArrayList(i32),
has_functions: bool = false,
has_filenames: bool = false,
has_line_numbers: bool = false,
has_inline_frames: bool = false,
pub const _desc_table = .{
.memory_start = fd(1, .{ .Varint = .Simple }),
.memory_limit = fd(2, .{ .Varint = .Simple }),
.file_offset = fd(3, .{ .Varint = .Simple }),
.filename_strindex = fd(4, .{ .Varint = .Simple }),
.attribute_indices = fd(5, .{ .PackedList = .{ .Varint = .Simple } }),
.has_functions = fd(6, .{ .Varint = .Simple }),
.has_filenames = fd(7, .{ .Varint = .Simple }),
.has_line_numbers = fd(8, .{ .Varint = .Simple }),
.has_inline_frames = fd(9, .{ .Varint = .Simple }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Location = struct {
mapping_index: ?i32 = null,
address: u64 = 0,
line: ArrayList(Line),
is_folded: bool = false,
attribute_indices: ArrayList(i32),
pub const _desc_table = .{
.mapping_index = fd(1, .{ .Varint = .Simple }),
.address = fd(2, .{ .Varint = .Simple }),
.line = fd(3, .{ .List = .{ .SubMessage = {} } }),
.is_folded = fd(4, .{ .Varint = .Simple }),
.attribute_indices = fd(5, .{ .PackedList = .{ .Varint = .Simple } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Line = struct {
function_index: i32 = 0,
line: i64 = 0,
column: i64 = 0,
pub const _desc_table = .{
.function_index = fd(1, .{ .Varint = .Simple }),
.line = fd(2, .{ .Varint = .Simple }),
.column = fd(3, .{ .Varint = .Simple }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Function = struct {
name_strindex: i32 = 0,
system_name_strindex: i32 = 0,
filename_strindex: i32 = 0,
start_line: i64 = 0,
pub const _desc_table = .{
.name_strindex = fd(1, .{ .Varint = .Simple }),
.system_name_strindex = fd(2, .{ .Varint = .Simple }),
.filename_strindex = fd(3, .{ .Varint = .Simple }),
.start_line = fd(4, .{ .Varint = .Simple }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};

View File

@@ -0,0 +1,26 @@
// 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),
dropped_attributes_count: u32 = 0,
entity_refs: ArrayList(opentelemetry_proto_common_v1.EntityRef),
pub const _desc_table = .{
.attributes = fd(1, .{ .List = .{ .SubMessage = {} } }),
.dropped_attributes_count = fd(2, .{ .Varint = .Simple }),
.entity_refs = fd(3, .{ .List = .{ .SubMessage = {} } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};

View File

@@ -0,0 +1,165 @@
// 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
const opentelemetry_proto_resource_v1 = @import("../resource/v1.pb.zig");
pub const SpanFlags = enum(i32) {
SPAN_FLAGS_DO_NOT_USE = 0,
SPAN_FLAGS_TRACE_FLAGS_MASK = 255,
SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK = 256,
SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK = 512,
_,
};
pub const TracesData = struct {
resource_spans: ArrayList(ResourceSpans),
pub const _desc_table = .{
.resource_spans = fd(1, .{ .List = .{ .SubMessage = {} } }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ResourceSpans = struct {
resource: ?opentelemetry_proto_resource_v1.Resource = null,
scope_spans: ArrayList(ScopeSpans),
schema_url: ManagedString = .Empty,
pub const _desc_table = .{
.resource = fd(1, .{ .SubMessage = {} }),
.scope_spans = fd(2, .{ .List = .{ .SubMessage = {} } }),
.schema_url = fd(3, .String),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const ScopeSpans = struct {
scope: ?opentelemetry_proto_common_v1.InstrumentationScope = null,
spans: ArrayList(Span),
schema_url: ManagedString = .Empty,
pub const _desc_table = .{
.scope = fd(1, .{ .SubMessage = {} }),
.spans = fd(2, .{ .List = .{ .SubMessage = {} } }),
.schema_url = fd(3, .String),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Span = struct {
trace_id: ManagedString = .Empty,
span_id: ManagedString = .Empty,
trace_state: ManagedString = .Empty,
parent_span_id: ManagedString = .Empty,
flags: u32 = 0,
name: ManagedString = .Empty,
kind: SpanKind = @enumFromInt(0),
start_time_unix_nano: u64 = 0,
end_time_unix_nano: u64 = 0,
attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue),
dropped_attributes_count: u32 = 0,
events: ArrayList(Event),
dropped_events_count: u32 = 0,
links: ArrayList(Link),
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 = {} }),
};
pub const SpanKind = enum(i32) {
SPAN_KIND_UNSPECIFIED = 0,
SPAN_KIND_INTERNAL = 1,
SPAN_KIND_SERVER = 2,
SPAN_KIND_CLIENT = 3,
SPAN_KIND_PRODUCER = 4,
SPAN_KIND_CONSUMER = 5,
_,
};
pub const Event = struct {
time_unix_nano: u64 = 0,
name: ManagedString = .Empty,
attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue),
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 }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Link = struct {
trace_id: ManagedString = .Empty,
span_id: ManagedString = .Empty,
trace_state: ManagedString = .Empty,
attributes: ArrayList(opentelemetry_proto_common_v1.KeyValue),
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 }),
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub usingnamespace protobuf.MessageMixins(@This());
};
pub const Status = struct {
message: ManagedString = .Empty,
code: StatusCode = @enumFromInt(0),
pub const _desc_table = .{
.message = fd(2, .String),
.code = fd(3, .{ .Varint = .Simple }),
};
pub const StatusCode = enum(i32) {
STATUS_CODE_UNSET = 0,
STATUS_CODE_OK = 1,
STATUS_CODE_ERROR = 2,
_,
};
pub usingnamespace protobuf.MessageMixins(@This());
};