@@ -4,6 +4,24 @@ pub const Tracer = @import("trace/tracer.zig").Tracer;
4
4
pub const TracerProvider = @import ("trace/provider.zig" ).TracerProvider ;
5
5
pub const TracerConfig = @import ("trace/config.zig" ).TracerConfig ;
6
6
7
+ const span = @import ("trace/span.zig" );
8
+ pub const Span = span .Span ;
9
+ pub const SpanKind = span .SpanKind ;
10
+ pub const Status = span .Status ;
11
+ pub const Event = @import ("trace/event.zig" ).Event ;
12
+ pub const Code = @import ("trace/code.zig" ).Code ;
13
+ pub const Link = @import ("trace/link.zig" ).Link ;
14
+
15
+ test {
16
+ _ = @import ("trace/code.zig" );
17
+ _ = @import ("trace/config.zig" );
18
+ _ = @import ("trace/event.zig" );
19
+ _ = @import ("trace/link.zig" );
20
+ _ = @import ("trace/provider.zig" );
21
+ _ = @import ("trace/span.zig" );
22
+ _ = @import ("trace/tracer.zig" );
23
+ }
24
+
7
25
pub const TraceID = struct {
8
26
value : [16 ]u8 ,
9
27
@@ -15,6 +33,27 @@ pub const TraceID = struct {
15
33
};
16
34
}
17
35
36
+ pub fn zero () Self {
37
+ return init ([16 ]u8 {
38
+ 0 ,
39
+ 0 ,
40
+ 0 ,
41
+ 0 ,
42
+ 0 ,
43
+ 0 ,
44
+ 0 ,
45
+ 0 ,
46
+ 0 ,
47
+ 0 ,
48
+ 0 ,
49
+ 0 ,
50
+ 0 ,
51
+ 0 ,
52
+ 0 ,
53
+ 0 ,
54
+ });
55
+ }
56
+
18
57
pub fn isValid (self : Self ) bool {
19
58
for (self .value ) | item | {
20
59
if (item != 0 ) {
@@ -37,6 +76,10 @@ pub const SpanID = struct {
37
76
};
38
77
}
39
78
79
+ pub fn zero () Self {
80
+ return init ([8 ]u8 { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 });
81
+ }
82
+
40
83
pub fn isValid (self : Self ) bool {
41
84
for (self .value ) | item | {
42
85
if (item != 0 ) {
@@ -48,12 +91,6 @@ pub const SpanID = struct {
48
91
}
49
92
};
50
93
51
- test {
52
- _ = @import ("trace/config.zig" );
53
- _ = @import ("trace/provider.zig" );
54
- _ = @import ("trace/tracer.zig" );
55
- }
56
-
57
94
test "TraceID isValid" {
58
95
try std .testing .expect (TraceID .init ([16 ]u8 { 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }).isValid ());
59
96
try std .testing .expect (! TraceID .init ([16 ]u8 { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }).isValid ());
0 commit comments