Prometheus metrics for library and application developers
0

Configure Feed

Select the types of activity you want to include in your feed.

accomodate zig changes

Karl Seguin (Mar 13, 2024, 8:31 AM +0800) 1cdd65d5 ea59b90b

+12 -12
+3 -3
src/counter.zig
··· 62 62 } 63 63 64 64 pub fn incrBy(self: *Impl, count: V) void { 65 - _ = @atomicRmw(V, &self.count, .Add, count, .Monotonic); 65 + _ = @atomicRmw(V, &self.count, .Add, count, .monotonic); 66 66 } 67 67 68 68 pub fn write(self: *const Impl, writer: anytype) !void { 69 69 try writer.writeAll(self.preamble); 70 - const count = @atomicLoad(V, &self.count, .Monotonic); 70 + const count = @atomicLoad(V, &self.count, .monotonic); 71 71 try m.write(count, writer); 72 72 return writer.writeByte('\n'); 73 73 } ··· 170 170 self.lock.lockShared(); 171 171 defer self.lock.unlockShared(); 172 172 if (self.values.getPtr(labels)) |existing| { 173 - _ = @atomicRmw(V, &existing.count, .Add, count, .Monotonic); 173 + _ = @atomicRmw(V, &existing.count, .Add, count, .monotonic); 174 174 return; 175 175 } 176 176 }
+3 -3
src/gauge.zig
··· 70 70 } 71 71 72 72 pub fn incrBy(self: *Impl, value: V) void { 73 - _ = @atomicRmw(V, &self.value, .Add, value, .Monotonic); 73 + _ = @atomicRmw(V, &self.value, .Add, value, .monotonic); 74 74 } 75 75 76 76 pub fn set(self: *Impl, value: V) void { 77 - @atomicStore(V, &self.value, value, .Monotonic); 77 + @atomicStore(V, &self.value, value, .monotonic); 78 78 } 79 79 80 80 pub fn write(self: *const Impl, writer: anytype) !void { 81 81 try writer.writeAll(self.preamble); 82 - try m.write(@atomicLoad(V, &self.value, .Monotonic), writer); 82 + try m.write(@atomicLoad(V, &self.value, .monotonic), writer); 83 83 return writer.writeByte('\n'); 84 84 } 85 85 };
+6 -6
src/histogram.zig
··· 78 78 } 79 79 80 80 pub fn observe(self: *Impl, value: V) void { 81 - _ = @atomicRmw(usize, &self.count, .Add, 1, .Monotonic); 82 - _ = @atomicRmw(V, &self.sum, .Add, value, .Monotonic); 81 + _ = @atomicRmw(usize, &self.count, .Add, 1, .monotonic); 82 + _ = @atomicRmw(V, &self.sum, .Add, value, .monotonic); 83 83 84 84 const idx = blk: { 85 85 for (upper_bounds, 0..) |upper, i| { ··· 92 92 return; 93 93 }; 94 94 95 - _ = @atomicRmw(V, &self.buckets[idx], .Add, 1, .Monotonic); 95 + _ = @atomicRmw(V, &self.buckets[idx], .Add, 1, .monotonic); 96 96 } 97 97 98 98 pub fn write(self: *Impl, writer: anytype) !void { ··· 100 100 101 101 var sum: V = 0; 102 102 for (self.output_bucket_prefixes, 0..) |prefix, i| { 103 - sum += @atomicRmw(V, &self.buckets[i], .Xchg, 0, .Monotonic); 103 + sum += @atomicRmw(V, &self.buckets[i], .Xchg, 0, .monotonic); 104 104 try writer.writeAll(prefix); 105 105 try m.write(sum, writer); 106 106 try writer.writeByte('\n'); 107 107 } 108 108 109 - const total_count = @atomicRmw(usize, &self.count, .Xchg, 0, .Monotonic); 109 + const total_count = @atomicRmw(usize, &self.count, .Xchg, 0, .monotonic); 110 110 { 111 111 // write +Inf 112 112 try writer.writeAll(self.output_bucket_inf_prefix); ··· 118 118 // this includes a leading newline, hence we didn't need to write 119 119 // it after our output_bucket_inf_prefix 120 120 try writer.writeAll(self.output_sum_prefix); 121 - try m.write(@atomicRmw(V, &self.sum, .Xchg, 0, .Monotonic), writer); 121 + try m.write(@atomicRmw(V, &self.sum, .Xchg, 0, .monotonic), writer); 122 122 } 123 123 124 124 {