Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions static-exporter/main.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ local k = import 'ksonnet-util/kausal.libsonnet';
function(acc, metric)
acc + [
'# HELP %(name)s %(description)s' % metric,
'# TYPE %(name)s counter' % metric,
'# TYPE %(name)s %(type)s' % metric,
] + [
metric.name + value
for value in metric.values
Expand Down Expand Up @@ -73,15 +73,18 @@ local k = import 'ksonnet-util/kausal.libsonnet';
},

metric:: {
new(name, description)::
new(name, description, type='counter')::
self.withName(name)
+ self.withDescription(description),
+ self.withDescription(description)
+ self.withMetricType(type),

withName(name): { name: name },

withDescription(description): { description: description },

local generateValues(labelMap, value=1, valueAsFloat=false) =
withMetricType(type): { type: type },

local generateValues(labelMap, value=1) =
local labels = [
key + '="' + labelMap[key] + '"'
for key in std.objectFields(labelMap)
Expand Down
Loading