Prometheus metrics for library and application developers
0

Configure Feed

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

make Impl methods public

Karl Seguin (Feb 27, 2024, 9:04 AM +0800) dcdffa67 53a658a7

+10 -10
+4 -4
src/counter.zig
··· 50 50 count: V, 51 51 preamble: []const u8, 52 52 53 - fn init(comptime name: []const u8, comptime opts: Opts) Impl { 53 + pub fn init(comptime name: []const u8, comptime opts: Opts) Impl { 54 54 return .{ 55 55 .count = 0, 56 56 .preamble = comptime m.preamble(name, .counter, true, opts.help), ··· 133 133 lock: std.Thread.RwLock, 134 134 values: MetricVec(L).HashMap(Value), 135 135 136 - const Value = struct { 136 + pub const Value = struct { 137 137 count: V, 138 138 attributes: []const u8, 139 139 }; 140 140 141 - fn init(allocator: Allocator, comptime name: []const u8, comptime opts: Opts) !Impl { 141 + pub fn init(allocator: Allocator, comptime name: []const u8, comptime opts: Opts) !Impl { 142 142 return .{ 143 143 .lock = .{}, 144 144 .allocator = allocator, ··· 148 148 }; 149 149 } 150 150 151 - fn deinit(self: *Impl) void { 151 + pub fn deinit(self: *Impl) void { 152 152 const allocator = self.allocator; 153 153 154 154 var it = self.values.iterator();
+3 -3
src/gauge.zig
··· 58 58 value: V, 59 59 preamble: []const u8, 60 60 61 - fn init(comptime name: []const u8, comptime opts: Opts) Impl { 61 + pub fn init(comptime name: []const u8, comptime opts: Opts) Impl { 62 62 return .{ 63 63 .value = 0, 64 64 .preamble = comptime m.preamble(name, .gauge, true, opts.help), ··· 156 156 attributes: []const u8, 157 157 }; 158 158 159 - fn init(allocator: Allocator, comptime name: []const u8, comptime opts: Opts) !Impl { 159 + pub fn init(allocator: Allocator, comptime name: []const u8, comptime opts: Opts) !Impl { 160 160 return .{ 161 161 .lock = .{}, 162 162 .allocator = allocator, ··· 166 166 }; 167 167 } 168 168 169 - fn deinit(self: *Impl) void { 169 + pub fn deinit(self: *Impl) void { 170 170 const allocator = self.allocator; 171 171 172 172 var it = self.values.iterator();
+3 -3
src/histogram.zig
··· 52 52 output_bucket_prefixes: [upper_bounds.len][]const u8, 53 53 output_bucket_inf_prefix: []const u8, 54 54 55 - fn init(comptime name: []const u8, comptime opts: Opts) Impl { 55 + pub fn init(comptime name: []const u8, comptime opts: Opts) Impl { 56 56 comptime { 57 57 const output_sum_prefix = std.fmt.comptimePrint("\n{s}_sum ", .{name}); 58 58 const output_count_prefix = std.fmt.comptimePrint("\n{s}_count ", .{name}); ··· 217 217 } 218 218 }; 219 219 220 - fn init(allocator: Allocator, comptime name: []const u8, comptime opts: Opts) !Impl { 220 + pub fn init(allocator: Allocator, comptime name: []const u8, comptime opts: Opts) !Impl { 221 221 const vec = try MetricVec(L).init(name); 222 222 223 223 const output_sum_prefix = try std.fmt.allocPrint(allocator, "\n{s}_sum", .{name}); ··· 255 255 }; 256 256 } 257 257 258 - fn deinit(self: *Impl) void { 258 + pub fn deinit(self: *Impl) void { 259 259 const allocator = self.allocator; 260 260 allocator.free(self.output_sum_prefix); 261 261 allocator.free(self.output_count_prefix);