From 1eb9728c7920760b1e2f032182b758d9aac2c41c Mon Sep 17 00:00:00 2001 From: sh0rez Date: Fri, 6 Jun 2025 11:17:57 +0200 Subject: [PATCH 1/7] *: semconv --- internal/metrics/dns/attributes.go | 237 +++++++++++++ internal/metrics/generate.go | 4 + .../probe/metric_probe_dns_additional_rrs.go | 268 +++++++++++++++ .../probe/metric_probe_dns_answer_rrs.go | 268 +++++++++++++++ .../probe/metric_probe_dns_authority_rrs.go | 268 +++++++++++++++ .../metric_probe_dns_duration_seconds.go | 314 ++++++++++++++++++ .../probe/metric_probe_dns_query_succeeded.go | 268 +++++++++++++++ prober/dns.go | 38 +-- semconv/dns/metrics.yaml | 44 +++ semconv/dns/registry.yaml | 11 + 10 files changed, 1695 insertions(+), 25 deletions(-) create mode 100644 internal/metrics/dns/attributes.go create mode 100644 internal/metrics/generate.go create mode 100644 internal/metrics/probe/metric_probe_dns_additional_rrs.go create mode 100644 internal/metrics/probe/metric_probe_dns_answer_rrs.go create mode 100644 internal/metrics/probe/metric_probe_dns_authority_rrs.go create mode 100644 internal/metrics/probe/metric_probe_dns_duration_seconds.go create mode 100644 internal/metrics/probe/metric_probe_dns_query_succeeded.go create mode 100644 semconv/dns/metrics.yaml create mode 100644 semconv/dns/registry.yaml diff --git a/internal/metrics/dns/attributes.go b/internal/metrics/dns/attributes.go new file mode 100644 index 00000000..a12a2034 --- /dev/null +++ b/internal/metrics/dns/attributes.go @@ -0,0 +1,237 @@ +package dns + +// DNS phase +type AttrPhase string // dns._phase_ + +func (AttrPhase) Stable() {} +func (AttrPhase) Recommended() {} +func (AttrPhase) Key() string { return "phase" } +func (a AttrPhase) Value() string { return string(a) } + +const PhaseResolve AttrPhase = "resolve" +const PhaseConnect AttrPhase = "connect" +const PhaseRequest AttrPhase = "request" + +/* State { + name: "attr.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "ctx": { + "attributes": [ + { + "brief": "DNS phase", + "examples": [ + "resolve", + "connect", + "request", + ], + "name": "dns._phase_", + "requirement_level": "recommended", + "root_namespace": "dns", + "stability": "stable", + "type": "string", + }, + ], + "root_namespace": "dns", + }, + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "attr.go.j2", + ], + }, +} */ diff --git a/internal/metrics/generate.go b/internal/metrics/generate.go new file mode 100644 index 00000000..c83d309c --- /dev/null +++ b/internal/metrics/generate.go @@ -0,0 +1,4 @@ +package metrics + +//go:generate weaver registry generate --registry=../../semconv --templates=/home/tbraack/work/promconv/templates --param module=github.com/prometheus/blackbox_exporter/internal/metrics go . +//go:generate gofmt -s -w . diff --git a/internal/metrics/probe/metric_probe_dns_additional_rrs.go b/internal/metrics/probe/metric_probe_dns_additional_rrs.go new file mode 100644 index 00000000..fa1fb1a7 --- /dev/null +++ b/internal/metrics/probe/metric_probe_dns_additional_rrs.go @@ -0,0 +1,268 @@ +package probe + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Returns number of entries in the additional resource record list +type DnsAdditionalRrs struct { + *prometheus.GaugeVec + extra DnsAdditionalRrsExtra +} + +func NewDnsAdditionalRrs() DnsAdditionalRrs { + labels := []string{} + return DnsAdditionalRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "probe", + Name: "dns_additional_rrs", + Help: "Returns number of entries in the additional resource record list", + }, labels)} +} + +func (m DnsAdditionalRrs) With(extras ...interface { +}) prometheus.Gauge { + return m.WithLabelValues() +} + +type DnsAdditionalRrsExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "DnsAdditionalRrsExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "dns_additional_rrs", + "Type": "DnsAdditionalRrs", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "Returns number of entries in the additional resource record list", + "events": [], + "id": "metric.probe.dns.additional.rrs", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/dns/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_dns_additional_rrs", + "name": none, + "root_namespace": "probe", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/probe/metric_probe_dns_answer_rrs.go b/internal/metrics/probe/metric_probe_dns_answer_rrs.go new file mode 100644 index 00000000..c35d450e --- /dev/null +++ b/internal/metrics/probe/metric_probe_dns_answer_rrs.go @@ -0,0 +1,268 @@ +package probe + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Returns number of entries in the answer resource record list +type DnsAnswerRrs struct { + *prometheus.GaugeVec + extra DnsAnswerRrsExtra +} + +func NewDnsAnswerRrs() DnsAnswerRrs { + labels := []string{} + return DnsAnswerRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "probe", + Name: "dns_answer_rrs", + Help: "Returns number of entries in the answer resource record list", + }, labels)} +} + +func (m DnsAnswerRrs) With(extras ...interface { +}) prometheus.Gauge { + return m.WithLabelValues() +} + +type DnsAnswerRrsExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "DnsAnswerRrsExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "dns_answer_rrs", + "Type": "DnsAnswerRrs", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "Returns number of entries in the answer resource record list", + "events": [], + "id": "metric.probe.dns.answer.rrs", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/dns/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_dns_answer_rrs", + "name": none, + "root_namespace": "probe", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/probe/metric_probe_dns_authority_rrs.go b/internal/metrics/probe/metric_probe_dns_authority_rrs.go new file mode 100644 index 00000000..445ea489 --- /dev/null +++ b/internal/metrics/probe/metric_probe_dns_authority_rrs.go @@ -0,0 +1,268 @@ +package probe + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Returns number of entries in the authority resource record list +type DnsAuthorityRrs struct { + *prometheus.GaugeVec + extra DnsAuthorityRrsExtra +} + +func NewDnsAuthorityRrs() DnsAuthorityRrs { + labels := []string{} + return DnsAuthorityRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "probe", + Name: "dns_authority_rrs", + Help: "Returns number of entries in the authority resource record list", + }, labels)} +} + +func (m DnsAuthorityRrs) With(extras ...interface { +}) prometheus.Gauge { + return m.WithLabelValues() +} + +type DnsAuthorityRrsExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "DnsAuthorityRrsExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "dns_authority_rrs", + "Type": "DnsAuthorityRrs", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "Returns number of entries in the authority resource record list", + "events": [], + "id": "metric.probe.dns.authority.rrs", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/dns/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_dns_authority_rrs", + "name": none, + "root_namespace": "probe", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/probe/metric_probe_dns_duration_seconds.go b/internal/metrics/probe/metric_probe_dns_duration_seconds.go new file mode 100644 index 00000000..44a90588 --- /dev/null +++ b/internal/metrics/probe/metric_probe_dns_duration_seconds.go @@ -0,0 +1,314 @@ +package probe + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +import ( + "github.com/prometheus/blackbox_exporter/internal/metrics/dns" +) + +// Duration of DNS request by phase +type DnsDurationSeconds struct { + *prometheus.GaugeVec + extra DnsDurationSecondsExtra +} + +func NewDnsDurationSeconds() DnsDurationSeconds { + labels := []string{dns.AttrPhase("").Key()} + return DnsDurationSeconds{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "probe", + Name: "dns_duration_seconds", + Help: "Duration of DNS request by phase", + }, labels)} +} + +func (m DnsDurationSeconds) With(phase dns.AttrPhase, extras ...interface { +}) prometheus.Gauge { + return m.WithLabelValues( + string(phase), + ) +} + +type DnsDurationSecondsExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "DnsDurationSecondsExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "dns_duration_seconds", + "Type": "DnsDurationSeconds", + "attributes": [ + { + "brief": "DNS phase", + "examples": [ + "resolve", + "connect", + "request", + ], + "name": "dns._phase_", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + ], + "ctx": { + "attributes": [ + { + "brief": "DNS phase", + "examples": [ + "resolve", + "connect", + "request", + ], + "name": "dns._phase_", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + ], + "brief": "Duration of DNS request by phase", + "events": [], + "id": "metric.probe.dns.duration.seconds", + "instrument": "gauge", + "lineage": { + "attributes": { + "dns._phase_": { + "inherited_fields": [ + "brief", + "examples", + "note", + "stability", + ], + "locally_overridden_fields": [ + "requirement_level", + ], + "source_group": "registry.dns", + }, + }, + "provenance": { + "path": "../../semconv/dns/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_dns_duration_seconds", + "name": none, + "root_namespace": "probe", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "s", + }, + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/probe/metric_probe_dns_query_succeeded.go b/internal/metrics/probe/metric_probe_dns_query_succeeded.go new file mode 100644 index 00000000..03fb43f9 --- /dev/null +++ b/internal/metrics/probe/metric_probe_dns_query_succeeded.go @@ -0,0 +1,268 @@ +package probe + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Displays whether or not the query was executed successfully +type DnsQuerySucceeded struct { + *prometheus.GaugeVec + extra DnsQuerySucceededExtra +} + +func NewDnsQuerySucceeded() DnsQuerySucceeded { + labels := []string{} + return DnsQuerySucceeded{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "probe", + Name: "dns_query_succeeded", + Help: "Displays whether or not the query was executed successfully", + }, labels)} +} + +func (m DnsQuerySucceeded) With(extras ...interface { +}) prometheus.Gauge { + return m.WithLabelValues() +} + +type DnsQuerySucceededExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "DnsQuerySucceededExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "dns_query_succeeded", + "Type": "DnsQuerySucceeded", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "Displays whether or not the query was executed successfully", + "events": [], + "id": "metric.probe.dns.query.succeeded", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/dns/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_dns_query_succeeded", + "name": none, + "root_namespace": "probe", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/prober/dns.go b/prober/dns.go index 3d301b9b..7afe2e11 100644 --- a/prober/dns.go +++ b/prober/dns.go @@ -25,6 +25,9 @@ import ( pconfig "github.com/prometheus/common/config" "github.com/prometheus/blackbox_exporter/config" + + dnsm "github.com/prometheus/blackbox_exporter/internal/metrics/dns" + metrics "github.com/prometheus/blackbox_exporter/internal/metrics/probe" ) // validRRs checks a slice of RRs received from the server against a DNSRRValidator. @@ -125,29 +128,14 @@ func validRcode(rcode int, valid []string, logger *slog.Logger) bool { func ProbeDNS(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger *slog.Logger) bool { var dialProtocol string - probeDNSDurationGaugeVec := prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Name: "probe_dns_duration_seconds", - Help: "Duration of DNS request by phase", - }, []string{"phase"}) - probeDNSAnswerRRSGauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_dns_answer_rrs", - Help: "Returns number of entries in the answer resource record list", - }) - probeDNSAuthorityRRSGauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_dns_authority_rrs", - Help: "Returns number of entries in the authority resource record list", - }) - probeDNSAdditionalRRSGauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_dns_additional_rrs", - Help: "Returns number of entries in the additional resource record list", - }) - probeDNSQuerySucceeded := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_dns_query_succeeded", - Help: "Displays whether or not the query was executed successfully", - }) - for _, lv := range []string{"resolve", "connect", "request"} { - probeDNSDurationGaugeVec.WithLabelValues(lv) + probeDNSDurationGaugeVec := metrics.NewDnsDurationSeconds() + probeDNSAnswerRRSGauge := metrics.NewDnsAnswerRrs().With() + probeDNSAuthorityRRSGauge := metrics.NewDnsAuthorityRrs().With() + probeDNSAdditionalRRSGauge := metrics.NewDnsAdditionalRrs().With() + probeDNSQuerySucceeded := metrics.NewDnsQuerySucceeded().With() + for _, lv := range []dnsm.AttrPhase{dnsm.PhaseResolve, dnsm.PhaseConnect, dnsm.PhaseRequest} { + probeDNSDurationGaugeVec.With(lv) } registry.MustRegister(probeDNSDurationGaugeVec) @@ -201,7 +189,7 @@ func ProbeDNS(ctx context.Context, target string, module config.Module, registry logger.Error("Error resolving address", "err", err) return false } - probeDNSDurationGaugeVec.WithLabelValues("resolve").Add(lookupTime) + probeDNSDurationGaugeVec.With(dnsm.PhaseResolve).Add(lookupTime) targetIP := net.JoinHostPort(ip.String(), port) if ip.IP.To4() == nil { @@ -267,8 +255,8 @@ func ProbeDNS(ctx context.Context, target string, module config.Module, registry // exchange messages with the server _after_ the connection is created. // We compute the connection time as the total time for the operation // minus the time for the actual request rtt. - probeDNSDurationGaugeVec.WithLabelValues("connect").Set((time.Since(requestStart) - rtt).Seconds()) - probeDNSDurationGaugeVec.WithLabelValues("request").Set(rtt.Seconds()) + probeDNSDurationGaugeVec.With(dnsm.PhaseConnect).Set((time.Since(requestStart) - rtt).Seconds()) + probeDNSDurationGaugeVec.With(dnsm.PhaseRequest).Set(rtt.Seconds()) if err != nil { logger.Error("Error while sending a DNS query", "err", err) return false diff --git a/semconv/dns/metrics.yaml b/semconv/dns/metrics.yaml new file mode 100644 index 00000000..2d780fb7 --- /dev/null +++ b/semconv/dns/metrics.yaml @@ -0,0 +1,44 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json +groups: + - id: metric.probe.dns.duration.seconds + type: metric + metric_name: probe_dns_duration_seconds + brief: "Duration of DNS request by phase" + instrument: "gauge" + unit: "s" + attributes: + - ref: dns._phase_ + requirement_level: required + stability: stable + + - id: metric.probe.dns.answer.rrs + type: metric + metric_name: probe_dns_answer_rrs + brief: "Returns number of entries in the answer resource record list" + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.probe.dns.authority.rrs + type: metric + metric_name: probe_dns_authority_rrs + brief: "Returns number of entries in the authority resource record list" + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.probe.dns.additional.rrs + type: metric + metric_name: probe_dns_additional_rrs + brief: "Returns number of entries in the additional resource record list" + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.probe.dns.query.succeeded + type: metric + metric_name: probe_dns_query_succeeded + brief: "Displays whether or not the query was executed successfully" + instrument: "gauge" + unit: "1" + stability: stable diff --git a/semconv/dns/registry.yaml b/semconv/dns/registry.yaml new file mode 100644 index 00000000..d126aa75 --- /dev/null +++ b/semconv/dns/registry.yaml @@ -0,0 +1,11 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json +groups: + - id: registry.dns + type: attribute_group + brief: DNS attributes + attributes: + - id: dns._phase_ + type: string + stability: stable + brief: "DNS phase" + examples: ["resolve", "connect", "request"] From 4a37b65b58302d32fd2edd98280717d15d3242da Mon Sep 17 00:00:00 2001 From: sh0rez Date: Fri, 6 Jun 2025 14:43:31 +0200 Subject: [PATCH 2/7] *: unqualified probe label represents "probe" label as it really is, with no prefix --- .../metric_dns_probe_additional_rrs.go} | 38 ++++++++------ .../metric_dns_probe_answer_rrs.go} | 38 ++++++++------ .../metric_dns_probe_authority_rrs.go} | 38 ++++++++------ .../metric_dns_probe_duration_seconds.go} | 50 ++++++++++--------- .../metric_dns_probe_query_succeeded.go} | 38 ++++++++------ internal/metrics/{dns => other}/attributes.go | 11 ++-- prober/dns.go | 22 ++++---- semconv/dns/metrics.yaml | 12 ++--- semconv/dns/registry.yaml | 2 +- 9 files changed, 139 insertions(+), 110 deletions(-) rename internal/metrics/{probe/metric_probe_dns_additional_rrs.go => dns/metric_dns_probe_additional_rrs.go} (88%) rename internal/metrics/{probe/metric_probe_dns_answer_rrs.go => dns/metric_dns_probe_answer_rrs.go} (88%) rename internal/metrics/{probe/metric_probe_dns_authority_rrs.go => dns/metric_dns_probe_authority_rrs.go} (88%) rename internal/metrics/{probe/metric_probe_dns_duration_seconds.go => dns/metric_dns_probe_duration_seconds.go} (86%) rename internal/metrics/{probe/metric_probe_dns_query_succeeded.go => dns/metric_dns_probe_query_succeeded.go} (87%) rename internal/metrics/{dns => other}/attributes.go (96%) diff --git a/internal/metrics/probe/metric_probe_dns_additional_rrs.go b/internal/metrics/dns/metric_dns_probe_additional_rrs.go similarity index 88% rename from internal/metrics/probe/metric_probe_dns_additional_rrs.go rename to internal/metrics/dns/metric_dns_probe_additional_rrs.go index fa1fb1a7..0687d54a 100644 --- a/internal/metrics/probe/metric_probe_dns_additional_rrs.go +++ b/internal/metrics/dns/metric_dns_probe_additional_rrs.go @@ -1,30 +1,34 @@ -package probe +package dns import ( "github.com/prometheus/client_golang/prometheus" ) // Returns number of entries in the additional resource record list -type DnsAdditionalRrs struct { +type ProbeAdditionalRrs struct { *prometheus.GaugeVec - extra DnsAdditionalRrsExtra + extra ProbeAdditionalRrsExtra } -func NewDnsAdditionalRrs() DnsAdditionalRrs { +func NewProbeAdditionalRrs() ProbeAdditionalRrs { labels := []string{} - return DnsAdditionalRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "probe", - Name: "dns_additional_rrs", + return ProbeAdditionalRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "dns", + Name: "probe_additional_rrs", Help: "Returns number of entries in the additional resource record list", }, labels)} } -func (m DnsAdditionalRrs) With(extras ...interface { -}) prometheus.Gauge { - return m.WithLabelValues() +func (m ProbeAdditionalRrs) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() } -type DnsAdditionalRrsExtra struct { +// Deprecated: Use [ProbeAdditionalRrs.With] instead +func (m ProbeAdditionalRrs) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeAdditionalRrsExtra struct { } /* @@ -33,7 +37,7 @@ State { current_block: None, auto_escape: None, ctx: { - "AttrExtra": "DnsAdditionalRrsExtra", + "AttrExtra": "ProbeAdditionalRrsExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -41,14 +45,14 @@ State { "histogram": "Histogram", "updowncounter": "Gauge", }, - "Name": "dns_additional_rrs", - "Type": "DnsAdditionalRrs", + "Name": "probe.additional.rrs", + "Type": "ProbeAdditionalRrs", "attributes": [], "ctx": { "attributes": [], "brief": "Returns number of entries in the additional resource record list", "events": [], - "id": "metric.probe.dns.additional.rrs", + "id": "metric.dns.probe.additional.rrs", "instrument": "gauge", "lineage": { "provenance": { @@ -58,12 +62,13 @@ State { }, "metric_name": "probe_dns_additional_rrs", "name": none, - "root_namespace": "probe", + "root_namespace": "dns", "span_kind": none, "stability": "stable", "type": "metric", "unit": "1", }, + "for_each_attr": , "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { @@ -175,6 +180,7 @@ State { "ansi_white", "ansi_yellow", "attr", + "attribute_id", "attribute_namespace", "attribute_registry_file", "attribute_registry_namespace", diff --git a/internal/metrics/probe/metric_probe_dns_answer_rrs.go b/internal/metrics/dns/metric_dns_probe_answer_rrs.go similarity index 88% rename from internal/metrics/probe/metric_probe_dns_answer_rrs.go rename to internal/metrics/dns/metric_dns_probe_answer_rrs.go index c35d450e..3732da71 100644 --- a/internal/metrics/probe/metric_probe_dns_answer_rrs.go +++ b/internal/metrics/dns/metric_dns_probe_answer_rrs.go @@ -1,30 +1,34 @@ -package probe +package dns import ( "github.com/prometheus/client_golang/prometheus" ) // Returns number of entries in the answer resource record list -type DnsAnswerRrs struct { +type ProbeAnswerRrs struct { *prometheus.GaugeVec - extra DnsAnswerRrsExtra + extra ProbeAnswerRrsExtra } -func NewDnsAnswerRrs() DnsAnswerRrs { +func NewProbeAnswerRrs() ProbeAnswerRrs { labels := []string{} - return DnsAnswerRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "probe", - Name: "dns_answer_rrs", + return ProbeAnswerRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "dns", + Name: "probe_answer_rrs", Help: "Returns number of entries in the answer resource record list", }, labels)} } -func (m DnsAnswerRrs) With(extras ...interface { -}) prometheus.Gauge { - return m.WithLabelValues() +func (m ProbeAnswerRrs) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() } -type DnsAnswerRrsExtra struct { +// Deprecated: Use [ProbeAnswerRrs.With] instead +func (m ProbeAnswerRrs) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeAnswerRrsExtra struct { } /* @@ -33,7 +37,7 @@ State { current_block: None, auto_escape: None, ctx: { - "AttrExtra": "DnsAnswerRrsExtra", + "AttrExtra": "ProbeAnswerRrsExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -41,14 +45,14 @@ State { "histogram": "Histogram", "updowncounter": "Gauge", }, - "Name": "dns_answer_rrs", - "Type": "DnsAnswerRrs", + "Name": "probe.answer.rrs", + "Type": "ProbeAnswerRrs", "attributes": [], "ctx": { "attributes": [], "brief": "Returns number of entries in the answer resource record list", "events": [], - "id": "metric.probe.dns.answer.rrs", + "id": "metric.dns.probe.answer.rrs", "instrument": "gauge", "lineage": { "provenance": { @@ -58,12 +62,13 @@ State { }, "metric_name": "probe_dns_answer_rrs", "name": none, - "root_namespace": "probe", + "root_namespace": "dns", "span_kind": none, "stability": "stable", "type": "metric", "unit": "1", }, + "for_each_attr": , "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { @@ -175,6 +180,7 @@ State { "ansi_white", "ansi_yellow", "attr", + "attribute_id", "attribute_namespace", "attribute_registry_file", "attribute_registry_namespace", diff --git a/internal/metrics/probe/metric_probe_dns_authority_rrs.go b/internal/metrics/dns/metric_dns_probe_authority_rrs.go similarity index 88% rename from internal/metrics/probe/metric_probe_dns_authority_rrs.go rename to internal/metrics/dns/metric_dns_probe_authority_rrs.go index 445ea489..6b607799 100644 --- a/internal/metrics/probe/metric_probe_dns_authority_rrs.go +++ b/internal/metrics/dns/metric_dns_probe_authority_rrs.go @@ -1,30 +1,34 @@ -package probe +package dns import ( "github.com/prometheus/client_golang/prometheus" ) // Returns number of entries in the authority resource record list -type DnsAuthorityRrs struct { +type ProbeAuthorityRrs struct { *prometheus.GaugeVec - extra DnsAuthorityRrsExtra + extra ProbeAuthorityRrsExtra } -func NewDnsAuthorityRrs() DnsAuthorityRrs { +func NewProbeAuthorityRrs() ProbeAuthorityRrs { labels := []string{} - return DnsAuthorityRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "probe", - Name: "dns_authority_rrs", + return ProbeAuthorityRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "dns", + Name: "probe_authority_rrs", Help: "Returns number of entries in the authority resource record list", }, labels)} } -func (m DnsAuthorityRrs) With(extras ...interface { -}) prometheus.Gauge { - return m.WithLabelValues() +func (m ProbeAuthorityRrs) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() } -type DnsAuthorityRrsExtra struct { +// Deprecated: Use [ProbeAuthorityRrs.With] instead +func (m ProbeAuthorityRrs) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeAuthorityRrsExtra struct { } /* @@ -33,7 +37,7 @@ State { current_block: None, auto_escape: None, ctx: { - "AttrExtra": "DnsAuthorityRrsExtra", + "AttrExtra": "ProbeAuthorityRrsExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -41,14 +45,14 @@ State { "histogram": "Histogram", "updowncounter": "Gauge", }, - "Name": "dns_authority_rrs", - "Type": "DnsAuthorityRrs", + "Name": "probe.authority.rrs", + "Type": "ProbeAuthorityRrs", "attributes": [], "ctx": { "attributes": [], "brief": "Returns number of entries in the authority resource record list", "events": [], - "id": "metric.probe.dns.authority.rrs", + "id": "metric.dns.probe.authority.rrs", "instrument": "gauge", "lineage": { "provenance": { @@ -58,12 +62,13 @@ State { }, "metric_name": "probe_dns_authority_rrs", "name": none, - "root_namespace": "probe", + "root_namespace": "dns", "span_kind": none, "stability": "stable", "type": "metric", "unit": "1", }, + "for_each_attr": , "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { @@ -175,6 +180,7 @@ State { "ansi_white", "ansi_yellow", "attr", + "attribute_id", "attribute_namespace", "attribute_registry_file", "attribute_registry_namespace", diff --git a/internal/metrics/probe/metric_probe_dns_duration_seconds.go b/internal/metrics/dns/metric_dns_probe_duration_seconds.go similarity index 86% rename from internal/metrics/probe/metric_probe_dns_duration_seconds.go rename to internal/metrics/dns/metric_dns_probe_duration_seconds.go index 44a90588..0fcd5f8d 100644 --- a/internal/metrics/probe/metric_probe_dns_duration_seconds.go +++ b/internal/metrics/dns/metric_dns_probe_duration_seconds.go @@ -1,36 +1,38 @@ -package probe +package dns import ( "github.com/prometheus/client_golang/prometheus" ) import ( - "github.com/prometheus/blackbox_exporter/internal/metrics/dns" + "github.com/prometheus/blackbox_exporter/internal/metrics/other" ) // Duration of DNS request by phase -type DnsDurationSeconds struct { +type ProbeDurationSeconds struct { *prometheus.GaugeVec - extra DnsDurationSecondsExtra + extra ProbeDurationSecondsExtra } -func NewDnsDurationSeconds() DnsDurationSeconds { - labels := []string{dns.AttrPhase("").Key()} - return DnsDurationSeconds{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "probe", - Name: "dns_duration_seconds", +func NewProbeDurationSeconds() ProbeDurationSeconds { + labels := []string{other.AttrPhase("").Key()} + return ProbeDurationSeconds{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "dns", + Name: "probe_duration_seconds", Help: "Duration of DNS request by phase", }, labels)} } -func (m DnsDurationSeconds) With(phase dns.AttrPhase, extras ...interface { -}) prometheus.Gauge { - return m.WithLabelValues( - string(phase), - ) +func (m ProbeDurationSeconds) With(phase other.AttrPhase, extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(string(phase)) } -type DnsDurationSecondsExtra struct { +// Deprecated: Use [ProbeDurationSeconds.With] instead +func (m ProbeDurationSeconds) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeDurationSecondsExtra struct { } /* @@ -39,7 +41,7 @@ State { current_block: None, auto_escape: None, ctx: { - "AttrExtra": "DnsDurationSecondsExtra", + "AttrExtra": "ProbeDurationSecondsExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -47,8 +49,8 @@ State { "histogram": "Histogram", "updowncounter": "Gauge", }, - "Name": "dns_duration_seconds", - "Type": "DnsDurationSeconds", + "Name": "probe.duration.seconds", + "Type": "ProbeDurationSeconds", "attributes": [ { "brief": "DNS phase", @@ -57,7 +59,7 @@ State { "connect", "request", ], - "name": "dns._phase_", + "name": "phase", "requirement_level": "required", "stability": "stable", "type": "string", @@ -72,7 +74,7 @@ State { "connect", "request", ], - "name": "dns._phase_", + "name": "phase", "requirement_level": "required", "stability": "stable", "type": "string", @@ -80,11 +82,11 @@ State { ], "brief": "Duration of DNS request by phase", "events": [], - "id": "metric.probe.dns.duration.seconds", + "id": "metric.dns.probe.duration.seconds", "instrument": "gauge", "lineage": { "attributes": { - "dns._phase_": { + "phase": { "inherited_fields": [ "brief", "examples", @@ -104,12 +106,13 @@ State { }, "metric_name": "probe_dns_duration_seconds", "name": none, - "root_namespace": "probe", + "root_namespace": "dns", "span_kind": none, "stability": "stable", "type": "metric", "unit": "s", }, + "for_each_attr": , "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { @@ -221,6 +224,7 @@ State { "ansi_white", "ansi_yellow", "attr", + "attribute_id", "attribute_namespace", "attribute_registry_file", "attribute_registry_namespace", diff --git a/internal/metrics/probe/metric_probe_dns_query_succeeded.go b/internal/metrics/dns/metric_dns_probe_query_succeeded.go similarity index 87% rename from internal/metrics/probe/metric_probe_dns_query_succeeded.go rename to internal/metrics/dns/metric_dns_probe_query_succeeded.go index 03fb43f9..a3b56ad2 100644 --- a/internal/metrics/probe/metric_probe_dns_query_succeeded.go +++ b/internal/metrics/dns/metric_dns_probe_query_succeeded.go @@ -1,30 +1,34 @@ -package probe +package dns import ( "github.com/prometheus/client_golang/prometheus" ) // Displays whether or not the query was executed successfully -type DnsQuerySucceeded struct { +type ProbeQuerySucceeded struct { *prometheus.GaugeVec - extra DnsQuerySucceededExtra + extra ProbeQuerySucceededExtra } -func NewDnsQuerySucceeded() DnsQuerySucceeded { +func NewProbeQuerySucceeded() ProbeQuerySucceeded { labels := []string{} - return DnsQuerySucceeded{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "probe", - Name: "dns_query_succeeded", + return ProbeQuerySucceeded{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Namespace: "dns", + Name: "probe_query_succeeded", Help: "Displays whether or not the query was executed successfully", }, labels)} } -func (m DnsQuerySucceeded) With(extras ...interface { -}) prometheus.Gauge { - return m.WithLabelValues() +func (m ProbeQuerySucceeded) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() } -type DnsQuerySucceededExtra struct { +// Deprecated: Use [ProbeQuerySucceeded.With] instead +func (m ProbeQuerySucceeded) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeQuerySucceededExtra struct { } /* @@ -33,7 +37,7 @@ State { current_block: None, auto_escape: None, ctx: { - "AttrExtra": "DnsQuerySucceededExtra", + "AttrExtra": "ProbeQuerySucceededExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -41,14 +45,14 @@ State { "histogram": "Histogram", "updowncounter": "Gauge", }, - "Name": "dns_query_succeeded", - "Type": "DnsQuerySucceeded", + "Name": "probe.query.succeeded", + "Type": "ProbeQuerySucceeded", "attributes": [], "ctx": { "attributes": [], "brief": "Displays whether or not the query was executed successfully", "events": [], - "id": "metric.probe.dns.query.succeeded", + "id": "metric.dns.probe.query.succeeded", "instrument": "gauge", "lineage": { "provenance": { @@ -58,12 +62,13 @@ State { }, "metric_name": "probe_dns_query_succeeded", "name": none, - "root_namespace": "probe", + "root_namespace": "dns", "span_kind": none, "stability": "stable", "type": "metric", "unit": "1", }, + "for_each_attr": , "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { @@ -175,6 +180,7 @@ State { "ansi_white", "ansi_yellow", "attr", + "attribute_id", "attribute_namespace", "attribute_registry_file", "attribute_registry_namespace", diff --git a/internal/metrics/dns/attributes.go b/internal/metrics/other/attributes.go similarity index 96% rename from internal/metrics/dns/attributes.go rename to internal/metrics/other/attributes.go index a12a2034..ab070a45 100644 --- a/internal/metrics/dns/attributes.go +++ b/internal/metrics/other/attributes.go @@ -1,7 +1,7 @@ -package dns +package other // DNS phase -type AttrPhase string // dns._phase_ +type AttrPhase string // phase func (AttrPhase) Stable() {} func (AttrPhase) Recommended() {} @@ -26,14 +26,14 @@ const PhaseRequest AttrPhase = "request" "connect", "request", ], - "name": "dns._phase_", + "name": "phase", "requirement_level": "recommended", - "root_namespace": "dns", + "root_namespace": "other", "stability": "stable", "type": "string", }, ], - "root_namespace": "dns", + "root_namespace": "other", }, }, env: Environment { @@ -145,6 +145,7 @@ const PhaseRequest AttrPhase = "request" "ansi_white", "ansi_yellow", "attr", + "attribute_id", "attribute_namespace", "attribute_registry_file", "attribute_registry_namespace", diff --git a/prober/dns.go b/prober/dns.go index 7afe2e11..3a7e7394 100644 --- a/prober/dns.go +++ b/prober/dns.go @@ -26,8 +26,8 @@ import ( "github.com/prometheus/blackbox_exporter/config" - dnsm "github.com/prometheus/blackbox_exporter/internal/metrics/dns" - metrics "github.com/prometheus/blackbox_exporter/internal/metrics/probe" + metrics "github.com/prometheus/blackbox_exporter/internal/metrics/dns" + "github.com/prometheus/blackbox_exporter/internal/metrics/other" ) // validRRs checks a slice of RRs received from the server against a DNSRRValidator. @@ -129,12 +129,12 @@ func validRcode(rcode int, valid []string, logger *slog.Logger) bool { func ProbeDNS(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger *slog.Logger) bool { var dialProtocol string - probeDNSDurationGaugeVec := metrics.NewDnsDurationSeconds() - probeDNSAnswerRRSGauge := metrics.NewDnsAnswerRrs().With() - probeDNSAuthorityRRSGauge := metrics.NewDnsAuthorityRrs().With() - probeDNSAdditionalRRSGauge := metrics.NewDnsAdditionalRrs().With() - probeDNSQuerySucceeded := metrics.NewDnsQuerySucceeded().With() - for _, lv := range []dnsm.AttrPhase{dnsm.PhaseResolve, dnsm.PhaseConnect, dnsm.PhaseRequest} { + probeDNSDurationGaugeVec := metrics.NewProbeDurationSeconds() + probeDNSAnswerRRSGauge := metrics.NewProbeAnswerRrs().With() + probeDNSAuthorityRRSGauge := metrics.NewProbeAuthorityRrs().With() + probeDNSAdditionalRRSGauge := metrics.NewProbeAdditionalRrs().With() + probeDNSQuerySucceeded := metrics.NewProbeQuerySucceeded().With() + for _, lv := range []other.AttrPhase{other.PhaseResolve, other.PhaseConnect, other.PhaseRequest} { probeDNSDurationGaugeVec.With(lv) } @@ -189,7 +189,7 @@ func ProbeDNS(ctx context.Context, target string, module config.Module, registry logger.Error("Error resolving address", "err", err) return false } - probeDNSDurationGaugeVec.With(dnsm.PhaseResolve).Add(lookupTime) + probeDNSDurationGaugeVec.With(other.PhaseResolve).Add(lookupTime) targetIP := net.JoinHostPort(ip.String(), port) if ip.IP.To4() == nil { @@ -255,8 +255,8 @@ func ProbeDNS(ctx context.Context, target string, module config.Module, registry // exchange messages with the server _after_ the connection is created. // We compute the connection time as the total time for the operation // minus the time for the actual request rtt. - probeDNSDurationGaugeVec.With(dnsm.PhaseConnect).Set((time.Since(requestStart) - rtt).Seconds()) - probeDNSDurationGaugeVec.With(dnsm.PhaseRequest).Set(rtt.Seconds()) + probeDNSDurationGaugeVec.With(other.PhaseConnect).Set((time.Since(requestStart) - rtt).Seconds()) + probeDNSDurationGaugeVec.With(other.PhaseRequest).Set(rtt.Seconds()) if err != nil { logger.Error("Error while sending a DNS query", "err", err) return false diff --git a/semconv/dns/metrics.yaml b/semconv/dns/metrics.yaml index 2d780fb7..7754e995 100644 --- a/semconv/dns/metrics.yaml +++ b/semconv/dns/metrics.yaml @@ -1,17 +1,17 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json groups: - - id: metric.probe.dns.duration.seconds + - id: metric.dns.probe.duration.seconds type: metric metric_name: probe_dns_duration_seconds brief: "Duration of DNS request by phase" instrument: "gauge" unit: "s" attributes: - - ref: dns._phase_ + - ref: phase requirement_level: required stability: stable - - id: metric.probe.dns.answer.rrs + - id: metric.dns.probe.answer.rrs type: metric metric_name: probe_dns_answer_rrs brief: "Returns number of entries in the answer resource record list" @@ -19,7 +19,7 @@ groups: unit: "1" stability: stable - - id: metric.probe.dns.authority.rrs + - id: metric.dns.probe.authority.rrs type: metric metric_name: probe_dns_authority_rrs brief: "Returns number of entries in the authority resource record list" @@ -27,7 +27,7 @@ groups: unit: "1" stability: stable - - id: metric.probe.dns.additional.rrs + - id: metric.dns.probe.additional.rrs type: metric metric_name: probe_dns_additional_rrs brief: "Returns number of entries in the additional resource record list" @@ -35,7 +35,7 @@ groups: unit: "1" stability: stable - - id: metric.probe.dns.query.succeeded + - id: metric.dns.probe.query.succeeded type: metric metric_name: probe_dns_query_succeeded brief: "Displays whether or not the query was executed successfully" diff --git a/semconv/dns/registry.yaml b/semconv/dns/registry.yaml index d126aa75..0e14104f 100644 --- a/semconv/dns/registry.yaml +++ b/semconv/dns/registry.yaml @@ -4,7 +4,7 @@ groups: type: attribute_group brief: DNS attributes attributes: - - id: dns._phase_ + - id: phase type: string stability: stable brief: "DNS phase" From 5e3d4b9d79e0b0219f139defd5f9c5f5ebb6775c Mon Sep 17 00:00:00 2001 From: sh0rez Date: Fri, 6 Jun 2025 16:50:02 +0200 Subject: [PATCH 3/7] *: http --- .../dns/metric_dns_probe_additional_rrs.go | 5 +- .../dns/metric_dns_probe_answer_rrs.go | 5 +- .../dns/metric_dns_probe_authority_rrs.go | 5 +- .../dns/metric_dns_probe_duration_seconds.go | 176 ++++++- .../dns/metric_dns_probe_query_succeeded.go | 5 +- .../http/metric_http_probe_content_length.go | 273 +++++++++++ .../metric_http_probe_duration_seconds.go | 456 ++++++++++++++++++ .../metric_http_probe_failed_due_to_cel.go | 273 +++++++++++ .../metric_http_probe_failed_due_to_regex.go | 273 +++++++++++ ...p_probe_last_modified_timestamp_seconds.go | 273 +++++++++++ .../http/metric_http_probe_redirects.go | 273 +++++++++++ .../metrics/http/metric_http_probe_ssl.go | 273 +++++++++++ .../http/metric_http_probe_status_code.go | 273 +++++++++++ ...ric_http_probe_uncompressed_body_length.go | 273 +++++++++++ .../metrics/http/metric_http_probe_version.go | 273 +++++++++++ internal/metrics/other/attributes.go | 221 ++++++++- .../metric_ssl_probe_earliest_cert_expiry.go | 273 +++++++++++ ...obe_last_chain_expiry_timestamp_seconds.go | 273 +++++++++++ .../ssl/metric_ssl_probe_last_chain_info.go | 441 +++++++++++++++++ .../metrics/tls/metric_tls_probe_cipher.go | 315 ++++++++++++ .../metrics/tls/metric_tls_probe_version.go | 315 ++++++++++++ prober/http.go | 117 ++--- semconv/dns/registry.yaml | 11 - semconv/http/metrics.yaml | 84 ++++ semconv/other/registry.yaml | 20 + semconv/tls/metrics.yaml | 58 +++ semconv/tls/registry.yaml | 48 ++ 27 files changed, 5158 insertions(+), 127 deletions(-) create mode 100644 internal/metrics/http/metric_http_probe_content_length.go create mode 100644 internal/metrics/http/metric_http_probe_duration_seconds.go create mode 100644 internal/metrics/http/metric_http_probe_failed_due_to_cel.go create mode 100644 internal/metrics/http/metric_http_probe_failed_due_to_regex.go create mode 100644 internal/metrics/http/metric_http_probe_last_modified_timestamp_seconds.go create mode 100644 internal/metrics/http/metric_http_probe_redirects.go create mode 100644 internal/metrics/http/metric_http_probe_ssl.go create mode 100644 internal/metrics/http/metric_http_probe_status_code.go create mode 100644 internal/metrics/http/metric_http_probe_uncompressed_body_length.go create mode 100644 internal/metrics/http/metric_http_probe_version.go create mode 100644 internal/metrics/ssl/metric_ssl_probe_earliest_cert_expiry.go create mode 100644 internal/metrics/ssl/metric_ssl_probe_last_chain_expiry_timestamp_seconds.go create mode 100644 internal/metrics/ssl/metric_ssl_probe_last_chain_info.go create mode 100644 internal/metrics/tls/metric_tls_probe_cipher.go create mode 100644 internal/metrics/tls/metric_tls_probe_version.go delete mode 100644 semconv/dns/registry.yaml create mode 100644 semconv/http/metrics.yaml create mode 100644 semconv/other/registry.yaml create mode 100644 semconv/tls/metrics.yaml create mode 100644 semconv/tls/registry.yaml diff --git a/internal/metrics/dns/metric_dns_probe_additional_rrs.go b/internal/metrics/dns/metric_dns_probe_additional_rrs.go index 0687d54a..fc7d6be7 100644 --- a/internal/metrics/dns/metric_dns_probe_additional_rrs.go +++ b/internal/metrics/dns/metric_dns_probe_additional_rrs.go @@ -13,9 +13,8 @@ type ProbeAdditionalRrs struct { func NewProbeAdditionalRrs() ProbeAdditionalRrs { labels := []string{} return ProbeAdditionalRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "dns", - Name: "probe_additional_rrs", - Help: "Returns number of entries in the additional resource record list", + Name: "probe_dns_additional_rrs", + Help: "Returns number of entries in the additional resource record list", }, labels)} } diff --git a/internal/metrics/dns/metric_dns_probe_answer_rrs.go b/internal/metrics/dns/metric_dns_probe_answer_rrs.go index 3732da71..349c68f2 100644 --- a/internal/metrics/dns/metric_dns_probe_answer_rrs.go +++ b/internal/metrics/dns/metric_dns_probe_answer_rrs.go @@ -13,9 +13,8 @@ type ProbeAnswerRrs struct { func NewProbeAnswerRrs() ProbeAnswerRrs { labels := []string{} return ProbeAnswerRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "dns", - Name: "probe_answer_rrs", - Help: "Returns number of entries in the answer resource record list", + Name: "probe_dns_answer_rrs", + Help: "Returns number of entries in the answer resource record list", }, labels)} } diff --git a/internal/metrics/dns/metric_dns_probe_authority_rrs.go b/internal/metrics/dns/metric_dns_probe_authority_rrs.go index 6b607799..b7bd77eb 100644 --- a/internal/metrics/dns/metric_dns_probe_authority_rrs.go +++ b/internal/metrics/dns/metric_dns_probe_authority_rrs.go @@ -13,9 +13,8 @@ type ProbeAuthorityRrs struct { func NewProbeAuthorityRrs() ProbeAuthorityRrs { labels := []string{} return ProbeAuthorityRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "dns", - Name: "probe_authority_rrs", - Help: "Returns number of entries in the authority resource record list", + Name: "probe_dns_authority_rrs", + Help: "Returns number of entries in the authority resource record list", }, labels)} } diff --git a/internal/metrics/dns/metric_dns_probe_duration_seconds.go b/internal/metrics/dns/metric_dns_probe_duration_seconds.go index 0fcd5f8d..bba9607e 100644 --- a/internal/metrics/dns/metric_dns_probe_duration_seconds.go +++ b/internal/metrics/dns/metric_dns_probe_duration_seconds.go @@ -17,9 +17,8 @@ type ProbeDurationSeconds struct { func NewProbeDurationSeconds() ProbeDurationSeconds { labels := []string{other.AttrPhase("").Key()} return ProbeDurationSeconds{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "dns", - Name: "probe_duration_seconds", - Help: "Duration of DNS request by phase", + Name: "probe_dns_duration_seconds", + Help: "Duration of DNS request by phase", }, labels)} } @@ -53,31 +52,171 @@ State { "Type": "ProbeDurationSeconds", "attributes": [ { - "brief": "DNS phase", - "examples": [ - "resolve", - "connect", - "request", - ], + "brief": "Probe phase", "name": "phase", "requirement_level": "required", "stability": "stable", - "type": "string", + "type": { + "members": [ + { + "brief": none, + "deprecated": none, + "id": "resolve", + "note": none, + "stability": "stable", + "value": "resolve", + }, + { + "brief": none, + "deprecated": none, + "id": "connect", + "note": none, + "stability": "stable", + "value": "connect", + }, + { + "brief": none, + "deprecated": none, + "id": "request", + "note": none, + "stability": "stable", + "value": "request", + }, + { + "brief": none, + "deprecated": none, + "id": "tls", + "note": none, + "stability": "stable", + "value": "tls", + }, + { + "brief": none, + "deprecated": none, + "id": "processing", + "note": none, + "stability": "stable", + "value": "processing", + }, + { + "brief": none, + "deprecated": none, + "id": "transfer", + "note": none, + "stability": "stable", + "value": "transfer", + }, + { + "brief": none, + "deprecated": none, + "id": "setup", + "note": none, + "stability": "stable", + "value": "setup", + }, + { + "brief": none, + "deprecated": none, + "id": "rtt", + "note": none, + "stability": "stable", + "value": "rtt", + }, + { + "brief": none, + "deprecated": none, + "id": "check", + "note": none, + "stability": "stable", + "value": "check", + }, + ], + }, }, ], "ctx": { "attributes": [ { - "brief": "DNS phase", - "examples": [ - "resolve", - "connect", - "request", - ], + "brief": "Probe phase", "name": "phase", "requirement_level": "required", "stability": "stable", - "type": "string", + "type": { + "members": [ + { + "brief": none, + "deprecated": none, + "id": "resolve", + "note": none, + "stability": "stable", + "value": "resolve", + }, + { + "brief": none, + "deprecated": none, + "id": "connect", + "note": none, + "stability": "stable", + "value": "connect", + }, + { + "brief": none, + "deprecated": none, + "id": "request", + "note": none, + "stability": "stable", + "value": "request", + }, + { + "brief": none, + "deprecated": none, + "id": "tls", + "note": none, + "stability": "stable", + "value": "tls", + }, + { + "brief": none, + "deprecated": none, + "id": "processing", + "note": none, + "stability": "stable", + "value": "processing", + }, + { + "brief": none, + "deprecated": none, + "id": "transfer", + "note": none, + "stability": "stable", + "value": "transfer", + }, + { + "brief": none, + "deprecated": none, + "id": "setup", + "note": none, + "stability": "stable", + "value": "setup", + }, + { + "brief": none, + "deprecated": none, + "id": "rtt", + "note": none, + "stability": "stable", + "value": "rtt", + }, + { + "brief": none, + "deprecated": none, + "id": "check", + "note": none, + "stability": "stable", + "value": "check", + }, + ], + }, }, ], "brief": "Duration of DNS request by phase", @@ -89,14 +228,13 @@ State { "phase": { "inherited_fields": [ "brief", - "examples", "note", "stability", ], "locally_overridden_fields": [ "requirement_level", ], - "source_group": "registry.dns", + "source_group": "registry.other", }, }, "provenance": { diff --git a/internal/metrics/dns/metric_dns_probe_query_succeeded.go b/internal/metrics/dns/metric_dns_probe_query_succeeded.go index a3b56ad2..eeb94455 100644 --- a/internal/metrics/dns/metric_dns_probe_query_succeeded.go +++ b/internal/metrics/dns/metric_dns_probe_query_succeeded.go @@ -13,9 +13,8 @@ type ProbeQuerySucceeded struct { func NewProbeQuerySucceeded() ProbeQuerySucceeded { labels := []string{} return ProbeQuerySucceeded{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Namespace: "dns", - Name: "probe_query_succeeded", - Help: "Displays whether or not the query was executed successfully", + Name: "probe_dns_query_succeeded", + Help: "Displays whether or not the query was executed successfully", }, labels)} } diff --git a/internal/metrics/http/metric_http_probe_content_length.go b/internal/metrics/http/metric_http_probe_content_length.go new file mode 100644 index 00000000..08ceb9ce --- /dev/null +++ b/internal/metrics/http/metric_http_probe_content_length.go @@ -0,0 +1,273 @@ +package http + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Length of http content response +type ProbeContentLength struct { + *prometheus.GaugeVec + extra ProbeContentLengthExtra +} + +func NewProbeContentLength() ProbeContentLength { + labels := []string{} + return ProbeContentLength{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_http_content_length", + Help: "Length of http content response", + }, labels)} +} + +func (m ProbeContentLength) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() +} + +// Deprecated: Use [ProbeContentLength.With] instead +func (m ProbeContentLength) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeContentLengthExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeContentLengthExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.content.length", + "Type": "ProbeContentLength", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "Length of http content response", + "events": [], + "id": "metric.http.probe.content.length", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/http/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_http_content_length", + "name": none, + "root_namespace": "http", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "By", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/http/metric_http_probe_duration_seconds.go b/internal/metrics/http/metric_http_probe_duration_seconds.go new file mode 100644 index 00000000..f8f6c055 --- /dev/null +++ b/internal/metrics/http/metric_http_probe_duration_seconds.go @@ -0,0 +1,456 @@ +package http + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +import ( + "github.com/prometheus/blackbox_exporter/internal/metrics/other" +) + +// Duration of http request by phase, summed over all redirects +type ProbeDurationSeconds struct { + *prometheus.GaugeVec + extra ProbeDurationSecondsExtra +} + +func NewProbeDurationSeconds() ProbeDurationSeconds { + labels := []string{other.AttrPhase("").Key()} + return ProbeDurationSeconds{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_http_duration_seconds", + Help: "Duration of http request by phase, summed over all redirects", + }, labels)} +} + +func (m ProbeDurationSeconds) With(phase other.AttrPhase, extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(string(phase)) +} + +// Deprecated: Use [ProbeDurationSeconds.With] instead +func (m ProbeDurationSeconds) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeDurationSecondsExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeDurationSecondsExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.duration.seconds", + "Type": "ProbeDurationSeconds", + "attributes": [ + { + "brief": "Probe phase", + "name": "phase", + "requirement_level": "required", + "stability": "stable", + "type": { + "members": [ + { + "brief": none, + "deprecated": none, + "id": "resolve", + "note": none, + "stability": "stable", + "value": "resolve", + }, + { + "brief": none, + "deprecated": none, + "id": "connect", + "note": none, + "stability": "stable", + "value": "connect", + }, + { + "brief": none, + "deprecated": none, + "id": "request", + "note": none, + "stability": "stable", + "value": "request", + }, + { + "brief": none, + "deprecated": none, + "id": "tls", + "note": none, + "stability": "stable", + "value": "tls", + }, + { + "brief": none, + "deprecated": none, + "id": "processing", + "note": none, + "stability": "stable", + "value": "processing", + }, + { + "brief": none, + "deprecated": none, + "id": "transfer", + "note": none, + "stability": "stable", + "value": "transfer", + }, + { + "brief": none, + "deprecated": none, + "id": "setup", + "note": none, + "stability": "stable", + "value": "setup", + }, + { + "brief": none, + "deprecated": none, + "id": "rtt", + "note": none, + "stability": "stable", + "value": "rtt", + }, + { + "brief": none, + "deprecated": none, + "id": "check", + "note": none, + "stability": "stable", + "value": "check", + }, + ], + }, + }, + ], + "ctx": { + "attributes": [ + { + "brief": "Probe phase", + "name": "phase", + "requirement_level": "required", + "stability": "stable", + "type": { + "members": [ + { + "brief": none, + "deprecated": none, + "id": "resolve", + "note": none, + "stability": "stable", + "value": "resolve", + }, + { + "brief": none, + "deprecated": none, + "id": "connect", + "note": none, + "stability": "stable", + "value": "connect", + }, + { + "brief": none, + "deprecated": none, + "id": "request", + "note": none, + "stability": "stable", + "value": "request", + }, + { + "brief": none, + "deprecated": none, + "id": "tls", + "note": none, + "stability": "stable", + "value": "tls", + }, + { + "brief": none, + "deprecated": none, + "id": "processing", + "note": none, + "stability": "stable", + "value": "processing", + }, + { + "brief": none, + "deprecated": none, + "id": "transfer", + "note": none, + "stability": "stable", + "value": "transfer", + }, + { + "brief": none, + "deprecated": none, + "id": "setup", + "note": none, + "stability": "stable", + "value": "setup", + }, + { + "brief": none, + "deprecated": none, + "id": "rtt", + "note": none, + "stability": "stable", + "value": "rtt", + }, + { + "brief": none, + "deprecated": none, + "id": "check", + "note": none, + "stability": "stable", + "value": "check", + }, + ], + }, + }, + ], + "brief": "Duration of http request by phase, summed over all redirects", + "events": [], + "id": "metric.http.probe.duration.seconds", + "instrument": "gauge", + "lineage": { + "attributes": { + "phase": { + "inherited_fields": [ + "brief", + "note", + "stability", + ], + "locally_overridden_fields": [ + "requirement_level", + ], + "source_group": "registry.other", + }, + }, + "provenance": { + "path": "../../semconv/http/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_http_duration_seconds", + "name": none, + "root_namespace": "http", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "s", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/http/metric_http_probe_failed_due_to_cel.go b/internal/metrics/http/metric_http_probe_failed_due_to_cel.go new file mode 100644 index 00000000..c903b8d0 --- /dev/null +++ b/internal/metrics/http/metric_http_probe_failed_due_to_cel.go @@ -0,0 +1,273 @@ +package http + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Indicates if probe failed due to CEL expression not matching +type ProbeFailedDueToCel struct { + *prometheus.GaugeVec + extra ProbeFailedDueToCelExtra +} + +func NewProbeFailedDueToCel() ProbeFailedDueToCel { + labels := []string{} + return ProbeFailedDueToCel{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_failed_due_to_cel", + Help: "Indicates if probe failed due to CEL expression not matching", + }, labels)} +} + +func (m ProbeFailedDueToCel) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() +} + +// Deprecated: Use [ProbeFailedDueToCel.With] instead +func (m ProbeFailedDueToCel) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeFailedDueToCelExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeFailedDueToCelExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.failed.due.to.cel", + "Type": "ProbeFailedDueToCel", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "Indicates if probe failed due to CEL expression not matching", + "events": [], + "id": "metric.http.probe.failed.due.to.cel", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/http/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_failed_due_to_cel", + "name": none, + "root_namespace": "http", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/http/metric_http_probe_failed_due_to_regex.go b/internal/metrics/http/metric_http_probe_failed_due_to_regex.go new file mode 100644 index 00000000..b74c2280 --- /dev/null +++ b/internal/metrics/http/metric_http_probe_failed_due_to_regex.go @@ -0,0 +1,273 @@ +package http + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Indicates if probe failed due to regex +type ProbeFailedDueToRegex struct { + *prometheus.GaugeVec + extra ProbeFailedDueToRegexExtra +} + +func NewProbeFailedDueToRegex() ProbeFailedDueToRegex { + labels := []string{} + return ProbeFailedDueToRegex{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_failed_due_to_regex", + Help: "Indicates if probe failed due to regex", + }, labels)} +} + +func (m ProbeFailedDueToRegex) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() +} + +// Deprecated: Use [ProbeFailedDueToRegex.With] instead +func (m ProbeFailedDueToRegex) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeFailedDueToRegexExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeFailedDueToRegexExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.failed.due.to.regex", + "Type": "ProbeFailedDueToRegex", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "Indicates if probe failed due to regex", + "events": [], + "id": "metric.http.probe.failed.due.to.regex", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/http/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_failed_due_to_regex", + "name": none, + "root_namespace": "http", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/http/metric_http_probe_last_modified_timestamp_seconds.go b/internal/metrics/http/metric_http_probe_last_modified_timestamp_seconds.go new file mode 100644 index 00000000..b68354a3 --- /dev/null +++ b/internal/metrics/http/metric_http_probe_last_modified_timestamp_seconds.go @@ -0,0 +1,273 @@ +package http + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Returns the Last-Modified HTTP response header in unixtime +type ProbeLastModifiedTimestampSeconds struct { + *prometheus.GaugeVec + extra ProbeLastModifiedTimestampSecondsExtra +} + +func NewProbeLastModifiedTimestampSeconds() ProbeLastModifiedTimestampSeconds { + labels := []string{} + return ProbeLastModifiedTimestampSeconds{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_http_last_modified_timestamp_seconds", + Help: "Returns the Last-Modified HTTP response header in unixtime", + }, labels)} +} + +func (m ProbeLastModifiedTimestampSeconds) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() +} + +// Deprecated: Use [ProbeLastModifiedTimestampSeconds.With] instead +func (m ProbeLastModifiedTimestampSeconds) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeLastModifiedTimestampSecondsExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeLastModifiedTimestampSecondsExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.last.modified.timestamp.seconds", + "Type": "ProbeLastModifiedTimestampSeconds", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "Returns the Last-Modified HTTP response header in unixtime", + "events": [], + "id": "metric.http.probe.last.modified.timestamp.seconds", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/http/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_http_last_modified_timestamp_seconds", + "name": none, + "root_namespace": "http", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "s", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/http/metric_http_probe_redirects.go b/internal/metrics/http/metric_http_probe_redirects.go new file mode 100644 index 00000000..a26946e1 --- /dev/null +++ b/internal/metrics/http/metric_http_probe_redirects.go @@ -0,0 +1,273 @@ +package http + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// The number of redirects +type ProbeRedirects struct { + *prometheus.GaugeVec + extra ProbeRedirectsExtra +} + +func NewProbeRedirects() ProbeRedirects { + labels := []string{} + return ProbeRedirects{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_http_redirects", + Help: "The number of redirects", + }, labels)} +} + +func (m ProbeRedirects) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() +} + +// Deprecated: Use [ProbeRedirects.With] instead +func (m ProbeRedirects) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeRedirectsExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeRedirectsExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.redirects", + "Type": "ProbeRedirects", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "The number of redirects", + "events": [], + "id": "metric.http.probe.redirects", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/http/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_http_redirects", + "name": none, + "root_namespace": "http", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/http/metric_http_probe_ssl.go b/internal/metrics/http/metric_http_probe_ssl.go new file mode 100644 index 00000000..b78b0589 --- /dev/null +++ b/internal/metrics/http/metric_http_probe_ssl.go @@ -0,0 +1,273 @@ +package http + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Indicates if SSL was used for the final redirect +type ProbeSsl struct { + *prometheus.GaugeVec + extra ProbeSslExtra +} + +func NewProbeSsl() ProbeSsl { + labels := []string{} + return ProbeSsl{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_http_ssl", + Help: "Indicates if SSL was used for the final redirect", + }, labels)} +} + +func (m ProbeSsl) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() +} + +// Deprecated: Use [ProbeSsl.With] instead +func (m ProbeSsl) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeSslExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeSslExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.ssl", + "Type": "ProbeSsl", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "Indicates if SSL was used for the final redirect", + "events": [], + "id": "metric.http.probe.ssl", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/http/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_http_ssl", + "name": none, + "root_namespace": "http", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/http/metric_http_probe_status_code.go b/internal/metrics/http/metric_http_probe_status_code.go new file mode 100644 index 00000000..11b30916 --- /dev/null +++ b/internal/metrics/http/metric_http_probe_status_code.go @@ -0,0 +1,273 @@ +package http + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Response HTTP status code +type ProbeStatusCode struct { + *prometheus.GaugeVec + extra ProbeStatusCodeExtra +} + +func NewProbeStatusCode() ProbeStatusCode { + labels := []string{} + return ProbeStatusCode{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_http_status_code", + Help: "Response HTTP status code", + }, labels)} +} + +func (m ProbeStatusCode) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() +} + +// Deprecated: Use [ProbeStatusCode.With] instead +func (m ProbeStatusCode) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeStatusCodeExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeStatusCodeExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.status.code", + "Type": "ProbeStatusCode", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "Response HTTP status code", + "events": [], + "id": "metric.http.probe.status.code", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/http/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_http_status_code", + "name": none, + "root_namespace": "http", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/http/metric_http_probe_uncompressed_body_length.go b/internal/metrics/http/metric_http_probe_uncompressed_body_length.go new file mode 100644 index 00000000..62b89d74 --- /dev/null +++ b/internal/metrics/http/metric_http_probe_uncompressed_body_length.go @@ -0,0 +1,273 @@ +package http + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Length of uncompressed response body +type ProbeUncompressedBodyLength struct { + *prometheus.GaugeVec + extra ProbeUncompressedBodyLengthExtra +} + +func NewProbeUncompressedBodyLength() ProbeUncompressedBodyLength { + labels := []string{} + return ProbeUncompressedBodyLength{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_http_uncompressed_body_length", + Help: "Length of uncompressed response body", + }, labels)} +} + +func (m ProbeUncompressedBodyLength) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() +} + +// Deprecated: Use [ProbeUncompressedBodyLength.With] instead +func (m ProbeUncompressedBodyLength) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeUncompressedBodyLengthExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeUncompressedBodyLengthExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.uncompressed.body.length", + "Type": "ProbeUncompressedBodyLength", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "Length of uncompressed response body", + "events": [], + "id": "metric.http.probe.uncompressed.body.length", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/http/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_http_uncompressed_body_length", + "name": none, + "root_namespace": "http", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "By", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/http/metric_http_probe_version.go b/internal/metrics/http/metric_http_probe_version.go new file mode 100644 index 00000000..e55653d6 --- /dev/null +++ b/internal/metrics/http/metric_http_probe_version.go @@ -0,0 +1,273 @@ +package http + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Returns the version of HTTP of the probe response +type ProbeVersion struct { + *prometheus.GaugeVec + extra ProbeVersionExtra +} + +func NewProbeVersion() ProbeVersion { + labels := []string{} + return ProbeVersion{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_http_version", + Help: "Returns the version of HTTP of the probe response", + }, labels)} +} + +func (m ProbeVersion) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() +} + +// Deprecated: Use [ProbeVersion.With] instead +func (m ProbeVersion) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeVersionExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeVersionExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.version", + "Type": "ProbeVersion", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "Returns the version of HTTP of the probe response", + "events": [], + "id": "metric.http.probe.version", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/http/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_http_version", + "name": none, + "root_namespace": "http", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/other/attributes.go b/internal/metrics/other/attributes.go index ab070a45..53b17ee6 100644 --- a/internal/metrics/other/attributes.go +++ b/internal/metrics/other/attributes.go @@ -1,6 +1,30 @@ package other -// DNS phase +// TLS cipher suite +type AttrCipher string // cipher + +func (AttrCipher) Stable() {} +func (AttrCipher) Recommended() {} +func (AttrCipher) Key() string { return "cipher" } +func (a AttrCipher) Value() string { return string(a) } + +// SHA256 fingerprint of the certificate +type AttrFingerprintSha256 string // fingerprint_sha256 + +func (AttrFingerprintSha256) Stable() {} +func (AttrFingerprintSha256) Recommended() {} +func (AttrFingerprintSha256) Key() string { return "fingerprint_sha256" } +func (a AttrFingerprintSha256) Value() string { return string(a) } + +// Issuer of the certificate +type AttrIssuer string // issuer + +func (AttrIssuer) Stable() {} +func (AttrIssuer) Recommended() {} +func (AttrIssuer) Key() string { return "issuer" } +func (a AttrIssuer) Value() string { return string(a) } + +// Probe phase type AttrPhase string // phase func (AttrPhase) Stable() {} @@ -11,6 +35,44 @@ func (a AttrPhase) Value() string { return string(a) } const PhaseResolve AttrPhase = "resolve" const PhaseConnect AttrPhase = "connect" const PhaseRequest AttrPhase = "request" +const PhaseTLS AttrPhase = "tls" +const PhaseProcessing AttrPhase = "processing" +const PhaseTransfer AttrPhase = "transfer" +const PhaseSetup AttrPhase = "setup" +const PhaseRTT AttrPhase = "rtt" +const PhaseCheck AttrPhase = "check" + +// Serial number of the certificate +type AttrSerialnumber string // serialnumber + +func (AttrSerialnumber) Stable() {} +func (AttrSerialnumber) Recommended() {} +func (AttrSerialnumber) Key() string { return "serialnumber" } +func (a AttrSerialnumber) Value() string { return string(a) } + +// Subject of the certificate +type AttrSubject string // subject + +func (AttrSubject) Stable() {} +func (AttrSubject) Recommended() {} +func (AttrSubject) Key() string { return "subject" } +func (a AttrSubject) Value() string { return string(a) } + +// Subject alternative names of the certificate +type AttrSubjectalternative string // subjectalternative + +func (AttrSubjectalternative) Stable() {} +func (AttrSubjectalternative) Recommended() {} +func (AttrSubjectalternative) Key() string { return "subjectalternative" } +func (a AttrSubjectalternative) Value() string { return string(a) } + +// TLS version +type AttrVersion string // version + +func (AttrVersion) Stable() {} +func (AttrVersion) Recommended() {} +func (AttrVersion) Key() string { return "version" } +func (a AttrVersion) Value() string { return string(a) } /* State { name: "attr.go.j2", @@ -20,16 +82,165 @@ const PhaseRequest AttrPhase = "request" "ctx": { "attributes": [ { - "brief": "DNS phase", + "brief": "TLS cipher suite", + "examples": [ + "TLS_AES_256_GCM_SHA384", + "ECDHE-RSA-AES256-GCM-SHA384", + ], + "name": "cipher", + "requirement_level": "recommended", + "root_namespace": "other", + "stability": "stable", + "type": "string", + }, + { + "brief": "SHA256 fingerprint of the certificate", "examples": [ - "resolve", - "connect", - "request", + "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", ], + "name": "fingerprint_sha256", + "requirement_level": "recommended", + "root_namespace": "other", + "stability": "stable", + "type": "string", + }, + { + "brief": "Issuer of the certificate", + "examples": [ + "CN=Example CA,O=Example Corp,C=US", + ], + "name": "issuer", + "requirement_level": "recommended", + "root_namespace": "other", + "stability": "stable", + "type": "string", + }, + { + "brief": "Probe phase", "name": "phase", "requirement_level": "recommended", "root_namespace": "other", "stability": "stable", + "type": { + "members": [ + { + "brief": none, + "deprecated": none, + "id": "resolve", + "note": none, + "stability": "stable", + "value": "resolve", + }, + { + "brief": none, + "deprecated": none, + "id": "connect", + "note": none, + "stability": "stable", + "value": "connect", + }, + { + "brief": none, + "deprecated": none, + "id": "request", + "note": none, + "stability": "stable", + "value": "request", + }, + { + "brief": none, + "deprecated": none, + "id": "tls", + "note": none, + "stability": "stable", + "value": "tls", + }, + { + "brief": none, + "deprecated": none, + "id": "processing", + "note": none, + "stability": "stable", + "value": "processing", + }, + { + "brief": none, + "deprecated": none, + "id": "transfer", + "note": none, + "stability": "stable", + "value": "transfer", + }, + { + "brief": none, + "deprecated": none, + "id": "setup", + "note": none, + "stability": "stable", + "value": "setup", + }, + { + "brief": none, + "deprecated": none, + "id": "rtt", + "note": none, + "stability": "stable", + "value": "rtt", + }, + { + "brief": none, + "deprecated": none, + "id": "check", + "note": none, + "stability": "stable", + "value": "check", + }, + ], + }, + }, + { + "brief": "Serial number of the certificate", + "examples": [ + "1234567890abcdef", + ], + "name": "serialnumber", + "requirement_level": "recommended", + "root_namespace": "other", + "stability": "stable", + "type": "string", + }, + { + "brief": "Subject of the certificate", + "examples": [ + "CN=example.com,O=Example Corp,L=San Francisco,ST=CA,C=US", + ], + "name": "subject", + "requirement_level": "recommended", + "root_namespace": "other", + "stability": "stable", + "type": "string", + }, + { + "brief": "Subject alternative names of the certificate", + "examples": [ + "DNS:example.com,DNS:www.example.com", + ], + "name": "subjectalternative", + "requirement_level": "recommended", + "root_namespace": "other", + "stability": "stable", + "type": "string", + }, + { + "brief": "TLS version", + "examples": [ + "TLS 1.3", + "TLS 1.2", + ], + "name": "version", + "requirement_level": "recommended", + "root_namespace": "other", + "stability": "stable", "type": "string", }, ], diff --git a/internal/metrics/ssl/metric_ssl_probe_earliest_cert_expiry.go b/internal/metrics/ssl/metric_ssl_probe_earliest_cert_expiry.go new file mode 100644 index 00000000..aee389a0 --- /dev/null +++ b/internal/metrics/ssl/metric_ssl_probe_earliest_cert_expiry.go @@ -0,0 +1,273 @@ +package ssl + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Returns earliest SSL cert expiry date +type ProbeEarliestCertExpiry struct { + *prometheus.GaugeVec + extra ProbeEarliestCertExpiryExtra +} + +func NewProbeEarliestCertExpiry() ProbeEarliestCertExpiry { + labels := []string{} + return ProbeEarliestCertExpiry{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_ssl_earliest_cert_expiry", + Help: "Returns earliest SSL cert expiry date", + }, labels)} +} + +func (m ProbeEarliestCertExpiry) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() +} + +// Deprecated: Use [ProbeEarliestCertExpiry.With] instead +func (m ProbeEarliestCertExpiry) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeEarliestCertExpiryExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeEarliestCertExpiryExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.earliest.cert.expiry", + "Type": "ProbeEarliestCertExpiry", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "Returns earliest SSL cert expiry date", + "events": [], + "id": "metric.ssl.probe.earliest.cert.expiry", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/tls/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_ssl_earliest_cert_expiry", + "name": none, + "root_namespace": "ssl", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "s", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/ssl/metric_ssl_probe_last_chain_expiry_timestamp_seconds.go b/internal/metrics/ssl/metric_ssl_probe_last_chain_expiry_timestamp_seconds.go new file mode 100644 index 00000000..a4312e81 --- /dev/null +++ b/internal/metrics/ssl/metric_ssl_probe_last_chain_expiry_timestamp_seconds.go @@ -0,0 +1,273 @@ +package ssl + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Returns last SSL chain expiry timestamp +type ProbeLastChainExpiryTimestampSeconds struct { + *prometheus.GaugeVec + extra ProbeLastChainExpiryTimestampSecondsExtra +} + +func NewProbeLastChainExpiryTimestampSeconds() ProbeLastChainExpiryTimestampSeconds { + labels := []string{} + return ProbeLastChainExpiryTimestampSeconds{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_ssl_last_chain_expiry_timestamp_seconds", + Help: "Returns last SSL chain expiry timestamp", + }, labels)} +} + +func (m ProbeLastChainExpiryTimestampSeconds) With(extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues() +} + +// Deprecated: Use [ProbeLastChainExpiryTimestampSeconds.With] instead +func (m ProbeLastChainExpiryTimestampSeconds) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeLastChainExpiryTimestampSecondsExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeLastChainExpiryTimestampSecondsExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.last.chain.expiry.timestamp.seconds", + "Type": "ProbeLastChainExpiryTimestampSeconds", + "attributes": [], + "ctx": { + "attributes": [], + "brief": "Returns last SSL chain expiry timestamp", + "events": [], + "id": "metric.ssl.probe.last.chain.expiry.timestamp.seconds", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/tls/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_ssl_last_chain_expiry_timestamp_seconds", + "name": none, + "root_namespace": "ssl", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "s", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/ssl/metric_ssl_probe_last_chain_info.go b/internal/metrics/ssl/metric_ssl_probe_last_chain_info.go new file mode 100644 index 00000000..60e840fd --- /dev/null +++ b/internal/metrics/ssl/metric_ssl_probe_last_chain_info.go @@ -0,0 +1,441 @@ +package ssl + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +import ( + "github.com/prometheus/blackbox_exporter/internal/metrics/other" +) + +// Contains SSL leaf certificate information +type ProbeLastChainInfo struct { + *prometheus.GaugeVec + extra ProbeLastChainInfoExtra +} + +func NewProbeLastChainInfo() ProbeLastChainInfo { + labels := []string{other.AttrFingerprintSha256("").Key(), other.AttrIssuer("").Key(), other.AttrSerialnumber("").Key(), other.AttrSubject("").Key(), other.AttrSubjectalternative("").Key()} + return ProbeLastChainInfo{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_ssl_last_chain_info", + Help: "Contains SSL leaf certificate information", + }, labels)} +} + +func (m ProbeLastChainInfo) With(fingerprint_sha256 other.AttrFingerprintSha256, issuer other.AttrIssuer, serialnumber other.AttrSerialnumber, subject other.AttrSubject, subjectalternative other.AttrSubjectalternative, extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(string(fingerprint_sha256), string(issuer), string(serialnumber), string(subject), string(subjectalternative)) +} + +// Deprecated: Use [ProbeLastChainInfo.With] instead +func (m ProbeLastChainInfo) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeLastChainInfoExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeLastChainInfoExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.last.chain.info", + "Type": "ProbeLastChainInfo", + "attributes": [ + { + "brief": "SHA256 fingerprint of the certificate", + "examples": [ + "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + ], + "name": "fingerprint_sha256", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + { + "brief": "Issuer of the certificate", + "examples": [ + "CN=Example CA,O=Example Corp,C=US", + ], + "name": "issuer", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + { + "brief": "Serial number of the certificate", + "examples": [ + "1234567890abcdef", + ], + "name": "serialnumber", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + { + "brief": "Subject of the certificate", + "examples": [ + "CN=example.com,O=Example Corp,L=San Francisco,ST=CA,C=US", + ], + "name": "subject", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + { + "brief": "Subject alternative names of the certificate", + "examples": [ + "DNS:example.com,DNS:www.example.com", + ], + "name": "subjectalternative", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + ], + "ctx": { + "attributes": [ + { + "brief": "SHA256 fingerprint of the certificate", + "examples": [ + "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + ], + "name": "fingerprint_sha256", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + { + "brief": "Subject of the certificate", + "examples": [ + "CN=example.com,O=Example Corp,L=San Francisco,ST=CA,C=US", + ], + "name": "subject", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + { + "brief": "Issuer of the certificate", + "examples": [ + "CN=Example CA,O=Example Corp,C=US", + ], + "name": "issuer", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + { + "brief": "Subject alternative names of the certificate", + "examples": [ + "DNS:example.com,DNS:www.example.com", + ], + "name": "subjectalternative", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + { + "brief": "Serial number of the certificate", + "examples": [ + "1234567890abcdef", + ], + "name": "serialnumber", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + ], + "brief": "Contains SSL leaf certificate information", + "events": [], + "id": "metric.ssl.probe.last.chain.info", + "instrument": "gauge", + "lineage": { + "attributes": { + "fingerprint_sha256": { + "inherited_fields": [ + "brief", + "examples", + "note", + "stability", + ], + "locally_overridden_fields": [ + "requirement_level", + ], + "source_group": "registry.tls", + }, + "issuer": { + "inherited_fields": [ + "brief", + "examples", + "note", + "stability", + ], + "locally_overridden_fields": [ + "requirement_level", + ], + "source_group": "registry.tls", + }, + "serialnumber": { + "inherited_fields": [ + "brief", + "examples", + "note", + "stability", + ], + "locally_overridden_fields": [ + "requirement_level", + ], + "source_group": "registry.tls", + }, + "subject": { + "inherited_fields": [ + "brief", + "examples", + "note", + "stability", + ], + "locally_overridden_fields": [ + "requirement_level", + ], + "source_group": "registry.tls", + }, + "subjectalternative": { + "inherited_fields": [ + "brief", + "examples", + "note", + "stability", + ], + "locally_overridden_fields": [ + "requirement_level", + ], + "source_group": "registry.tls", + }, + }, + "provenance": { + "path": "../../semconv/tls/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_ssl_last_chain_info", + "name": none, + "root_namespace": "ssl", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/tls/metric_tls_probe_cipher.go b/internal/metrics/tls/metric_tls_probe_cipher.go new file mode 100644 index 00000000..bd40508c --- /dev/null +++ b/internal/metrics/tls/metric_tls_probe_cipher.go @@ -0,0 +1,315 @@ +package tls + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +import ( + "github.com/prometheus/blackbox_exporter/internal/metrics/other" +) + +// Contains TLS cipher information +type ProbeCipher struct { + *prometheus.GaugeVec + extra ProbeCipherExtra +} + +func NewProbeCipher() ProbeCipher { + labels := []string{other.AttrCipher("").Key()} + return ProbeCipher{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_tls_cipher_info", + Help: "Contains TLS cipher information", + }, labels)} +} + +func (m ProbeCipher) With(cipher other.AttrCipher, extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(string(cipher)) +} + +// Deprecated: Use [ProbeCipher.With] instead +func (m ProbeCipher) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeCipherExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeCipherExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.cipher", + "Type": "ProbeCipher", + "attributes": [ + { + "brief": "TLS cipher suite", + "examples": [ + "TLS_AES_256_GCM_SHA384", + "ECDHE-RSA-AES256-GCM-SHA384", + ], + "name": "cipher", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + ], + "ctx": { + "attributes": [ + { + "brief": "TLS cipher suite", + "examples": [ + "TLS_AES_256_GCM_SHA384", + "ECDHE-RSA-AES256-GCM-SHA384", + ], + "name": "cipher", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + ], + "brief": "Contains TLS cipher information", + "events": [], + "id": "metric.tls.probe.cipher", + "instrument": "gauge", + "lineage": { + "attributes": { + "cipher": { + "inherited_fields": [ + "brief", + "examples", + "note", + "stability", + ], + "locally_overridden_fields": [ + "requirement_level", + ], + "source_group": "registry.tls", + }, + }, + "provenance": { + "path": "../../semconv/tls/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_tls_cipher_info", + "name": none, + "root_namespace": "tls", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/tls/metric_tls_probe_version.go b/internal/metrics/tls/metric_tls_probe_version.go new file mode 100644 index 00000000..a60d3a06 --- /dev/null +++ b/internal/metrics/tls/metric_tls_probe_version.go @@ -0,0 +1,315 @@ +package tls + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +import ( + "github.com/prometheus/blackbox_exporter/internal/metrics/other" +) + +// Contains TLS version information +type ProbeVersion struct { + *prometheus.GaugeVec + extra ProbeVersionExtra +} + +func NewProbeVersion() ProbeVersion { + labels := []string{other.AttrVersion("").Key()} + return ProbeVersion{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_tls_version_info", + Help: "Contains TLS version information", + }, labels)} +} + +func (m ProbeVersion) With(version other.AttrVersion, extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(string(version)) +} + +// Deprecated: Use [ProbeVersion.With] instead +func (m ProbeVersion) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeVersionExtra struct { +} + +/* +State { + name: "metric.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeVersionExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.version", + "Type": "ProbeVersion", + "attributes": [ + { + "brief": "TLS version", + "examples": [ + "TLS 1.3", + "TLS 1.2", + ], + "name": "version", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + ], + "ctx": { + "attributes": [ + { + "brief": "TLS version", + "examples": [ + "TLS 1.3", + "TLS 1.2", + ], + "name": "version", + "requirement_level": "required", + "stability": "stable", + "type": "string", + }, + ], + "brief": "Contains TLS version information", + "events": [], + "id": "metric.tls.probe.version", + "instrument": "gauge", + "lineage": { + "attributes": { + "version": { + "inherited_fields": [ + "brief", + "examples", + "note", + "stability", + ], + "locally_overridden_fields": [ + "requirement_level", + ], + "source_group": "registry.tls", + }, + }, + "provenance": { + "path": "../../semconv/tls/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_tls_version_info", + "name": none, + "root_namespace": "tls", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "metric.go.j2", + ], + }, +} +*/ diff --git a/prober/http.go b/prober/http.go index 28243116..9ef38633 100644 --- a/prober/http.go +++ b/prober/http.go @@ -43,6 +43,10 @@ import ( "golang.org/x/net/publicsuffix" "github.com/prometheus/blackbox_exporter/config" + httpmetrics "github.com/prometheus/blackbox_exporter/internal/metrics/http" + "github.com/prometheus/blackbox_exporter/internal/metrics/other" + sslmetrics "github.com/prometheus/blackbox_exporter/internal/metrics/ssl" + tlsmetrics "github.com/prometheus/blackbox_exporter/internal/metrics/tls" ) func matchRegularExpressions(reader io.Reader, httpConfig config.HTTPProbe, logger *slog.Logger) bool { @@ -291,74 +295,21 @@ var userAgentDefaultHeader = fmt.Sprintf("Blackbox Exporter/%s", version.Version func ProbeHTTP(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger *slog.Logger) (success bool) { var redirects int var ( - durationGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Name: "probe_http_duration_seconds", - Help: "Duration of http request by phase, summed over all redirects", - }, []string{"phase"}) - contentLengthGauge = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_http_content_length", - Help: "Length of http content response", - }) - bodyUncompressedLengthGauge = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_http_uncompressed_body_length", - Help: "Length of uncompressed response body", - }) - redirectsGauge = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_http_redirects", - Help: "The number of redirects", - }) - - isSSLGauge = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_http_ssl", - Help: "Indicates if SSL was used for the final redirect", - }) - - statusCodeGauge = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_http_status_code", - Help: "Response HTTP status code", - }) - - probeSSLEarliestCertExpiryGauge = prometheus.NewGauge(sslEarliestCertExpiryGaugeOpts) - - probeSSLLastChainExpiryTimestampSeconds = prometheus.NewGauge(sslChainExpiryInTimeStampGaugeOpts) - - probeSSLLastInformation = prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: "probe_ssl_last_chain_info", - Help: "Contains SSL leaf certificate information", - }, - []string{"fingerprint_sha256", "subject", "issuer", "subjectalternative", "serialnumber"}, - ) - - probeTLSVersion = prometheus.NewGaugeVec( - probeTLSInfoGaugeOpts, - []string{"version"}, - ) - - probeTLSCipher = prometheus.NewGaugeVec( - probeTLSCipherGaugeOpts, - []string{"cipher"}, - ) - - probeHTTPVersionGauge = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_http_version", - Help: "Returns the version of HTTP of the probe response", - }) - - probeFailedDueToRegex = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_failed_due_to_regex", - Help: "Indicates if probe failed due to regex", - }) - - probeFailedDueToCEL = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_failed_due_to_cel", - Help: "Indicates if probe failed due to CEL expression not matching", - }) - - probeHTTPLastModified = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_http_last_modified_timestamp_seconds", - Help: "Returns the Last-Modified HTTP response header in unixtime", - }) + durationGaugeVec = httpmetrics.NewProbeDurationSeconds() + contentLengthGauge = httpmetrics.NewProbeContentLength().With() + bodyUncompressedLengthGauge = httpmetrics.NewProbeUncompressedBodyLength().With() + redirectsGauge = httpmetrics.NewProbeRedirects().With() + isSSLGauge = httpmetrics.NewProbeSsl().With() + statusCodeGauge = httpmetrics.NewProbeStatusCode().With() + probeSSLEarliestCertExpiryGauge = sslmetrics.NewProbeEarliestCertExpiry().With() + probeSSLLastChainExpiryTimestampSeconds = sslmetrics.NewProbeLastChainExpiryTimestampSeconds().With() + probeSSLLastInformation = sslmetrics.NewProbeLastChainInfo() + probeTLSVersion = tlsmetrics.NewProbeVersion() + probeTLSCipher = tlsmetrics.NewProbeCipher() + probeHTTPVersionGauge = httpmetrics.NewProbeVersion().With() + probeFailedDueToRegex = httpmetrics.NewProbeFailedDueToRegex().With() + probeFailedDueToCEL = httpmetrics.NewProbeFailedDueToCel().With() + probeHTTPLastModified = httpmetrics.NewProbeLastModifiedTimestampSeconds().With() ) registry.MustRegister(durationGaugeVec) @@ -393,7 +344,7 @@ func ProbeHTTP(ctx context.Context, target string, module config.Module, registr if !module.HTTP.SkipResolvePhaseWithProxy || module.HTTP.HTTPClientConfig.ProxyURL.URL == nil || module.HTTP.HTTPClientConfig.ProxyFromEnvironment { var lookupTime float64 ip, lookupTime, err = chooseProtocol(ctx, module.HTTP.IPProtocol, module.HTTP.IPProtocolFallback, targetHost, registry, logger) - durationGaugeVec.WithLabelValues("resolve").Add(lookupTime) + durationGaugeVec.With(other.PhaseResolve).Add(lookupTime) if err != nil { logger.Error("Error resolving address", "err", err) return false @@ -521,8 +472,8 @@ func ProbeHTTP(ctx context.Context, target string, module config.Module, registr } request = request.WithContext(httptrace.WithClientTrace(request.Context(), trace)) - for _, lv := range []string{"connect", "tls", "processing", "transfer"} { - durationGaugeVec.WithLabelValues(lv) + for _, lv := range []other.AttrPhase{other.PhaseConnect, other.PhaseTLS, other.PhaseProcessing, other.PhaseTransfer} { + durationGaugeVec.With(lv) } resp, err := client.Do(request) @@ -684,7 +635,7 @@ func ProbeHTTP(ctx context.Context, target string, module config.Module, registr ) // We get the duration for the first request from chooseProtocol. if i != 0 { - durationGaugeVec.WithLabelValues("resolve").Add(trace.dnsDone.Sub(trace.start).Seconds()) + durationGaugeVec.With(other.PhaseResolve).Add(trace.dnsDone.Sub(trace.start).Seconds()) } // Continue here if we never got a connection because a request failed. if trace.gotConn.IsZero() { @@ -692,34 +643,40 @@ func ProbeHTTP(ctx context.Context, target string, module config.Module, registr } if trace.tls { // dnsDone must be set if gotConn was set. - durationGaugeVec.WithLabelValues("connect").Add(trace.connectDone.Sub(trace.dnsDone).Seconds()) - durationGaugeVec.WithLabelValues("tls").Add(trace.tlsDone.Sub(trace.tlsStart).Seconds()) + durationGaugeVec.With(other.PhaseConnect).Add(trace.connectDone.Sub(trace.dnsDone).Seconds()) + durationGaugeVec.With(other.PhaseTLS).Add(trace.tlsDone.Sub(trace.tlsStart).Seconds()) } else { - durationGaugeVec.WithLabelValues("connect").Add(trace.gotConn.Sub(trace.dnsDone).Seconds()) + durationGaugeVec.With(other.PhaseConnect).Add(trace.gotConn.Sub(trace.dnsDone).Seconds()) } // Continue here if we never got a response from the server. if trace.responseStart.IsZero() { continue } - durationGaugeVec.WithLabelValues("processing").Add(trace.responseStart.Sub(trace.gotConn).Seconds()) + durationGaugeVec.With(other.PhaseProcessing).Add(trace.responseStart.Sub(trace.gotConn).Seconds()) // Continue here if we never read the full response from the server. // Usually this means that request either failed or was redirected. if trace.end.IsZero() { continue } - durationGaugeVec.WithLabelValues("transfer").Add(trace.end.Sub(trace.responseStart).Seconds()) + durationGaugeVec.With(other.PhaseTransfer).Add(trace.end.Sub(trace.responseStart).Seconds()) } if resp.TLS != nil { isSSLGauge.Set(float64(1)) registry.MustRegister(probeSSLEarliestCertExpiryGauge, probeTLSVersion, probeTLSCipher, probeSSLLastChainExpiryTimestampSeconds, probeSSLLastInformation) probeSSLEarliestCertExpiryGauge.Set(float64(getEarliestCertExpiry(resp.TLS).Unix())) - probeTLSVersion.WithLabelValues(getTLSVersion(resp.TLS)).Set(1) - probeTLSCipher.WithLabelValues(getTLSCipher(resp.TLS)).Set(1) + probeTLSVersion.With(other.AttrVersion(getTLSVersion(resp.TLS))).Set(1) + probeTLSCipher.With(other.AttrCipher(getTLSCipher(resp.TLS))).Set(1) probeSSLLastChainExpiryTimestampSeconds.Set(float64(getLastChainExpiry(resp.TLS).Unix())) - probeSSLLastInformation.WithLabelValues(getFingerprint(resp.TLS), getSubject(resp.TLS), getIssuer(resp.TLS), getDNSNames(resp.TLS), getSerialNumber(resp.TLS)).Set(1) + probeSSLLastInformation.With( + other.AttrFingerprintSha256(getFingerprint(resp.TLS)), + other.AttrIssuer(getIssuer(resp.TLS)), + other.AttrSerialnumber(getSerialNumber(resp.TLS)), + other.AttrSubject(getSubject(resp.TLS)), + other.AttrSubjectalternative(getDNSNames(resp.TLS)), + ).Set(1) if httpConfig.FailIfSSL { logger.Error("Final request was over SSL") success = false diff --git a/semconv/dns/registry.yaml b/semconv/dns/registry.yaml deleted file mode 100644 index 0e14104f..00000000 --- a/semconv/dns/registry.yaml +++ /dev/null @@ -1,11 +0,0 @@ -# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json -groups: - - id: registry.dns - type: attribute_group - brief: DNS attributes - attributes: - - id: phase - type: string - stability: stable - brief: "DNS phase" - examples: ["resolve", "connect", "request"] diff --git a/semconv/http/metrics.yaml b/semconv/http/metrics.yaml new file mode 100644 index 00000000..90e9eb29 --- /dev/null +++ b/semconv/http/metrics.yaml @@ -0,0 +1,84 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json +groups: + - id: metric.http.probe.duration.seconds + type: metric + metric_name: probe_http_duration_seconds + brief: "Duration of http request by phase, summed over all redirects" + instrument: "gauge" + unit: "s" + attributes: + - ref: phase + requirement_level: required + stability: stable + + - id: metric.http.probe.content.length + type: metric + metric_name: probe_http_content_length + brief: "Length of http content response" + instrument: "gauge" + unit: "By" + stability: stable + + - id: metric.http.probe.uncompressed.body.length + type: metric + metric_name: probe_http_uncompressed_body_length + brief: "Length of uncompressed response body" + instrument: "gauge" + unit: "By" + stability: stable + + - id: metric.http.probe.redirects + type: metric + metric_name: probe_http_redirects + brief: "The number of redirects" + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.http.probe.ssl + type: metric + metric_name: probe_http_ssl + brief: "Indicates if SSL was used for the final redirect" + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.http.probe.status.code + type: metric + metric_name: probe_http_status_code + brief: "Response HTTP status code" + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.http.probe.version + type: metric + metric_name: probe_http_version + brief: "Returns the version of HTTP of the probe response" + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.http.probe.failed.due.to.regex + type: metric + metric_name: probe_failed_due_to_regex + brief: "Indicates if probe failed due to regex" + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.http.probe.failed.due.to.cel + type: metric + metric_name: probe_failed_due_to_cel + brief: "Indicates if probe failed due to CEL expression not matching" + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.http.probe.last.modified.timestamp.seconds + type: metric + metric_name: probe_http_last_modified_timestamp_seconds + brief: "Returns the Last-Modified HTTP response header in unixtime" + instrument: "gauge" + unit: "s" + stability: stable diff --git a/semconv/other/registry.yaml b/semconv/other/registry.yaml new file mode 100644 index 00000000..72dc685c --- /dev/null +++ b/semconv/other/registry.yaml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json +groups: + - id: registry.other + type: attribute_group + brief: Unqualified attributes + attributes: + - id: phase + type: + members: + - { id: "resolve", value: "resolve", stability: stable } + - { id: "connect", value: "connect", stability: stable } + - { id: "request", value: "request", stability: stable } + - { id: "tls", value: "tls", stability: stable } + - { id: "processing", value: "processing", stability: stable } + - { id: "transfer", value: "transfer", stability: stable } + - { id: "setup", value: "setup", stability: stable } + - { id: "rtt", value: "rtt", stability: stable } + - { id: "check", value: "check", stability: stable } + stability: stable + brief: "Probe phase" diff --git a/semconv/tls/metrics.yaml b/semconv/tls/metrics.yaml new file mode 100644 index 00000000..2d8cc720 --- /dev/null +++ b/semconv/tls/metrics.yaml @@ -0,0 +1,58 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json +groups: + - id: metric.ssl.probe.earliest.cert.expiry + type: metric + metric_name: probe_ssl_earliest_cert_expiry + brief: "Returns earliest SSL cert expiry date" + instrument: "gauge" + unit: "s" + stability: stable + + - id: metric.ssl.probe.last.chain.expiry.timestamp.seconds + type: metric + metric_name: probe_ssl_last_chain_expiry_timestamp_seconds + brief: "Returns last SSL chain expiry timestamp" + instrument: "gauge" + unit: "s" + stability: stable + + - id: metric.ssl.probe.last.chain.info + type: metric + metric_name: probe_ssl_last_chain_info + brief: "Contains SSL leaf certificate information" + instrument: "gauge" + unit: "1" + attributes: + - ref: fingerprint_sha256 + requirement_level: required + - ref: subject + requirement_level: required + - ref: issuer + requirement_level: required + - ref: subjectalternative + requirement_level: required + - ref: serialnumber + requirement_level: required + stability: stable + + - id: metric.tls.probe.version + type: metric + metric_name: probe_tls_version_info + brief: "Contains TLS version information" + instrument: "gauge" + unit: "1" + attributes: + - ref: version + requirement_level: required + stability: stable + + - id: metric.tls.probe.cipher + type: metric + metric_name: probe_tls_cipher_info + brief: "Contains TLS cipher information" + instrument: "gauge" + unit: "1" + attributes: + - ref: cipher + requirement_level: required + stability: stable diff --git a/semconv/tls/registry.yaml b/semconv/tls/registry.yaml new file mode 100644 index 00000000..b0f8203b --- /dev/null +++ b/semconv/tls/registry.yaml @@ -0,0 +1,48 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json +groups: + - id: registry.tls + type: attribute_group + brief: TLS attributes + attributes: + - id: fingerprint_sha256 + type: string + stability: stable + brief: "SHA256 fingerprint of the certificate" + examples: + ["e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"] + + - id: subject + type: string + stability: stable + brief: "Subject of the certificate" + examples: ["CN=example.com,O=Example Corp,L=San Francisco,ST=CA,C=US"] + + - id: issuer + type: string + stability: stable + brief: "Issuer of the certificate" + examples: ["CN=Example CA,O=Example Corp,C=US"] + + - id: subjectalternative + type: string + stability: stable + brief: "Subject alternative names of the certificate" + examples: ["DNS:example.com,DNS:www.example.com"] + + - id: serialnumber + type: string + stability: stable + brief: "Serial number of the certificate" + examples: ["1234567890abcdef"] + + - id: version + type: string + stability: stable + brief: "TLS version" + examples: ["TLS 1.3", "TLS 1.2"] + + - id: cipher + type: string + stability: stable + brief: "TLS cipher suite" + examples: ["TLS_AES_256_GCM_SHA384", "ECDHE-RSA-AES256-GCM-SHA384"] From e5081fdb6e305690b510952b2a7ed794c4c381bb Mon Sep 17 00:00:00 2001 From: sh0rez Date: Fri, 13 Jun 2025 13:16:49 +0200 Subject: [PATCH 4/7] *: fully schematize metrics --- config/config.go | 23 +- .../metric_blackbox_module_unknown.go | 265 ++++++++++ ...g_last_reload_success_timestamp_seconds.go | 265 ++++++++++ .../metric_config_last_reload_successful.go | 265 ++++++++++ .../dns/metric_dns_probe_additional_rrs.go | 34 +- .../dns/metric_dns_probe_answer_rrs.go | 34 +- .../dns/metric_dns_probe_authority_rrs.go | 34 +- .../dns/metric_dns_probe_duration_seconds.go | 4 +- .../dns/metric_dns_probe_query_succeeded.go | 34 +- .../metrics/dns/metric_dns_probe_serial.go | 265 ++++++++++ .../metric_grpc_probe_duration_seconds.go | 456 +++++++++++++++++ .../metric_grpc_probe_healthcheck_response.go | 376 ++++++++++++++ .../metrics/grpc/metric_grpc_probe_ssl.go | 265 ++++++++++ .../grpc/metric_grpc_probe_status_code.go | 265 ++++++++++ .../http/metric_http_probe_content_length.go | 34 +- .../metric_http_probe_duration_seconds.go | 4 +- .../metric_http_probe_failed_due_to_cel.go | 34 +- ...p_probe_last_modified_timestamp_seconds.go | 34 +- .../http/metric_http_probe_redirects.go | 34 +- .../metrics/http/metric_http_probe_ssl.go | 34 +- .../http/metric_http_probe_status_code.go | 34 +- ...ric_http_probe_uncompressed_body_length.go | 34 +- .../metrics/http/metric_http_probe_version.go | 34 +- .../metric_icmp_probe_duration_seconds.go | 456 +++++++++++++++++ .../icmp/metric_icmp_probe_reply_hop_limit.go | 265 ++++++++++ internal/metrics/metrics.md | 472 ++++++++++++++++++ internal/metrics/other/attributes.go | 112 +++++ .../metric_probe_dns_lookup_time_seconds.go | 265 ++++++++++ .../probe/metric_probe_duration_seconds.go | 265 ++++++++++ .../metric_probe_failed_due_to_regex.go} | 50 +- .../probe/metric_probe_ip_addr_hash.go | 265 ++++++++++ .../metrics/probe/metric_probe_ip_protocol.go | 265 ++++++++++ .../metrics/probe/metric_probe_success.go | 265 ++++++++++ .../metric_ssl_probe_earliest_cert_expiry.go | 34 +- ...obe_last_chain_expiry_timestamp_seconds.go | 34 +- .../ssl/metric_ssl_probe_last_chain_info.go | 4 +- .../tcp/metric_tcp_probe_expect_info.go | 266 ++++++++++ .../metrics/tls/metric_tls_probe_cipher.go | 4 +- .../metrics/tls/metric_tls_probe_version.go | 4 +- main.go | 7 +- prober/dns.go | 13 +- prober/grpc.go | 77 ++- prober/handler.go | 11 +- prober/http.go | 23 +- prober/icmp.go | 24 +- prober/tcp.go | 48 +- prober/tls.go | 34 +- prober/utils.go | 27 +- prober/utils_test.go | 3 +- semconv/blackbox/metrics.yaml | 9 + semconv/config/metrics.yaml | 17 + semconv/dns/metrics.yaml | 8 + semconv/grpc/metrics.yaml | 39 ++ semconv/grpc/registry.yaml | 24 + semconv/http/metrics.yaml | 8 - semconv/icmp/metrics.yaml | 20 + semconv/icmp/registry.yaml | 11 + semconv/probe/metrics.yaml | 49 ++ semconv/tcp/metrics.yaml | 10 + 59 files changed, 5845 insertions(+), 504 deletions(-) create mode 100644 internal/metrics/blackbox/metric_blackbox_module_unknown.go create mode 100644 internal/metrics/config/metric_config_last_reload_success_timestamp_seconds.go create mode 100644 internal/metrics/config/metric_config_last_reload_successful.go create mode 100644 internal/metrics/dns/metric_dns_probe_serial.go create mode 100644 internal/metrics/grpc/metric_grpc_probe_duration_seconds.go create mode 100644 internal/metrics/grpc/metric_grpc_probe_healthcheck_response.go create mode 100644 internal/metrics/grpc/metric_grpc_probe_ssl.go create mode 100644 internal/metrics/grpc/metric_grpc_probe_status_code.go create mode 100644 internal/metrics/icmp/metric_icmp_probe_duration_seconds.go create mode 100644 internal/metrics/icmp/metric_icmp_probe_reply_hop_limit.go create mode 100644 internal/metrics/metrics.md create mode 100644 internal/metrics/probe/metric_probe_dns_lookup_time_seconds.go create mode 100644 internal/metrics/probe/metric_probe_duration_seconds.go rename internal/metrics/{http/metric_http_probe_failed_due_to_regex.go => probe/metric_probe_failed_due_to_regex.go} (84%) create mode 100644 internal/metrics/probe/metric_probe_ip_addr_hash.go create mode 100644 internal/metrics/probe/metric_probe_ip_protocol.go create mode 100644 internal/metrics/probe/metric_probe_success.go create mode 100644 internal/metrics/tcp/metric_tcp_probe_expect_info.go create mode 100644 semconv/blackbox/metrics.yaml create mode 100644 semconv/config/metrics.yaml create mode 100644 semconv/grpc/metrics.yaml create mode 100644 semconv/grpc/registry.yaml create mode 100644 semconv/icmp/metrics.yaml create mode 100644 semconv/icmp/registry.yaml create mode 100644 semconv/probe/metrics.yaml create mode 100644 semconv/tcp/metrics.yaml diff --git a/config/config.go b/config/config.go index 24666605..5e40413c 100644 --- a/config/config.go +++ b/config/config.go @@ -33,8 +33,8 @@ import ( "github.com/alecthomas/units" "github.com/miekg/dns" + configmetrics "github.com/prometheus/blackbox_exporter/internal/metrics/config" "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/common/config" ) @@ -90,18 +90,17 @@ type SafeConfig struct { } func NewSafeConfig(reg prometheus.Registerer) *SafeConfig { - configReloadSuccess := promauto.With(reg).NewGauge(prometheus.GaugeOpts{ - Namespace: "blackbox_exporter", - Name: "config_last_reload_successful", - Help: "Blackbox exporter config loaded successfully.", - }) + configReloadSuccessMetric := configmetrics.NewLastReloadSuccessful() + configReloadSecondsMetric := configmetrics.NewLastReloadSuccessTimestampSeconds() - configReloadSeconds := promauto.With(reg).NewGauge(prometheus.GaugeOpts{ - Namespace: "blackbox_exporter", - Name: "config_last_reload_success_timestamp_seconds", - Help: "Timestamp of the last successful configuration reload.", - }) - return &SafeConfig{C: &Config{}, configReloadSuccess: configReloadSuccess, configReloadSeconds: configReloadSeconds} + reg.MustRegister(configReloadSuccessMetric) + reg.MustRegister(configReloadSecondsMetric) + + return &SafeConfig{ + C: &Config{}, + configReloadSuccess: configReloadSuccessMetric, + configReloadSeconds: configReloadSecondsMetric, + } } func (sc *SafeConfig) ReloadConfig(confFile string, logger *slog.Logger) (err error) { diff --git a/internal/metrics/blackbox/metric_blackbox_module_unknown.go b/internal/metrics/blackbox/metric_blackbox_module_unknown.go new file mode 100644 index 00000000..78ab885c --- /dev/null +++ b/internal/metrics/blackbox/metric_blackbox_module_unknown.go @@ -0,0 +1,265 @@ +package blackbox + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Count of unknown modules requested by probes +type ModuleUnknown struct { + prometheus.Counter +} + +func NewModuleUnknown() ModuleUnknown { + return ModuleUnknown{Counter: prometheus.NewCounter(prometheus.CounterOpts{ + Name: "blackbox_module_unknown_total", + Help: "Count of unknown modules requested by probes", + })} +} + +func (m ModuleUnknown) Register(regs ...prometheus.Registerer) ModuleUnknown { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m +} + +/* +State { + name: "scalar.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "Instr": "Counter", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "module.unknown", + "Type": "ModuleUnknown", + "ctx": { + "attributes": [], + "brief": "Count of unknown modules requested by probes", + "events": [], + "id": "metric.blackbox.module.unknown", + "instrument": "counter", + "lineage": { + "provenance": { + "path": "../../semconv/blackbox/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "blackbox_module_unknown_total", + "name": none, + "root_namespace": "blackbox", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "scalar.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/config/metric_config_last_reload_success_timestamp_seconds.go b/internal/metrics/config/metric_config_last_reload_success_timestamp_seconds.go new file mode 100644 index 00000000..2f9d78e3 --- /dev/null +++ b/internal/metrics/config/metric_config_last_reload_success_timestamp_seconds.go @@ -0,0 +1,265 @@ +package config + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Timestamp of the last successful configuration reload +type LastReloadSuccessTimestampSeconds struct { + prometheus.Gauge +} + +func NewLastReloadSuccessTimestampSeconds() LastReloadSuccessTimestampSeconds { + return LastReloadSuccessTimestampSeconds{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "blackbox_exporter_config_last_reload_success_timestamp_seconds", + Help: "Timestamp of the last successful configuration reload", + })} +} + +func (m LastReloadSuccessTimestampSeconds) Register(regs ...prometheus.Registerer) LastReloadSuccessTimestampSeconds { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m +} + +/* +State { + name: "scalar.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "last.reload.success.timestamp.seconds", + "Type": "LastReloadSuccessTimestampSeconds", + "ctx": { + "attributes": [], + "brief": "Timestamp of the last successful configuration reload", + "events": [], + "id": "metric.config.last.reload.success.timestamp.seconds", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/config/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "blackbox_exporter_config_last_reload_success_timestamp_seconds", + "name": none, + "root_namespace": "config", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "s", + }, + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "scalar.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/config/metric_config_last_reload_successful.go b/internal/metrics/config/metric_config_last_reload_successful.go new file mode 100644 index 00000000..b266cfee --- /dev/null +++ b/internal/metrics/config/metric_config_last_reload_successful.go @@ -0,0 +1,265 @@ +package config + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Blackbox exporter config loaded successfully +type LastReloadSuccessful struct { + prometheus.Gauge +} + +func NewLastReloadSuccessful() LastReloadSuccessful { + return LastReloadSuccessful{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "blackbox_exporter_config_last_reload_successful", + Help: "Blackbox exporter config loaded successfully", + })} +} + +func (m LastReloadSuccessful) Register(regs ...prometheus.Registerer) LastReloadSuccessful { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m +} + +/* +State { + name: "scalar.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "last.reload.successful", + "Type": "LastReloadSuccessful", + "ctx": { + "attributes": [], + "brief": "Blackbox exporter config loaded successfully", + "events": [], + "id": "metric.config.last.reload.successful", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/config/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "blackbox_exporter_config_last_reload_successful", + "name": none, + "root_namespace": "config", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "scalar.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/dns/metric_dns_probe_additional_rrs.go b/internal/metrics/dns/metric_dns_probe_additional_rrs.go index fc7d6be7..c5c70a1c 100644 --- a/internal/metrics/dns/metric_dns_probe_additional_rrs.go +++ b/internal/metrics/dns/metric_dns_probe_additional_rrs.go @@ -6,37 +6,32 @@ import ( // Returns number of entries in the additional resource record list type ProbeAdditionalRrs struct { - *prometheus.GaugeVec - extra ProbeAdditionalRrsExtra + prometheus.Gauge } func NewProbeAdditionalRrs() ProbeAdditionalRrs { - labels := []string{} - return ProbeAdditionalRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + return ProbeAdditionalRrs{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_dns_additional_rrs", Help: "Returns number of entries in the additional resource record list", - }, labels)} + })} } -func (m ProbeAdditionalRrs) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeAdditionalRrs.With] instead -func (m ProbeAdditionalRrs) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeAdditionalRrsExtra struct { +func (m ProbeAdditionalRrs) Register(regs ...prometheus.Registerer) ProbeAdditionalRrs { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeAdditionalRrsExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -46,7 +41,6 @@ State { }, "Name": "probe.additional.rrs", "Type": "ProbeAdditionalRrs", - "attributes": [], "ctx": { "attributes": [], "brief": "Returns number of entries in the additional resource record list", @@ -67,8 +61,6 @@ State { "type": "metric", "unit": "1", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/dns/metric_dns_probe_answer_rrs.go b/internal/metrics/dns/metric_dns_probe_answer_rrs.go index 349c68f2..788e1b73 100644 --- a/internal/metrics/dns/metric_dns_probe_answer_rrs.go +++ b/internal/metrics/dns/metric_dns_probe_answer_rrs.go @@ -6,37 +6,32 @@ import ( // Returns number of entries in the answer resource record list type ProbeAnswerRrs struct { - *prometheus.GaugeVec - extra ProbeAnswerRrsExtra + prometheus.Gauge } func NewProbeAnswerRrs() ProbeAnswerRrs { - labels := []string{} - return ProbeAnswerRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + return ProbeAnswerRrs{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_dns_answer_rrs", Help: "Returns number of entries in the answer resource record list", - }, labels)} + })} } -func (m ProbeAnswerRrs) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeAnswerRrs.With] instead -func (m ProbeAnswerRrs) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeAnswerRrsExtra struct { +func (m ProbeAnswerRrs) Register(regs ...prometheus.Registerer) ProbeAnswerRrs { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeAnswerRrsExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -46,7 +41,6 @@ State { }, "Name": "probe.answer.rrs", "Type": "ProbeAnswerRrs", - "attributes": [], "ctx": { "attributes": [], "brief": "Returns number of entries in the answer resource record list", @@ -67,8 +61,6 @@ State { "type": "metric", "unit": "1", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/dns/metric_dns_probe_authority_rrs.go b/internal/metrics/dns/metric_dns_probe_authority_rrs.go index b7bd77eb..bcb1766f 100644 --- a/internal/metrics/dns/metric_dns_probe_authority_rrs.go +++ b/internal/metrics/dns/metric_dns_probe_authority_rrs.go @@ -6,37 +6,32 @@ import ( // Returns number of entries in the authority resource record list type ProbeAuthorityRrs struct { - *prometheus.GaugeVec - extra ProbeAuthorityRrsExtra + prometheus.Gauge } func NewProbeAuthorityRrs() ProbeAuthorityRrs { - labels := []string{} - return ProbeAuthorityRrs{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + return ProbeAuthorityRrs{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_dns_authority_rrs", Help: "Returns number of entries in the authority resource record list", - }, labels)} + })} } -func (m ProbeAuthorityRrs) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeAuthorityRrs.With] instead -func (m ProbeAuthorityRrs) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeAuthorityRrsExtra struct { +func (m ProbeAuthorityRrs) Register(regs ...prometheus.Registerer) ProbeAuthorityRrs { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeAuthorityRrsExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -46,7 +41,6 @@ State { }, "Name": "probe.authority.rrs", "Type": "ProbeAuthorityRrs", - "attributes": [], "ctx": { "attributes": [], "brief": "Returns number of entries in the authority resource record list", @@ -67,8 +61,6 @@ State { "type": "metric", "unit": "1", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/dns/metric_dns_probe_duration_seconds.go b/internal/metrics/dns/metric_dns_probe_duration_seconds.go index bba9607e..ede4949b 100644 --- a/internal/metrics/dns/metric_dns_probe_duration_seconds.go +++ b/internal/metrics/dns/metric_dns_probe_duration_seconds.go @@ -36,7 +36,7 @@ type ProbeDurationSecondsExtra struct { /* State { - name: "metric.go.j2", + name: "vec.go.j2", current_block: None, auto_escape: None, ctx: { @@ -449,7 +449,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "vec.go.j2", ], }, } diff --git a/internal/metrics/dns/metric_dns_probe_query_succeeded.go b/internal/metrics/dns/metric_dns_probe_query_succeeded.go index eeb94455..f98a85cc 100644 --- a/internal/metrics/dns/metric_dns_probe_query_succeeded.go +++ b/internal/metrics/dns/metric_dns_probe_query_succeeded.go @@ -6,37 +6,32 @@ import ( // Displays whether or not the query was executed successfully type ProbeQuerySucceeded struct { - *prometheus.GaugeVec - extra ProbeQuerySucceededExtra + prometheus.Gauge } func NewProbeQuerySucceeded() ProbeQuerySucceeded { - labels := []string{} - return ProbeQuerySucceeded{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + return ProbeQuerySucceeded{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_dns_query_succeeded", Help: "Displays whether or not the query was executed successfully", - }, labels)} + })} } -func (m ProbeQuerySucceeded) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeQuerySucceeded.With] instead -func (m ProbeQuerySucceeded) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeQuerySucceededExtra struct { +func (m ProbeQuerySucceeded) Register(regs ...prometheus.Registerer) ProbeQuerySucceeded { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeQuerySucceededExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -46,7 +41,6 @@ State { }, "Name": "probe.query.succeeded", "Type": "ProbeQuerySucceeded", - "attributes": [], "ctx": { "attributes": [], "brief": "Displays whether or not the query was executed successfully", @@ -67,8 +61,6 @@ State { "type": "metric", "unit": "1", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/dns/metric_dns_probe_serial.go b/internal/metrics/dns/metric_dns_probe_serial.go new file mode 100644 index 00000000..7026a4dc --- /dev/null +++ b/internal/metrics/dns/metric_dns_probe_serial.go @@ -0,0 +1,265 @@ +package dns + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Returns the serial number of the zone +type ProbeSerial struct { + prometheus.Gauge +} + +func NewProbeSerial() ProbeSerial { + return ProbeSerial{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "probe_dns_serial", + Help: "Returns the serial number of the zone", + })} +} + +func (m ProbeSerial) Register(regs ...prometheus.Registerer) ProbeSerial { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m +} + +/* +State { + name: "scalar.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.serial", + "Type": "ProbeSerial", + "ctx": { + "attributes": [], + "brief": "Returns the serial number of the zone", + "events": [], + "id": "metric.dns.probe.serial", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/dns/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_dns_serial", + "name": none, + "root_namespace": "dns", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "scalar.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/grpc/metric_grpc_probe_duration_seconds.go b/internal/metrics/grpc/metric_grpc_probe_duration_seconds.go new file mode 100644 index 00000000..1fbe1c31 --- /dev/null +++ b/internal/metrics/grpc/metric_grpc_probe_duration_seconds.go @@ -0,0 +1,456 @@ +package grpc + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +import ( + "github.com/prometheus/blackbox_exporter/internal/metrics/other" +) + +// Duration of gRPC request by phase +type ProbeDurationSeconds struct { + *prometheus.GaugeVec + extra ProbeDurationSecondsExtra +} + +func NewProbeDurationSeconds() ProbeDurationSeconds { + labels := []string{other.AttrPhase("").Key()} + return ProbeDurationSeconds{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_grpc_duration_seconds", + Help: "Duration of gRPC request by phase", + }, labels)} +} + +func (m ProbeDurationSeconds) With(phase other.AttrPhase, extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(string(phase)) +} + +// Deprecated: Use [ProbeDurationSeconds.With] instead +func (m ProbeDurationSeconds) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeDurationSecondsExtra struct { +} + +/* +State { + name: "vec.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeDurationSecondsExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.duration.seconds", + "Type": "ProbeDurationSeconds", + "attributes": [ + { + "brief": "Probe phase", + "name": "phase", + "requirement_level": "required", + "stability": "stable", + "type": { + "members": [ + { + "brief": none, + "deprecated": none, + "id": "resolve", + "note": none, + "stability": "stable", + "value": "resolve", + }, + { + "brief": none, + "deprecated": none, + "id": "connect", + "note": none, + "stability": "stable", + "value": "connect", + }, + { + "brief": none, + "deprecated": none, + "id": "request", + "note": none, + "stability": "stable", + "value": "request", + }, + { + "brief": none, + "deprecated": none, + "id": "tls", + "note": none, + "stability": "stable", + "value": "tls", + }, + { + "brief": none, + "deprecated": none, + "id": "processing", + "note": none, + "stability": "stable", + "value": "processing", + }, + { + "brief": none, + "deprecated": none, + "id": "transfer", + "note": none, + "stability": "stable", + "value": "transfer", + }, + { + "brief": none, + "deprecated": none, + "id": "setup", + "note": none, + "stability": "stable", + "value": "setup", + }, + { + "brief": none, + "deprecated": none, + "id": "rtt", + "note": none, + "stability": "stable", + "value": "rtt", + }, + { + "brief": none, + "deprecated": none, + "id": "check", + "note": none, + "stability": "stable", + "value": "check", + }, + ], + }, + }, + ], + "ctx": { + "attributes": [ + { + "brief": "Probe phase", + "name": "phase", + "requirement_level": "required", + "stability": "stable", + "type": { + "members": [ + { + "brief": none, + "deprecated": none, + "id": "resolve", + "note": none, + "stability": "stable", + "value": "resolve", + }, + { + "brief": none, + "deprecated": none, + "id": "connect", + "note": none, + "stability": "stable", + "value": "connect", + }, + { + "brief": none, + "deprecated": none, + "id": "request", + "note": none, + "stability": "stable", + "value": "request", + }, + { + "brief": none, + "deprecated": none, + "id": "tls", + "note": none, + "stability": "stable", + "value": "tls", + }, + { + "brief": none, + "deprecated": none, + "id": "processing", + "note": none, + "stability": "stable", + "value": "processing", + }, + { + "brief": none, + "deprecated": none, + "id": "transfer", + "note": none, + "stability": "stable", + "value": "transfer", + }, + { + "brief": none, + "deprecated": none, + "id": "setup", + "note": none, + "stability": "stable", + "value": "setup", + }, + { + "brief": none, + "deprecated": none, + "id": "rtt", + "note": none, + "stability": "stable", + "value": "rtt", + }, + { + "brief": none, + "deprecated": none, + "id": "check", + "note": none, + "stability": "stable", + "value": "check", + }, + ], + }, + }, + ], + "brief": "Duration of gRPC request by phase", + "events": [], + "id": "metric.grpc.probe.duration.seconds", + "instrument": "gauge", + "lineage": { + "attributes": { + "phase": { + "inherited_fields": [ + "brief", + "note", + "stability", + ], + "locally_overridden_fields": [ + "requirement_level", + ], + "source_group": "registry.other", + }, + }, + "provenance": { + "path": "../../semconv/grpc/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_grpc_duration_seconds", + "name": none, + "root_namespace": "grpc", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "s", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "vec.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/grpc/metric_grpc_probe_healthcheck_response.go b/internal/metrics/grpc/metric_grpc_probe_healthcheck_response.go new file mode 100644 index 00000000..b304a245 --- /dev/null +++ b/internal/metrics/grpc/metric_grpc_probe_healthcheck_response.go @@ -0,0 +1,376 @@ +package grpc + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +import ( + "github.com/prometheus/blackbox_exporter/internal/metrics/other" +) + +// Response HealthCheck response +type ProbeHealthcheckResponse struct { + *prometheus.GaugeVec + extra ProbeHealthcheckResponseExtra +} + +func NewProbeHealthcheckResponse() ProbeHealthcheckResponse { + labels := []string{other.AttrServingStatus("").Key()} + return ProbeHealthcheckResponse{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_grpc_healthcheck_response", + Help: "Response HealthCheck response", + }, labels)} +} + +func (m ProbeHealthcheckResponse) With(serving_status other.AttrServingStatus, extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(string(serving_status)) +} + +// Deprecated: Use [ProbeHealthcheckResponse.With] instead +func (m ProbeHealthcheckResponse) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeHealthcheckResponseExtra struct { +} + +/* +State { + name: "vec.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeHealthcheckResponseExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.healthcheck.response", + "Type": "ProbeHealthcheckResponse", + "attributes": [ + { + "brief": "gRPC health check serving status", + "name": "serving_status", + "requirement_level": "required", + "stability": "stable", + "type": { + "members": [ + { + "brief": none, + "deprecated": none, + "id": "serving", + "note": none, + "stability": "stable", + "value": "SERVING", + }, + { + "brief": none, + "deprecated": none, + "id": "not_serving", + "note": none, + "stability": "stable", + "value": "NOT_SERVING", + }, + { + "brief": none, + "deprecated": none, + "id": "unknown", + "note": none, + "stability": "stable", + "value": "UNKNOWN", + }, + { + "brief": none, + "deprecated": none, + "id": "service_unknown", + "note": none, + "stability": "stable", + "value": "SERVICE_UNKNOWN", + }, + ], + }, + }, + ], + "ctx": { + "attributes": [ + { + "brief": "gRPC health check serving status", + "name": "serving_status", + "requirement_level": "required", + "stability": "stable", + "type": { + "members": [ + { + "brief": none, + "deprecated": none, + "id": "serving", + "note": none, + "stability": "stable", + "value": "SERVING", + }, + { + "brief": none, + "deprecated": none, + "id": "not_serving", + "note": none, + "stability": "stable", + "value": "NOT_SERVING", + }, + { + "brief": none, + "deprecated": none, + "id": "unknown", + "note": none, + "stability": "stable", + "value": "UNKNOWN", + }, + { + "brief": none, + "deprecated": none, + "id": "service_unknown", + "note": none, + "stability": "stable", + "value": "SERVICE_UNKNOWN", + }, + ], + }, + }, + ], + "brief": "Response HealthCheck response", + "events": [], + "id": "metric.grpc.probe.healthcheck.response", + "instrument": "gauge", + "lineage": { + "attributes": { + "serving_status": { + "inherited_fields": [ + "brief", + "note", + "stability", + ], + "locally_overridden_fields": [ + "requirement_level", + ], + "source_group": "registry.grpc", + }, + }, + "provenance": { + "path": "../../semconv/grpc/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_grpc_healthcheck_response", + "name": none, + "root_namespace": "grpc", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "vec.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/grpc/metric_grpc_probe_ssl.go b/internal/metrics/grpc/metric_grpc_probe_ssl.go new file mode 100644 index 00000000..b5a22412 --- /dev/null +++ b/internal/metrics/grpc/metric_grpc_probe_ssl.go @@ -0,0 +1,265 @@ +package grpc + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Indicates if SSL was used for the connection +type ProbeSsl struct { + prometheus.Gauge +} + +func NewProbeSsl() ProbeSsl { + return ProbeSsl{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "probe_grpc_ssl", + Help: "Indicates if SSL was used for the connection", + })} +} + +func (m ProbeSsl) Register(regs ...prometheus.Registerer) ProbeSsl { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m +} + +/* +State { + name: "scalar.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.ssl", + "Type": "ProbeSsl", + "ctx": { + "attributes": [], + "brief": "Indicates if SSL was used for the connection", + "events": [], + "id": "metric.grpc.probe.ssl", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/grpc/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_grpc_ssl", + "name": none, + "root_namespace": "grpc", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "scalar.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/grpc/metric_grpc_probe_status_code.go b/internal/metrics/grpc/metric_grpc_probe_status_code.go new file mode 100644 index 00000000..280139eb --- /dev/null +++ b/internal/metrics/grpc/metric_grpc_probe_status_code.go @@ -0,0 +1,265 @@ +package grpc + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Response gRPC status code +type ProbeStatusCode struct { + prometheus.Gauge +} + +func NewProbeStatusCode() ProbeStatusCode { + return ProbeStatusCode{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "probe_grpc_status_code", + Help: "Response gRPC status code", + })} +} + +func (m ProbeStatusCode) Register(regs ...prometheus.Registerer) ProbeStatusCode { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m +} + +/* +State { + name: "scalar.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.status.code", + "Type": "ProbeStatusCode", + "ctx": { + "attributes": [], + "brief": "Response gRPC status code", + "events": [], + "id": "metric.grpc.probe.status.code", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/grpc/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_grpc_status_code", + "name": none, + "root_namespace": "grpc", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "scalar.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/http/metric_http_probe_content_length.go b/internal/metrics/http/metric_http_probe_content_length.go index 08ceb9ce..3d57ec07 100644 --- a/internal/metrics/http/metric_http_probe_content_length.go +++ b/internal/metrics/http/metric_http_probe_content_length.go @@ -6,37 +6,32 @@ import ( // Length of http content response type ProbeContentLength struct { - *prometheus.GaugeVec - extra ProbeContentLengthExtra + prometheus.Gauge } func NewProbeContentLength() ProbeContentLength { - labels := []string{} - return ProbeContentLength{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + return ProbeContentLength{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_http_content_length", Help: "Length of http content response", - }, labels)} + })} } -func (m ProbeContentLength) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeContentLength.With] instead -func (m ProbeContentLength) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeContentLengthExtra struct { +func (m ProbeContentLength) Register(regs ...prometheus.Registerer) ProbeContentLength { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeContentLengthExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -46,7 +41,6 @@ State { }, "Name": "probe.content.length", "Type": "ProbeContentLength", - "attributes": [], "ctx": { "attributes": [], "brief": "Length of http content response", @@ -67,8 +61,6 @@ State { "type": "metric", "unit": "By", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/http/metric_http_probe_duration_seconds.go b/internal/metrics/http/metric_http_probe_duration_seconds.go index f8f6c055..82d033ac 100644 --- a/internal/metrics/http/metric_http_probe_duration_seconds.go +++ b/internal/metrics/http/metric_http_probe_duration_seconds.go @@ -36,7 +36,7 @@ type ProbeDurationSecondsExtra struct { /* State { - name: "metric.go.j2", + name: "vec.go.j2", current_block: None, auto_escape: None, ctx: { @@ -449,7 +449,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "vec.go.j2", ], }, } diff --git a/internal/metrics/http/metric_http_probe_failed_due_to_cel.go b/internal/metrics/http/metric_http_probe_failed_due_to_cel.go index c903b8d0..34246000 100644 --- a/internal/metrics/http/metric_http_probe_failed_due_to_cel.go +++ b/internal/metrics/http/metric_http_probe_failed_due_to_cel.go @@ -6,37 +6,32 @@ import ( // Indicates if probe failed due to CEL expression not matching type ProbeFailedDueToCel struct { - *prometheus.GaugeVec - extra ProbeFailedDueToCelExtra + prometheus.Gauge } func NewProbeFailedDueToCel() ProbeFailedDueToCel { - labels := []string{} - return ProbeFailedDueToCel{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + return ProbeFailedDueToCel{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_failed_due_to_cel", Help: "Indicates if probe failed due to CEL expression not matching", - }, labels)} + })} } -func (m ProbeFailedDueToCel) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeFailedDueToCel.With] instead -func (m ProbeFailedDueToCel) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeFailedDueToCelExtra struct { +func (m ProbeFailedDueToCel) Register(regs ...prometheus.Registerer) ProbeFailedDueToCel { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeFailedDueToCelExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -46,7 +41,6 @@ State { }, "Name": "probe.failed.due.to.cel", "Type": "ProbeFailedDueToCel", - "attributes": [], "ctx": { "attributes": [], "brief": "Indicates if probe failed due to CEL expression not matching", @@ -67,8 +61,6 @@ State { "type": "metric", "unit": "1", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/http/metric_http_probe_last_modified_timestamp_seconds.go b/internal/metrics/http/metric_http_probe_last_modified_timestamp_seconds.go index b68354a3..3993d656 100644 --- a/internal/metrics/http/metric_http_probe_last_modified_timestamp_seconds.go +++ b/internal/metrics/http/metric_http_probe_last_modified_timestamp_seconds.go @@ -6,37 +6,32 @@ import ( // Returns the Last-Modified HTTP response header in unixtime type ProbeLastModifiedTimestampSeconds struct { - *prometheus.GaugeVec - extra ProbeLastModifiedTimestampSecondsExtra + prometheus.Gauge } func NewProbeLastModifiedTimestampSeconds() ProbeLastModifiedTimestampSeconds { - labels := []string{} - return ProbeLastModifiedTimestampSeconds{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + return ProbeLastModifiedTimestampSeconds{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_http_last_modified_timestamp_seconds", Help: "Returns the Last-Modified HTTP response header in unixtime", - }, labels)} + })} } -func (m ProbeLastModifiedTimestampSeconds) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeLastModifiedTimestampSeconds.With] instead -func (m ProbeLastModifiedTimestampSeconds) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeLastModifiedTimestampSecondsExtra struct { +func (m ProbeLastModifiedTimestampSeconds) Register(regs ...prometheus.Registerer) ProbeLastModifiedTimestampSeconds { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeLastModifiedTimestampSecondsExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -46,7 +41,6 @@ State { }, "Name": "probe.last.modified.timestamp.seconds", "Type": "ProbeLastModifiedTimestampSeconds", - "attributes": [], "ctx": { "attributes": [], "brief": "Returns the Last-Modified HTTP response header in unixtime", @@ -67,8 +61,6 @@ State { "type": "metric", "unit": "s", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/http/metric_http_probe_redirects.go b/internal/metrics/http/metric_http_probe_redirects.go index a26946e1..89d45a9d 100644 --- a/internal/metrics/http/metric_http_probe_redirects.go +++ b/internal/metrics/http/metric_http_probe_redirects.go @@ -6,37 +6,32 @@ import ( // The number of redirects type ProbeRedirects struct { - *prometheus.GaugeVec - extra ProbeRedirectsExtra + prometheus.Gauge } func NewProbeRedirects() ProbeRedirects { - labels := []string{} - return ProbeRedirects{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + return ProbeRedirects{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_http_redirects", Help: "The number of redirects", - }, labels)} + })} } -func (m ProbeRedirects) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeRedirects.With] instead -func (m ProbeRedirects) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeRedirectsExtra struct { +func (m ProbeRedirects) Register(regs ...prometheus.Registerer) ProbeRedirects { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeRedirectsExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -46,7 +41,6 @@ State { }, "Name": "probe.redirects", "Type": "ProbeRedirects", - "attributes": [], "ctx": { "attributes": [], "brief": "The number of redirects", @@ -67,8 +61,6 @@ State { "type": "metric", "unit": "1", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/http/metric_http_probe_ssl.go b/internal/metrics/http/metric_http_probe_ssl.go index b78b0589..9343da16 100644 --- a/internal/metrics/http/metric_http_probe_ssl.go +++ b/internal/metrics/http/metric_http_probe_ssl.go @@ -6,37 +6,32 @@ import ( // Indicates if SSL was used for the final redirect type ProbeSsl struct { - *prometheus.GaugeVec - extra ProbeSslExtra + prometheus.Gauge } func NewProbeSsl() ProbeSsl { - labels := []string{} - return ProbeSsl{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + return ProbeSsl{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_http_ssl", Help: "Indicates if SSL was used for the final redirect", - }, labels)} + })} } -func (m ProbeSsl) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeSsl.With] instead -func (m ProbeSsl) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeSslExtra struct { +func (m ProbeSsl) Register(regs ...prometheus.Registerer) ProbeSsl { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeSslExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -46,7 +41,6 @@ State { }, "Name": "probe.ssl", "Type": "ProbeSsl", - "attributes": [], "ctx": { "attributes": [], "brief": "Indicates if SSL was used for the final redirect", @@ -67,8 +61,6 @@ State { "type": "metric", "unit": "1", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/http/metric_http_probe_status_code.go b/internal/metrics/http/metric_http_probe_status_code.go index 11b30916..a17effc9 100644 --- a/internal/metrics/http/metric_http_probe_status_code.go +++ b/internal/metrics/http/metric_http_probe_status_code.go @@ -6,37 +6,32 @@ import ( // Response HTTP status code type ProbeStatusCode struct { - *prometheus.GaugeVec - extra ProbeStatusCodeExtra + prometheus.Gauge } func NewProbeStatusCode() ProbeStatusCode { - labels := []string{} - return ProbeStatusCode{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + return ProbeStatusCode{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_http_status_code", Help: "Response HTTP status code", - }, labels)} + })} } -func (m ProbeStatusCode) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeStatusCode.With] instead -func (m ProbeStatusCode) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeStatusCodeExtra struct { +func (m ProbeStatusCode) Register(regs ...prometheus.Registerer) ProbeStatusCode { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeStatusCodeExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -46,7 +41,6 @@ State { }, "Name": "probe.status.code", "Type": "ProbeStatusCode", - "attributes": [], "ctx": { "attributes": [], "brief": "Response HTTP status code", @@ -67,8 +61,6 @@ State { "type": "metric", "unit": "1", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/http/metric_http_probe_uncompressed_body_length.go b/internal/metrics/http/metric_http_probe_uncompressed_body_length.go index 62b89d74..c6a4a117 100644 --- a/internal/metrics/http/metric_http_probe_uncompressed_body_length.go +++ b/internal/metrics/http/metric_http_probe_uncompressed_body_length.go @@ -6,37 +6,32 @@ import ( // Length of uncompressed response body type ProbeUncompressedBodyLength struct { - *prometheus.GaugeVec - extra ProbeUncompressedBodyLengthExtra + prometheus.Gauge } func NewProbeUncompressedBodyLength() ProbeUncompressedBodyLength { - labels := []string{} - return ProbeUncompressedBodyLength{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + return ProbeUncompressedBodyLength{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_http_uncompressed_body_length", Help: "Length of uncompressed response body", - }, labels)} + })} } -func (m ProbeUncompressedBodyLength) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeUncompressedBodyLength.With] instead -func (m ProbeUncompressedBodyLength) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeUncompressedBodyLengthExtra struct { +func (m ProbeUncompressedBodyLength) Register(regs ...prometheus.Registerer) ProbeUncompressedBodyLength { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeUncompressedBodyLengthExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -46,7 +41,6 @@ State { }, "Name": "probe.uncompressed.body.length", "Type": "ProbeUncompressedBodyLength", - "attributes": [], "ctx": { "attributes": [], "brief": "Length of uncompressed response body", @@ -67,8 +61,6 @@ State { "type": "metric", "unit": "By", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/http/metric_http_probe_version.go b/internal/metrics/http/metric_http_probe_version.go index e55653d6..b943e5c0 100644 --- a/internal/metrics/http/metric_http_probe_version.go +++ b/internal/metrics/http/metric_http_probe_version.go @@ -6,37 +6,32 @@ import ( // Returns the version of HTTP of the probe response type ProbeVersion struct { - *prometheus.GaugeVec - extra ProbeVersionExtra + prometheus.Gauge } func NewProbeVersion() ProbeVersion { - labels := []string{} - return ProbeVersion{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + return ProbeVersion{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_http_version", Help: "Returns the version of HTTP of the probe response", - }, labels)} + })} } -func (m ProbeVersion) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeVersion.With] instead -func (m ProbeVersion) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeVersionExtra struct { +func (m ProbeVersion) Register(regs ...prometheus.Registerer) ProbeVersion { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeVersionExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -46,7 +41,6 @@ State { }, "Name": "probe.version", "Type": "ProbeVersion", - "attributes": [], "ctx": { "attributes": [], "brief": "Returns the version of HTTP of the probe response", @@ -67,8 +61,6 @@ State { "type": "metric", "unit": "1", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/icmp/metric_icmp_probe_duration_seconds.go b/internal/metrics/icmp/metric_icmp_probe_duration_seconds.go new file mode 100644 index 00000000..996defd6 --- /dev/null +++ b/internal/metrics/icmp/metric_icmp_probe_duration_seconds.go @@ -0,0 +1,456 @@ +package icmp + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +import ( + "github.com/prometheus/blackbox_exporter/internal/metrics/other" +) + +// Duration of icmp request by phase +type ProbeDurationSeconds struct { + *prometheus.GaugeVec + extra ProbeDurationSecondsExtra +} + +func NewProbeDurationSeconds() ProbeDurationSeconds { + labels := []string{other.AttrPhase("").Key()} + return ProbeDurationSeconds{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + Name: "probe_icmp_duration_seconds", + Help: "Duration of icmp request by phase", + }, labels)} +} + +func (m ProbeDurationSeconds) With(phase other.AttrPhase, extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(string(phase)) +} + +// Deprecated: Use [ProbeDurationSeconds.With] instead +func (m ProbeDurationSeconds) WithLabelValues(lvs ...string) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(lvs...) +} + +type ProbeDurationSecondsExtra struct { +} + +/* +State { + name: "vec.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "AttrExtra": "ProbeDurationSecondsExtra", + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.duration.seconds", + "Type": "ProbeDurationSeconds", + "attributes": [ + { + "brief": "Probe phase", + "name": "phase", + "requirement_level": "required", + "stability": "stable", + "type": { + "members": [ + { + "brief": none, + "deprecated": none, + "id": "resolve", + "note": none, + "stability": "stable", + "value": "resolve", + }, + { + "brief": none, + "deprecated": none, + "id": "connect", + "note": none, + "stability": "stable", + "value": "connect", + }, + { + "brief": none, + "deprecated": none, + "id": "request", + "note": none, + "stability": "stable", + "value": "request", + }, + { + "brief": none, + "deprecated": none, + "id": "tls", + "note": none, + "stability": "stable", + "value": "tls", + }, + { + "brief": none, + "deprecated": none, + "id": "processing", + "note": none, + "stability": "stable", + "value": "processing", + }, + { + "brief": none, + "deprecated": none, + "id": "transfer", + "note": none, + "stability": "stable", + "value": "transfer", + }, + { + "brief": none, + "deprecated": none, + "id": "setup", + "note": none, + "stability": "stable", + "value": "setup", + }, + { + "brief": none, + "deprecated": none, + "id": "rtt", + "note": none, + "stability": "stable", + "value": "rtt", + }, + { + "brief": none, + "deprecated": none, + "id": "check", + "note": none, + "stability": "stable", + "value": "check", + }, + ], + }, + }, + ], + "ctx": { + "attributes": [ + { + "brief": "Probe phase", + "name": "phase", + "requirement_level": "required", + "stability": "stable", + "type": { + "members": [ + { + "brief": none, + "deprecated": none, + "id": "resolve", + "note": none, + "stability": "stable", + "value": "resolve", + }, + { + "brief": none, + "deprecated": none, + "id": "connect", + "note": none, + "stability": "stable", + "value": "connect", + }, + { + "brief": none, + "deprecated": none, + "id": "request", + "note": none, + "stability": "stable", + "value": "request", + }, + { + "brief": none, + "deprecated": none, + "id": "tls", + "note": none, + "stability": "stable", + "value": "tls", + }, + { + "brief": none, + "deprecated": none, + "id": "processing", + "note": none, + "stability": "stable", + "value": "processing", + }, + { + "brief": none, + "deprecated": none, + "id": "transfer", + "note": none, + "stability": "stable", + "value": "transfer", + }, + { + "brief": none, + "deprecated": none, + "id": "setup", + "note": none, + "stability": "stable", + "value": "setup", + }, + { + "brief": none, + "deprecated": none, + "id": "rtt", + "note": none, + "stability": "stable", + "value": "rtt", + }, + { + "brief": none, + "deprecated": none, + "id": "check", + "note": none, + "stability": "stable", + "value": "check", + }, + ], + }, + }, + ], + "brief": "Duration of icmp request by phase", + "events": [], + "id": "metric.icmp.probe.duration.seconds", + "instrument": "gauge", + "lineage": { + "attributes": { + "phase": { + "inherited_fields": [ + "brief", + "note", + "stability", + ], + "locally_overridden_fields": [ + "requirement_level", + ], + "source_group": "registry.other", + }, + }, + "provenance": { + "path": "../../semconv/icmp/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_icmp_duration_seconds", + "name": none, + "root_namespace": "icmp", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "s", + }, + "for_each_attr": , + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "vec.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/icmp/metric_icmp_probe_reply_hop_limit.go b/internal/metrics/icmp/metric_icmp_probe_reply_hop_limit.go new file mode 100644 index 00000000..d90a7327 --- /dev/null +++ b/internal/metrics/icmp/metric_icmp_probe_reply_hop_limit.go @@ -0,0 +1,265 @@ +package icmp + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Replied packet hop limit (TTL for ipv4) +type ProbeReplyHopLimit struct { + prometheus.Gauge +} + +func NewProbeReplyHopLimit() ProbeReplyHopLimit { + return ProbeReplyHopLimit{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "probe_icmp_reply_hop_limit", + Help: "Replied packet hop limit (TTL for ipv4)", + })} +} + +func (m ProbeReplyHopLimit) Register(regs ...prometheus.Registerer) ProbeReplyHopLimit { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m +} + +/* +State { + name: "scalar.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.reply.hop.limit", + "Type": "ProbeReplyHopLimit", + "ctx": { + "attributes": [], + "brief": "Replied packet hop limit (TTL for ipv4)", + "events": [], + "id": "metric.icmp.probe.reply.hop.limit", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/icmp/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_icmp_reply_hop_limit", + "name": none, + "root_namespace": "icmp", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "scalar.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/metrics.md b/internal/metrics/metrics.md new file mode 100644 index 00000000..67868edc --- /dev/null +++ b/internal/metrics/metrics.md @@ -0,0 +1,472 @@ +# Metrics + + +## blackbox + +### blackbox_module_unknown_total +Count of unknown modules requested by probes + +```promql +# TYPE blackbox_module_unknown_total COUNTER +blackbox_module_unknown_total{} +``` + + + + + +## config + +### blackbox_exporter_config_last_reload_success_timestamp_seconds +Timestamp of the last successful configuration reload + +```promql +# TYPE blackbox_exporter_config_last_reload_success_timestamp_seconds GAUGE +blackbox_exporter_config_last_reload_success_timestamp_seconds{} +``` + + + + +### blackbox_exporter_config_last_reload_successful +Blackbox exporter config loaded successfully + +```promql +# TYPE blackbox_exporter_config_last_reload_successful GAUGE +blackbox_exporter_config_last_reload_successful{} +``` + + + + + +## dns + +### probe_dns_additional_rrs +Returns number of entries in the additional resource record list + +```promql +# TYPE probe_dns_additional_rrs GAUGE +probe_dns_additional_rrs{} +``` + + + + +### probe_dns_answer_rrs +Returns number of entries in the answer resource record list + +```promql +# TYPE probe_dns_answer_rrs GAUGE +probe_dns_answer_rrs{} +``` + + + + +### probe_dns_authority_rrs +Returns number of entries in the authority resource record list + +```promql +# TYPE probe_dns_authority_rrs GAUGE +probe_dns_authority_rrs{} +``` + + + + +### probe_dns_duration_seconds +Duration of DNS request by phase + +```promql +# TYPE probe_dns_duration_seconds GAUGE +probe_dns_duration_seconds{phase} +``` + + +|Attribute|Type|Description| +|-|-|-| +| phase | `resolve` \| `connect` \| `request` \| `tls` \| `processing` \| `transfer` \| `setup` \| `rtt` \| `check` | Probe phase | + + + + +### probe_dns_query_succeeded +Displays whether or not the query was executed successfully + +```promql +# TYPE probe_dns_query_succeeded GAUGE +probe_dns_query_succeeded{} +``` + + + + +### probe_dns_serial +Returns the serial number of the zone + +```promql +# TYPE probe_dns_serial GAUGE +probe_dns_serial{} +``` + + + + + +## grpc + +### probe_grpc_duration_seconds +Duration of gRPC request by phase + +```promql +# TYPE probe_grpc_duration_seconds GAUGE +probe_grpc_duration_seconds{phase} +``` + + +|Attribute|Type|Description| +|-|-|-| +| phase | `resolve` \| `connect` \| `request` \| `tls` \| `processing` \| `transfer` \| `setup` \| `rtt` \| `check` | Probe phase | + + + + +### probe_grpc_healthcheck_response +Response HealthCheck response + +```promql +# TYPE probe_grpc_healthcheck_response GAUGE +probe_grpc_healthcheck_response{serving_status} +``` + + +|Attribute|Type|Description| +|-|-|-| +| serving_status | `SERVING` \| `NOT_SERVING` \| `UNKNOWN` \| `SERVICE_UNKNOWN` | gRPC health check serving status | + + + + +### probe_grpc_ssl +Indicates if SSL was used for the connection + +```promql +# TYPE probe_grpc_ssl GAUGE +probe_grpc_ssl{} +``` + + + + +### probe_grpc_status_code +Response gRPC status code + +```promql +# TYPE probe_grpc_status_code GAUGE +probe_grpc_status_code{} +``` + + + + + +## http + +### probe_failed_due_to_cel +Indicates if probe failed due to CEL expression not matching + +```promql +# TYPE probe_failed_due_to_cel GAUGE +probe_failed_due_to_cel{} +``` + + + + +### probe_http_content_length +Length of http content response + +```promql +# TYPE probe_http_content_length GAUGE +probe_http_content_length{} +``` + + + + +### probe_http_duration_seconds +Duration of http request by phase, summed over all redirects + +```promql +# TYPE probe_http_duration_seconds GAUGE +probe_http_duration_seconds{phase} +``` + + +|Attribute|Type|Description| +|-|-|-| +| phase | `resolve` \| `connect` \| `request` \| `tls` \| `processing` \| `transfer` \| `setup` \| `rtt` \| `check` | Probe phase | + + + + +### probe_http_last_modified_timestamp_seconds +Returns the Last-Modified HTTP response header in unixtime + +```promql +# TYPE probe_http_last_modified_timestamp_seconds GAUGE +probe_http_last_modified_timestamp_seconds{} +``` + + + + +### probe_http_redirects +The number of redirects + +```promql +# TYPE probe_http_redirects GAUGE +probe_http_redirects{} +``` + + + + +### probe_http_ssl +Indicates if SSL was used for the final redirect + +```promql +# TYPE probe_http_ssl GAUGE +probe_http_ssl{} +``` + + + + +### probe_http_status_code +Response HTTP status code + +```promql +# TYPE probe_http_status_code GAUGE +probe_http_status_code{} +``` + + + + +### probe_http_uncompressed_body_length +Length of uncompressed response body + +```promql +# TYPE probe_http_uncompressed_body_length GAUGE +probe_http_uncompressed_body_length{} +``` + + + + +### probe_http_version +Returns the version of HTTP of the probe response + +```promql +# TYPE probe_http_version GAUGE +probe_http_version{} +``` + + + + + +## icmp + +### probe_icmp_duration_seconds +Duration of icmp request by phase + +```promql +# TYPE probe_icmp_duration_seconds GAUGE +probe_icmp_duration_seconds{phase} +``` + + +|Attribute|Type|Description| +|-|-|-| +| phase | `resolve` \| `connect` \| `request` \| `tls` \| `processing` \| `transfer` \| `setup` \| `rtt` \| `check` | Probe phase | + + + + +### probe_icmp_reply_hop_limit +Replied packet hop limit (TTL for ipv4) + +```promql +# TYPE probe_icmp_reply_hop_limit GAUGE +probe_icmp_reply_hop_limit{} +``` + + + + + +## probe + +### probe_dns_lookup_time_seconds +Returns the time taken for probe dns lookup in seconds + +```promql +# TYPE probe_dns_lookup_time_seconds GAUGE +probe_dns_lookup_time_seconds{} +``` + + + + +### probe_duration_seconds +Returns how long the probe took to complete in seconds + +```promql +# TYPE probe_duration_seconds GAUGE +probe_duration_seconds{} +``` + + + + +### probe_failed_due_to_regex +Indicates if probe failed due to regex + +```promql +# TYPE probe_failed_due_to_regex GAUGE +probe_failed_due_to_regex{} +``` + + + + +### probe_ip_addr_hash +Specifies the hash of IP address. It's useful to detect if the IP address changes. + +```promql +# TYPE probe_ip_addr_hash GAUGE +probe_ip_addr_hash{} +``` + + + + +### probe_ip_protocol +Specifies whether probe ip protocol is IP4 or IP6 + +```promql +# TYPE probe_ip_protocol GAUGE +probe_ip_protocol{} +``` + + + + +### probe_success +Displays whether or not the probe was a success + +```promql +# TYPE probe_success GAUGE +probe_success{} +``` + + + + + +## ssl + +### probe_ssl_earliest_cert_expiry +Returns earliest SSL cert expiry date + +```promql +# TYPE probe_ssl_earliest_cert_expiry GAUGE +probe_ssl_earliest_cert_expiry{} +``` + + + + +### probe_ssl_last_chain_expiry_timestamp_seconds +Returns last SSL chain expiry timestamp + +```promql +# TYPE probe_ssl_last_chain_expiry_timestamp_seconds GAUGE +probe_ssl_last_chain_expiry_timestamp_seconds{} +``` + + + + +### probe_ssl_last_chain_info +Contains SSL leaf certificate information + +```promql +# TYPE probe_ssl_last_chain_info GAUGE +probe_ssl_last_chain_info{fingerprint_sha256, subject, issuer, subjectalternative, serialnumber} +``` + + +|Attribute|Type|Description| +|-|-|-| +| fingerprint_sha256 | string | SHA256 fingerprint of the certificate | +| subject | string | Subject of the certificate | +| issuer | string | Issuer of the certificate | +| subjectalternative | string | Subject alternative names of the certificate | +| serialnumber | string | Serial number of the certificate | + + + + + +## tcp + +### probe_expect_info +Explicit content matched + +```promql +# TYPE probe_expect_info GAUGE +probe_expect_info{} +``` + + + + + +## tls + +### probe_tls_cipher_info +Contains TLS cipher information + +```promql +# TYPE probe_tls_cipher_info GAUGE +probe_tls_cipher_info{cipher} +``` + + +|Attribute|Type|Description| +|-|-|-| +| cipher | string | TLS cipher suite | + + + + +### probe_tls_version_info +Contains TLS version information + +```promql +# TYPE probe_tls_version_info GAUGE +probe_tls_version_info{version} +``` + + +|Attribute|Type|Description| +|-|-|-| +| version | string | TLS version | + + + + diff --git a/internal/metrics/other/attributes.go b/internal/metrics/other/attributes.go index 53b17ee6..7f9c1edc 100644 --- a/internal/metrics/other/attributes.go +++ b/internal/metrics/other/attributes.go @@ -16,6 +16,14 @@ func (AttrFingerprintSha256) Recommended() {} func (AttrFingerprintSha256) Key() string { return "fingerprint_sha256" } func (a AttrFingerprintSha256) Value() string { return string(a) } +// Hop limit (TTL for IPv4) of the replied packet +type AttrHopLimit string // hop_limit + +func (AttrHopLimit) Stable() {} +func (AttrHopLimit) Recommended() {} +func (AttrHopLimit) Key() string { return "hop_limit" } +func (a AttrHopLimit) Value() string { return string(a) } + // Issuer of the certificate type AttrIssuer string // issuer @@ -50,6 +58,27 @@ func (AttrSerialnumber) Recommended() {} func (AttrSerialnumber) Key() string { return "serialnumber" } func (a AttrSerialnumber) Value() string { return string(a) } +// gRPC health check serving status +type AttrServingStatus string // serving_status + +func (AttrServingStatus) Stable() {} +func (AttrServingStatus) Recommended() {} +func (AttrServingStatus) Key() string { return "serving_status" } +func (a AttrServingStatus) Value() string { return string(a) } + +const ServingStatusServing AttrServingStatus = "SERVING" +const ServingStatusNotServing AttrServingStatus = "NOT_SERVING" +const ServingStatusUnknown AttrServingStatus = "UNKNOWN" +const ServingStatusServiceUnknown AttrServingStatus = "SERVICE_UNKNOWN" + +// gRPC status code +type AttrStatusCode string // status_code + +func (AttrStatusCode) Stable() {} +func (AttrStatusCode) Recommended() {} +func (AttrStatusCode) Key() string { return "status_code" } +func (a AttrStatusCode) Value() string { return string(a) } + // Subject of the certificate type AttrSubject string // subject @@ -104,6 +133,19 @@ func (a AttrVersion) Value() string { return string(a) } "stability": "stable", "type": "string", }, + { + "brief": "Hop limit (TTL for IPv4) of the replied packet", + "examples": [ + 64, + 128, + 255, + ], + "name": "hop_limit", + "requirement_level": "recommended", + "root_namespace": "other", + "stability": "stable", + "type": "int", + }, { "brief": "Issuer of the certificate", "examples": [ @@ -209,6 +251,76 @@ func (a AttrVersion) Value() string { return string(a) } "stability": "stable", "type": "string", }, + { + "brief": "gRPC health check serving status", + "name": "serving_status", + "requirement_level": "recommended", + "root_namespace": "other", + "stability": "stable", + "type": { + "members": [ + { + "brief": none, + "deprecated": none, + "id": "serving", + "note": none, + "stability": "stable", + "value": "SERVING", + }, + { + "brief": none, + "deprecated": none, + "id": "not_serving", + "note": none, + "stability": "stable", + "value": "NOT_SERVING", + }, + { + "brief": none, + "deprecated": none, + "id": "unknown", + "note": none, + "stability": "stable", + "value": "UNKNOWN", + }, + { + "brief": none, + "deprecated": none, + "id": "service_unknown", + "note": none, + "stability": "stable", + "value": "SERVICE_UNKNOWN", + }, + ], + }, + }, + { + "brief": "gRPC status code", + "examples": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + ], + "name": "status_code", + "requirement_level": "recommended", + "root_namespace": "other", + "stability": "stable", + "type": "int", + }, { "brief": "Subject of the certificate", "examples": [ diff --git a/internal/metrics/probe/metric_probe_dns_lookup_time_seconds.go b/internal/metrics/probe/metric_probe_dns_lookup_time_seconds.go new file mode 100644 index 00000000..161c6f3e --- /dev/null +++ b/internal/metrics/probe/metric_probe_dns_lookup_time_seconds.go @@ -0,0 +1,265 @@ +package probe + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Returns the time taken for probe dns lookup in seconds +type DnsLookupTimeSeconds struct { + prometheus.Gauge +} + +func NewDnsLookupTimeSeconds() DnsLookupTimeSeconds { + return DnsLookupTimeSeconds{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "probe_dns_lookup_time_seconds", + Help: "Returns the time taken for probe dns lookup in seconds", + })} +} + +func (m DnsLookupTimeSeconds) Register(regs ...prometheus.Registerer) DnsLookupTimeSeconds { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m +} + +/* +State { + name: "scalar.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "dns.lookup.time.seconds", + "Type": "DnsLookupTimeSeconds", + "ctx": { + "attributes": [], + "brief": "Returns the time taken for probe dns lookup in seconds", + "events": [], + "id": "metric.probe.dns.lookup.time.seconds", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/probe/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_dns_lookup_time_seconds", + "name": none, + "root_namespace": "probe", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "s", + }, + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "scalar.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/probe/metric_probe_duration_seconds.go b/internal/metrics/probe/metric_probe_duration_seconds.go new file mode 100644 index 00000000..a34da62c --- /dev/null +++ b/internal/metrics/probe/metric_probe_duration_seconds.go @@ -0,0 +1,265 @@ +package probe + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Returns how long the probe took to complete in seconds +type DurationSeconds struct { + prometheus.Gauge +} + +func NewDurationSeconds() DurationSeconds { + return DurationSeconds{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "probe_duration_seconds", + Help: "Returns how long the probe took to complete in seconds", + })} +} + +func (m DurationSeconds) Register(regs ...prometheus.Registerer) DurationSeconds { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m +} + +/* +State { + name: "scalar.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "duration.seconds", + "Type": "DurationSeconds", + "ctx": { + "attributes": [], + "brief": "Returns how long the probe took to complete in seconds", + "events": [], + "id": "metric.probe.duration.seconds", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/probe/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_duration_seconds", + "name": none, + "root_namespace": "probe", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "s", + }, + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "scalar.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/http/metric_http_probe_failed_due_to_regex.go b/internal/metrics/probe/metric_probe_failed_due_to_regex.go similarity index 84% rename from internal/metrics/http/metric_http_probe_failed_due_to_regex.go rename to internal/metrics/probe/metric_probe_failed_due_to_regex.go index b74c2280..41444ead 100644 --- a/internal/metrics/http/metric_http_probe_failed_due_to_regex.go +++ b/internal/metrics/probe/metric_probe_failed_due_to_regex.go @@ -1,42 +1,37 @@ -package http +package probe import ( "github.com/prometheus/client_golang/prometheus" ) // Indicates if probe failed due to regex -type ProbeFailedDueToRegex struct { - *prometheus.GaugeVec - extra ProbeFailedDueToRegexExtra +type FailedDueToRegex struct { + prometheus.Gauge } -func NewProbeFailedDueToRegex() ProbeFailedDueToRegex { - labels := []string{} - return ProbeFailedDueToRegex{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ +func NewFailedDueToRegex() FailedDueToRegex { + return FailedDueToRegex{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_failed_due_to_regex", Help: "Indicates if probe failed due to regex", - }, labels)} + })} } -func (m ProbeFailedDueToRegex) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeFailedDueToRegex.With] instead -func (m ProbeFailedDueToRegex) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeFailedDueToRegexExtra struct { +func (m FailedDueToRegex) Register(regs ...prometheus.Registerer) FailedDueToRegex { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeFailedDueToRegexExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -44,31 +39,28 @@ State { "histogram": "Histogram", "updowncounter": "Gauge", }, - "Name": "probe.failed.due.to.regex", - "Type": "ProbeFailedDueToRegex", - "attributes": [], + "Name": "failed.due.to.regex", + "Type": "FailedDueToRegex", "ctx": { "attributes": [], "brief": "Indicates if probe failed due to regex", "events": [], - "id": "metric.http.probe.failed.due.to.regex", + "id": "metric.probe.failed.due.to.regex", "instrument": "gauge", "lineage": { "provenance": { - "path": "../../semconv/http/metrics.yaml", + "path": "../../semconv/probe/metrics.yaml", "registry_id": "main", }, }, "metric_name": "probe_failed_due_to_regex", "name": none, - "root_namespace": "http", + "root_namespace": "probe", "span_kind": none, "stability": "stable", "type": "metric", "unit": "1", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/probe/metric_probe_ip_addr_hash.go b/internal/metrics/probe/metric_probe_ip_addr_hash.go new file mode 100644 index 00000000..035e821f --- /dev/null +++ b/internal/metrics/probe/metric_probe_ip_addr_hash.go @@ -0,0 +1,265 @@ +package probe + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Specifies the hash of IP address. It's useful to detect if the IP address changes. +type IpAddrHash struct { + prometheus.Gauge +} + +func NewIpAddrHash() IpAddrHash { + return IpAddrHash{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "probe_ip_addr_hash", + Help: "Specifies the hash of IP address. It's useful to detect if the IP address changes.", + })} +} + +func (m IpAddrHash) Register(regs ...prometheus.Registerer) IpAddrHash { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m +} + +/* +State { + name: "scalar.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "ip.addr.hash", + "Type": "IpAddrHash", + "ctx": { + "attributes": [], + "brief": "Specifies the hash of IP address. It's useful to detect if the IP address changes.", + "events": [], + "id": "metric.probe.ip.addr.hash", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/probe/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_ip_addr_hash", + "name": none, + "root_namespace": "probe", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "scalar.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/probe/metric_probe_ip_protocol.go b/internal/metrics/probe/metric_probe_ip_protocol.go new file mode 100644 index 00000000..5808ad8d --- /dev/null +++ b/internal/metrics/probe/metric_probe_ip_protocol.go @@ -0,0 +1,265 @@ +package probe + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Specifies whether probe ip protocol is IP4 or IP6 +type IpProtocol struct { + prometheus.Gauge +} + +func NewIpProtocol() IpProtocol { + return IpProtocol{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "probe_ip_protocol", + Help: "Specifies whether probe ip protocol is IP4 or IP6", + })} +} + +func (m IpProtocol) Register(regs ...prometheus.Registerer) IpProtocol { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m +} + +/* +State { + name: "scalar.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "ip.protocol", + "Type": "IpProtocol", + "ctx": { + "attributes": [], + "brief": "Specifies whether probe ip protocol is IP4 or IP6", + "events": [], + "id": "metric.probe.ip.protocol", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/probe/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_ip_protocol", + "name": none, + "root_namespace": "probe", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "scalar.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/probe/metric_probe_success.go b/internal/metrics/probe/metric_probe_success.go new file mode 100644 index 00000000..e3ddbd49 --- /dev/null +++ b/internal/metrics/probe/metric_probe_success.go @@ -0,0 +1,265 @@ +package probe + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Displays whether or not the probe was a success +type Success struct { + prometheus.Gauge +} + +func NewSuccess() Success { + return Success{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "probe_success", + Help: "Displays whether or not the probe was a success", + })} +} + +func (m Success) Register(regs ...prometheus.Registerer) Success { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m +} + +/* +State { + name: "scalar.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "success", + "Type": "Success", + "ctx": { + "attributes": [], + "brief": "Displays whether or not the probe was a success", + "events": [], + "id": "metric.probe.success", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/probe/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_success", + "name": none, + "root_namespace": "probe", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "scalar.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/ssl/metric_ssl_probe_earliest_cert_expiry.go b/internal/metrics/ssl/metric_ssl_probe_earliest_cert_expiry.go index aee389a0..68b91825 100644 --- a/internal/metrics/ssl/metric_ssl_probe_earliest_cert_expiry.go +++ b/internal/metrics/ssl/metric_ssl_probe_earliest_cert_expiry.go @@ -6,37 +6,32 @@ import ( // Returns earliest SSL cert expiry date type ProbeEarliestCertExpiry struct { - *prometheus.GaugeVec - extra ProbeEarliestCertExpiryExtra + prometheus.Gauge } func NewProbeEarliestCertExpiry() ProbeEarliestCertExpiry { - labels := []string{} - return ProbeEarliestCertExpiry{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + return ProbeEarliestCertExpiry{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_ssl_earliest_cert_expiry", Help: "Returns earliest SSL cert expiry date", - }, labels)} + })} } -func (m ProbeEarliestCertExpiry) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeEarliestCertExpiry.With] instead -func (m ProbeEarliestCertExpiry) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeEarliestCertExpiryExtra struct { +func (m ProbeEarliestCertExpiry) Register(regs ...prometheus.Registerer) ProbeEarliestCertExpiry { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeEarliestCertExpiryExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -46,7 +41,6 @@ State { }, "Name": "probe.earliest.cert.expiry", "Type": "ProbeEarliestCertExpiry", - "attributes": [], "ctx": { "attributes": [], "brief": "Returns earliest SSL cert expiry date", @@ -67,8 +61,6 @@ State { "type": "metric", "unit": "s", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/ssl/metric_ssl_probe_last_chain_expiry_timestamp_seconds.go b/internal/metrics/ssl/metric_ssl_probe_last_chain_expiry_timestamp_seconds.go index a4312e81..9af5f232 100644 --- a/internal/metrics/ssl/metric_ssl_probe_last_chain_expiry_timestamp_seconds.go +++ b/internal/metrics/ssl/metric_ssl_probe_last_chain_expiry_timestamp_seconds.go @@ -6,37 +6,32 @@ import ( // Returns last SSL chain expiry timestamp type ProbeLastChainExpiryTimestampSeconds struct { - *prometheus.GaugeVec - extra ProbeLastChainExpiryTimestampSecondsExtra + prometheus.Gauge } func NewProbeLastChainExpiryTimestampSeconds() ProbeLastChainExpiryTimestampSeconds { - labels := []string{} - return ProbeLastChainExpiryTimestampSeconds{GaugeVec: prometheus.NewGaugeVec(prometheus.GaugeOpts{ + return ProbeLastChainExpiryTimestampSeconds{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ Name: "probe_ssl_last_chain_expiry_timestamp_seconds", Help: "Returns last SSL chain expiry timestamp", - }, labels)} + })} } -func (m ProbeLastChainExpiryTimestampSeconds) With(extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues() -} - -// Deprecated: Use [ProbeLastChainExpiryTimestampSeconds.With] instead -func (m ProbeLastChainExpiryTimestampSeconds) WithLabelValues(lvs ...string) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(lvs...) -} - -type ProbeLastChainExpiryTimestampSecondsExtra struct { +func (m ProbeLastChainExpiryTimestampSeconds) Register(regs ...prometheus.Registerer) ProbeLastChainExpiryTimestampSeconds { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m } /* State { - name: "metric.go.j2", + name: "scalar.go.j2", current_block: None, auto_escape: None, ctx: { - "AttrExtra": "ProbeLastChainExpiryTimestampSecondsExtra", "Instr": "Gauge", "InstrMap": { "counter": "Counter", @@ -46,7 +41,6 @@ State { }, "Name": "probe.last.chain.expiry.timestamp.seconds", "Type": "ProbeLastChainExpiryTimestampSeconds", - "attributes": [], "ctx": { "attributes": [], "brief": "Returns last SSL chain expiry timestamp", @@ -67,8 +61,6 @@ State { "type": "metric", "unit": "s", }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", }, env: Environment { globals: { @@ -266,7 +258,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "scalar.go.j2", ], }, } diff --git a/internal/metrics/ssl/metric_ssl_probe_last_chain_info.go b/internal/metrics/ssl/metric_ssl_probe_last_chain_info.go index 60e840fd..605ceed6 100644 --- a/internal/metrics/ssl/metric_ssl_probe_last_chain_info.go +++ b/internal/metrics/ssl/metric_ssl_probe_last_chain_info.go @@ -36,7 +36,7 @@ type ProbeLastChainInfoExtra struct { /* State { - name: "metric.go.j2", + name: "vec.go.j2", current_block: None, auto_escape: None, ctx: { @@ -434,7 +434,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "vec.go.j2", ], }, } diff --git a/internal/metrics/tcp/metric_tcp_probe_expect_info.go b/internal/metrics/tcp/metric_tcp_probe_expect_info.go new file mode 100644 index 00000000..a5f4759c --- /dev/null +++ b/internal/metrics/tcp/metric_tcp_probe_expect_info.go @@ -0,0 +1,266 @@ +package tcp + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +// Explicit content matched +type ProbeExpectInfo struct { + prometheus.Gauge +} + +func NewProbeExpectInfo() ProbeExpectInfo { + return ProbeExpectInfo{Gauge: prometheus.NewGauge(prometheus.GaugeOpts{ + Name: "probe_expect_info", + Help: "Explicit content matched", + })} +} + +func (m ProbeExpectInfo) Register(regs ...prometheus.Registerer) ProbeExpectInfo { + if regs == nil { + prometheus.DefaultRegisterer.MustRegister(m) + } + for _, reg := range regs { + reg.MustRegister(m) + } + return m +} + +/* +State { + name: "scalar.go.j2", + current_block: None, + auto_escape: None, + ctx: { + "Instr": "Gauge", + "InstrMap": { + "counter": "Counter", + "gauge": "Gauge", + "histogram": "Histogram", + "updowncounter": "Gauge", + }, + "Name": "probe.expect.info", + "Type": "ProbeExpectInfo", + "ctx": { + "attributes": [], + "brief": "Explicit content matched", + "events": [], + "id": "metric.tcp.probe.expect.info", + "instrument": "gauge", + "lineage": { + "provenance": { + "path": "../../semconv/tcp/metrics.yaml", + "registry_id": "main", + }, + }, + "metric_name": "probe_expect_info", + "name": none, + "note": "This metric uses dynamic labels based on the TCP module configuration", + "root_namespace": "tcp", + "span_kind": none, + "stability": "stable", + "type": "metric", + "unit": "1", + }, + }, + env: Environment { + globals: { + "concat_if": weaver_forge::extensions::util::concat_if, + "cycler": minijinja_contrib::globals::cycler, + "debug": minijinja::functions::builtins::debug, + "dict": minijinja::functions::builtins::dict, + "joiner": minijinja_contrib::globals::joiner, + "namespace": minijinja::functions::builtins::namespace, + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + "params": { + "module": "github.com/prometheus/blackbox_exporter/internal/metrics", + }, + }, + "range": minijinja::functions::builtins::range, + "template": {}, + }, + tests: [ + "!=", + "<", + "<=", + "==", + ">", + ">=", + "array", + "boolean", + "defined", + "deprecated", + "divisibleby", + "endingwith", + "enum", + "enum_type", + "eq", + "equalto", + "escaped", + "even", + "experimental", + "false", + "filter", + "float", + "ge", + "greaterthan", + "gt", + "in", + "int", + "integer", + "iterable", + "le", + "lessthan", + "lower", + "lt", + "mapping", + "ne", + "none", + "number", + "odd", + "safe", + "sameas", + "sequence", + "simple_type", + "stable", + "startingwith", + "string", + "template_type", + "test", + "true", + "undefined", + "upper", + ], + filters: [ + "abs", + "acronym", + "ansi_bg_black", + "ansi_bg_blue", + "ansi_bg_bright_black", + "ansi_bg_bright_blue", + "ansi_bg_bright_cyan", + "ansi_bg_bright_green", + "ansi_bg_bright_magenta", + "ansi_bg_bright_red", + "ansi_bg_bright_white", + "ansi_bg_bright_yellow", + "ansi_bg_cyan", + "ansi_bg_green", + "ansi_bg_magenta", + "ansi_bg_red", + "ansi_bg_white", + "ansi_bg_yellow", + "ansi_black", + "ansi_blue", + "ansi_bold", + "ansi_bright_black", + "ansi_bright_blue", + "ansi_bright_cyan", + "ansi_bright_green", + "ansi_bright_magenta", + "ansi_bright_red", + "ansi_bright_white", + "ansi_bright_yellow", + "ansi_cyan", + "ansi_green", + "ansi_italic", + "ansi_magenta", + "ansi_red", + "ansi_strikethrough", + "ansi_underline", + "ansi_white", + "ansi_yellow", + "attr", + "attribute_id", + "attribute_namespace", + "attribute_registry_file", + "attribute_registry_namespace", + "attribute_registry_title", + "attribute_sort", + "batch", + "body_fields", + "bool", + "camel_case", + "camel_case_const", + "capitalize", + "capitalize_first", + "comment", + "comment_with_prefix", + "count", + "d", + "default", + "dictsort", + "e", + "enum_type", + "escape", + "filesizeformat", + "first", + "flatten", + "float", + "groupby", + "indent", + "instantiated_type", + "int", + "items", + "join", + "kebab_case", + "kebab_case_const", + "last", + "length", + "lines", + "list", + "lower", + "lower_case", + "map", + "map_text", + "markdown_to_html", + "max", + "metric_namespace", + "min", + "not_required", + "pascal_case", + "pascal_case_const", + "pluralize", + "pprint", + "print_member_value", + "regex_replace", + "reject", + "rejectattr", + "replace", + "required", + "reverse", + "round", + "safe", + "screaming_kebab_case", + "screaming_snake_case", + "screaming_snake_case_const", + "select", + "selectattr", + "slice", + "snake_case", + "snake_case_const", + "sort", + "split", + "split_id", + "string", + "striptags", + "sum", + "title", + "title_case", + "tojson", + "toyaml", + "trim", + "truncate", + "type_mapping", + "unique", + "upper", + "upper_case", + "urlencode", + ], + templates: [ + "scalar.go.j2", + ], + }, +} +*/ diff --git a/internal/metrics/tls/metric_tls_probe_cipher.go b/internal/metrics/tls/metric_tls_probe_cipher.go index bd40508c..7b340e85 100644 --- a/internal/metrics/tls/metric_tls_probe_cipher.go +++ b/internal/metrics/tls/metric_tls_probe_cipher.go @@ -36,7 +36,7 @@ type ProbeCipherExtra struct { /* State { - name: "metric.go.j2", + name: "vec.go.j2", current_block: None, auto_escape: None, ctx: { @@ -308,7 +308,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "vec.go.j2", ], }, } diff --git a/internal/metrics/tls/metric_tls_probe_version.go b/internal/metrics/tls/metric_tls_probe_version.go index a60d3a06..abf7aaa8 100644 --- a/internal/metrics/tls/metric_tls_probe_version.go +++ b/internal/metrics/tls/metric_tls_probe_version.go @@ -36,7 +36,7 @@ type ProbeVersionExtra struct { /* State { - name: "metric.go.j2", + name: "vec.go.j2", current_block: None, auto_escape: None, ctx: { @@ -308,7 +308,7 @@ State { "urlencode", ], templates: [ - "metric.go.j2", + "vec.go.j2", ], }, } diff --git a/main.go b/main.go index 19897f55..4ed55b24 100644 --- a/main.go +++ b/main.go @@ -31,7 +31,6 @@ import ( "github.com/alecthomas/kingpin/v2" "github.com/prometheus/client_golang/prometheus" versioncollector "github.com/prometheus/client_golang/prometheus/collectors/version" - "github.com/prometheus/client_golang/prometheus/promauto" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/common/promslog" "github.com/prometheus/common/promslog/flag" @@ -41,6 +40,7 @@ import ( "gopkg.in/yaml.v3" "github.com/prometheus/blackbox_exporter/config" + "github.com/prometheus/blackbox_exporter/internal/metrics/blackbox" "github.com/prometheus/blackbox_exporter/prober" ) @@ -56,10 +56,7 @@ var ( routePrefix = kingpin.Flag("web.route-prefix", "Prefix for the internal routes of web endpoints. Defaults to path of --web.external-url.").PlaceHolder("").String() toolkitFlags = webflag.AddFlags(kingpin.CommandLine, ":9115") - moduleUnknownCounter = promauto.NewCounter(prometheus.CounterOpts{ - Name: "blackbox_module_unknown_total", - Help: "Count of unknown modules requested by probes", - }) + moduleUnknownCounter = blackbox.NewModuleUnknown().Register() ) func init() { diff --git a/prober/dns.go b/prober/dns.go index 3a7e7394..a07e1226 100644 --- a/prober/dns.go +++ b/prober/dns.go @@ -130,10 +130,10 @@ func ProbeDNS(ctx context.Context, target string, module config.Module, registry var dialProtocol string probeDNSDurationGaugeVec := metrics.NewProbeDurationSeconds() - probeDNSAnswerRRSGauge := metrics.NewProbeAnswerRrs().With() - probeDNSAuthorityRRSGauge := metrics.NewProbeAuthorityRrs().With() - probeDNSAdditionalRRSGauge := metrics.NewProbeAdditionalRrs().With() - probeDNSQuerySucceeded := metrics.NewProbeQuerySucceeded().With() + probeDNSAnswerRRSGauge := metrics.NewProbeAnswerRrs() + probeDNSAuthorityRRSGauge := metrics.NewProbeAuthorityRrs() + probeDNSAdditionalRRSGauge := metrics.NewProbeAdditionalRrs() + probeDNSQuerySucceeded := metrics.NewProbeQuerySucceeded() for _, lv := range []other.AttrPhase{other.PhaseResolve, other.PhaseConnect, other.PhaseRequest} { probeDNSDurationGaugeVec.With(lv) } @@ -269,10 +269,7 @@ func ProbeDNS(ctx context.Context, target string, module config.Module, registry probeDNSQuerySucceeded.Set(1) if qt == dns.TypeSOA { - probeDNSSOAGauge = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_dns_serial", - Help: "Returns the serial number of the zone", - }) + probeDNSSOAGauge = metrics.NewProbeSerial() registry.MustRegister(probeDNSSOAGauge) for _, a := range response.Answer { diff --git a/prober/grpc.go b/prober/grpc.go index fe8d1eca..265db41d 100644 --- a/prober/grpc.go +++ b/prober/grpc.go @@ -22,6 +22,10 @@ import ( "time" "github.com/prometheus/blackbox_exporter/config" + metrics "github.com/prometheus/blackbox_exporter/internal/metrics/grpc" + "github.com/prometheus/blackbox_exporter/internal/metrics/other" + "github.com/prometheus/blackbox_exporter/internal/metrics/ssl" + "github.com/prometheus/blackbox_exporter/internal/metrics/tls" "github.com/prometheus/client_golang/prometheus" pconfig "github.com/prometheus/common/config" "google.golang.org/grpc" @@ -75,47 +79,16 @@ func (c *gRPCHealthCheckClient) Check(ctx context.Context, service string) (bool } func ProbeGRPC(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger *slog.Logger) (success bool) { - var ( - durationGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Name: "probe_grpc_duration_seconds", - Help: "Duration of gRPC request by phase", - }, []string{"phase"}) - - isSSLGauge = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_grpc_ssl", - Help: "Indicates if SSL was used for the connection", - }) - - statusCodeGauge = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_grpc_status_code", - Help: "Response gRPC status code", - }) - - healthCheckResponseGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Name: "probe_grpc_healthcheck_response", - Help: "Response HealthCheck response", - }, []string{"serving_status"}) - - probeSSLEarliestCertExpiryGauge = prometheus.NewGauge(sslEarliestCertExpiryGaugeOpts) - - probeTLSVersion = prometheus.NewGaugeVec( - probeTLSInfoGaugeOpts, - []string{"version"}, - ) - - probeSSLLastInformation = prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: "probe_ssl_last_chain_info", - Help: "Contains SSL leaf certificate information", - }, - []string{"fingerprint_sha256", "subject", "issuer", "subjectalternative", "serialnumber"}, - ) + durationGaugeVec = metrics.NewProbeDurationSeconds() + isSSLGauge = metrics.NewProbeSsl() + statusCodeGauge = metrics.NewProbeStatusCode() + healthCheckResponseGaugeVec = metrics.NewProbeHealthcheckResponse() + probeSSLEarliestCertExpiryGauge = ssl.NewProbeEarliestCertExpiry() + probeTLSVersion = tls.NewProbeVersion() + probeSSLLastInformation = ssl.NewProbeLastChainInfo() ) - - for _, lv := range []string{"resolve"} { - durationGaugeVec.WithLabelValues(lv) - } + durationGaugeVec.With(other.PhaseResolve) registry.MustRegister(durationGaugeVec) registry.MustRegister(isSSLGauge) @@ -149,7 +122,7 @@ func ProbeGRPC(ctx context.Context, target string, module config.Module, registr logger.Error("Error resolving address", "err", err) return false } - durationGaugeVec.WithLabelValues("resolve").Add(lookupTime) + durationGaugeVec.With(other.PhaseResolve).Add(lookupTime) checkStart := time.Now() if len(tlsConfig.ServerName) == 0 { // If there is no `server_name` in tls_config, use @@ -180,7 +153,6 @@ func ProbeGRPC(ctx context.Context, target string, module config.Module, registr } conn, err := grpc.NewClient(target, opts...) - if err != nil { logger.Error("did not connect", "err", err) } @@ -188,13 +160,18 @@ func ProbeGRPC(ctx context.Context, target string, module config.Module, registr client := NewGrpcHealthCheckClient(conn) defer conn.Close() ok, statusCode, serverPeer, servingStatus, err := client.Check(context.Background(), module.GRPC.Service) - durationGaugeVec.WithLabelValues("check").Add(time.Since(checkStart).Seconds()) + durationGaugeVec.With(other.PhaseCheck).Add(time.Since(checkStart).Seconds()) - for servingStatusName := range grpc_health_v1.HealthCheckResponse_ServingStatus_value { - healthCheckResponseGaugeVec.WithLabelValues(servingStatusName).Set(float64(0)) + for _, ss := range []other.AttrServingStatus{ + other.ServingStatusServing, + other.ServingStatusNotServing, + other.ServingStatusUnknown, + other.ServingStatusServiceUnknown, + } { + healthCheckResponseGaugeVec.With(ss).Set(float64(0)) } if servingStatus != "" { - healthCheckResponseGaugeVec.WithLabelValues(servingStatus).Set(float64(1)) + healthCheckResponseGaugeVec.With(other.AttrServingStatus(servingStatus)).Set(float64(1)) } if serverPeer != nil { @@ -203,8 +180,14 @@ func ProbeGRPC(ctx context.Context, target string, module config.Module, registr registry.MustRegister(probeSSLEarliestCertExpiryGauge, probeTLSVersion, probeSSLLastInformation) isSSLGauge.Set(float64(1)) probeSSLEarliestCertExpiryGauge.Set(float64(getEarliestCertExpiry(&tlsInfo.State).Unix())) - probeTLSVersion.WithLabelValues(getTLSVersion(&tlsInfo.State)).Set(1) - probeSSLLastInformation.WithLabelValues(getFingerprint(&tlsInfo.State), getSubject(&tlsInfo.State), getIssuer(&tlsInfo.State), getDNSNames(&tlsInfo.State), getSerialNumber(&tlsInfo.State)).Set(1) + probeTLSVersion.With(getTLSVersion(&tlsInfo.State)).Set(1) + probeSSLLastInformation.With( + getFingerprint(&tlsInfo.State), + getIssuer(&tlsInfo.State), + getSerialNumber(&tlsInfo.State), + getSubject(&tlsInfo.State), + getDNSNames(&tlsInfo.State), + ).Set(1) } else { isSSLGauge.Set(float64(0)) } diff --git a/prober/handler.go b/prober/handler.go index 6a51967b..1ef77612 100644 --- a/prober/handler.go +++ b/prober/handler.go @@ -25,6 +25,7 @@ import ( "time" "github.com/prometheus/blackbox_exporter/config" + "github.com/prometheus/blackbox_exporter/internal/metrics/probe" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/common/expfmt" @@ -73,14 +74,8 @@ func Handler(w http.ResponseWriter, r *http.Request, c *config.Config, logger *s defer cancel() r = r.WithContext(ctx) - probeSuccessGauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_success", - Help: "Displays whether or not the probe was a success", - }) - probeDurationGauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_duration_seconds", - Help: "Returns how long the probe took to complete in seconds", - }) + probeSuccessGauge := probe.NewSuccess() + probeDurationGauge := probe.NewDurationSeconds() target := params.Get("target") if target == "" { diff --git a/prober/http.go b/prober/http.go index 9ef38633..64d6caf1 100644 --- a/prober/http.go +++ b/prober/http.go @@ -45,6 +45,7 @@ import ( "github.com/prometheus/blackbox_exporter/config" httpmetrics "github.com/prometheus/blackbox_exporter/internal/metrics/http" "github.com/prometheus/blackbox_exporter/internal/metrics/other" + "github.com/prometheus/blackbox_exporter/internal/metrics/probe" sslmetrics "github.com/prometheus/blackbox_exporter/internal/metrics/ssl" tlsmetrics "github.com/prometheus/blackbox_exporter/internal/metrics/tls" ) @@ -296,20 +297,20 @@ func ProbeHTTP(ctx context.Context, target string, module config.Module, registr var redirects int var ( durationGaugeVec = httpmetrics.NewProbeDurationSeconds() - contentLengthGauge = httpmetrics.NewProbeContentLength().With() - bodyUncompressedLengthGauge = httpmetrics.NewProbeUncompressedBodyLength().With() - redirectsGauge = httpmetrics.NewProbeRedirects().With() - isSSLGauge = httpmetrics.NewProbeSsl().With() - statusCodeGauge = httpmetrics.NewProbeStatusCode().With() - probeSSLEarliestCertExpiryGauge = sslmetrics.NewProbeEarliestCertExpiry().With() - probeSSLLastChainExpiryTimestampSeconds = sslmetrics.NewProbeLastChainExpiryTimestampSeconds().With() + contentLengthGauge = httpmetrics.NewProbeContentLength() + bodyUncompressedLengthGauge = httpmetrics.NewProbeUncompressedBodyLength() + redirectsGauge = httpmetrics.NewProbeRedirects() + isSSLGauge = httpmetrics.NewProbeSsl() + statusCodeGauge = httpmetrics.NewProbeStatusCode() + probeSSLEarliestCertExpiryGauge = sslmetrics.NewProbeEarliestCertExpiry() + probeSSLLastChainExpiryTimestampSeconds = sslmetrics.NewProbeLastChainExpiryTimestampSeconds() probeSSLLastInformation = sslmetrics.NewProbeLastChainInfo() probeTLSVersion = tlsmetrics.NewProbeVersion() probeTLSCipher = tlsmetrics.NewProbeCipher() - probeHTTPVersionGauge = httpmetrics.NewProbeVersion().With() - probeFailedDueToRegex = httpmetrics.NewProbeFailedDueToRegex().With() - probeFailedDueToCEL = httpmetrics.NewProbeFailedDueToCel().With() - probeHTTPLastModified = httpmetrics.NewProbeLastModifiedTimestampSeconds().With() + probeHTTPVersionGauge = httpmetrics.NewProbeVersion() + probeFailedDueToRegex = probe.NewFailedDueToRegex() + probeFailedDueToCEL = httpmetrics.NewProbeFailedDueToCel() + probeHTTPLastModified = httpmetrics.NewProbeLastModifiedTimestampSeconds() ) registry.MustRegister(durationGaugeVec) diff --git a/prober/icmp.go b/prober/icmp.go index 2f07e6b0..f31a27a7 100644 --- a/prober/icmp.go +++ b/prober/icmp.go @@ -30,6 +30,8 @@ import ( "golang.org/x/net/ipv6" "github.com/prometheus/blackbox_exporter/config" + metrics "github.com/prometheus/blackbox_exporter/internal/metrics/icmp" + "github.com/prometheus/blackbox_exporter/internal/metrics/other" ) var ( @@ -70,21 +72,13 @@ func ProbeICMP(ctx context.Context, target string, module config.Module, registr v4RawConn *ipv4.RawConn hopLimitFlagSet = true - durationGaugeVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ - Name: "probe_icmp_duration_seconds", - Help: "Duration of icmp request by phase", - }, []string{"phase"}) - - hopLimitGauge = prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_icmp_reply_hop_limit", - Help: "Replied packet hop limit (TTL for ipv4)", - }) + durationGaugeVec = metrics.NewProbeDurationSeconds() + hopLimitGauge = metrics.NewProbeReplyHopLimit() ) - for _, lv := range []string{"resolve", "setup", "rtt"} { - durationGaugeVec.WithLabelValues(lv) + for _, lv := range []other.AttrPhase{other.PhaseResolve, other.PhaseSetup, other.PhaseRTT} { + durationGaugeVec.With(lv) } - registry.MustRegister(durationGaugeVec) dstIPAddr, lookupTime, err := chooseProtocol(ctx, module.ICMP.IPProtocol, module.ICMP.IPProtocolFallback, target, registry, logger) @@ -93,7 +87,7 @@ func ProbeICMP(ctx context.Context, target string, module config.Module, registr logger.Error("Error resolving address", "err", err) return false } - durationGaugeVec.WithLabelValues("resolve").Add(lookupTime) + durationGaugeVec.With(other.PhaseResolve).Add(lookupTime) var srcIP net.IP if len(module.ICMP.SourceIPAddress) > 0 { @@ -228,7 +222,7 @@ func ProbeICMP(ctx context.Context, target string, module config.Module, registr return } - durationGaugeVec.WithLabelValues("setup").Add(time.Since(setupStart).Seconds()) + durationGaugeVec.With(other.PhaseSetup).Add(time.Since(setupStart).Seconds()) logger.Info("Writing out packet") rttStart := time.Now() @@ -363,7 +357,7 @@ func ProbeICMP(ctx context.Context, target string, module config.Module, registr rb[3] = 0 } if bytes.Equal(rb[:n], wb) { - durationGaugeVec.WithLabelValues("rtt").Add(time.Since(rttStart).Seconds()) + durationGaugeVec.With(other.PhaseRTT).Add(time.Since(rttStart).Seconds()) if hopLimit >= 0 { hopLimitGauge.Set(hopLimit) registry.MustRegister(hopLimitGauge) diff --git a/prober/tcp.go b/prober/tcp.go index f2f1396d..6cb5c63b 100644 --- a/prober/tcp.go +++ b/prober/tcp.go @@ -21,10 +21,12 @@ import ( "log/slog" "net" + "github.com/prometheus/blackbox_exporter/config" + "github.com/prometheus/blackbox_exporter/internal/metrics/probe" + "github.com/prometheus/blackbox_exporter/internal/metrics/ssl" + tlsmetrics "github.com/prometheus/blackbox_exporter/internal/metrics/tls" "github.com/prometheus/client_golang/prometheus" pconfig "github.com/prometheus/common/config" - - "github.com/prometheus/blackbox_exporter/config" ) func dialTCP(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger *slog.Logger) (net.Conn, error) { @@ -106,23 +108,11 @@ func probeExpectInfo(registry *prometheus.Registry, qr *config.QueryResponse, by } func ProbeTCP(ctx context.Context, target string, module config.Module, registry *prometheus.Registry, logger *slog.Logger) bool { - probeSSLEarliestCertExpiry := prometheus.NewGauge(sslEarliestCertExpiryGaugeOpts) - probeSSLLastChainExpiryTimestampSeconds := prometheus.NewGauge(sslChainExpiryInTimeStampGaugeOpts) - probeSSLLastInformation := prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Name: "probe_ssl_last_chain_info", - Help: "Contains SSL leaf certificate information", - }, - []string{"fingerprint_sha256", "subject", "issuer", "subjectalternative", "serialnumber"}, - ) - probeTLSVersion := prometheus.NewGaugeVec( - probeTLSInfoGaugeOpts, - []string{"version"}, - ) - probeFailedDueToRegex := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_failed_due_to_regex", - Help: "Indicates if probe failed due to regex", - }) + probeSSLEarliestCertExpiry := ssl.NewProbeEarliestCertExpiry() + probeSSLLastChainExpiryTimestampSeconds := ssl.NewProbeLastChainExpiryTimestampSeconds() + probeSSLLastInformation := ssl.NewProbeLastChainInfo() + probeTLSVersion := tlsmetrics.NewProbeVersion() + probeFailedDueToRegex := probe.NewFailedDueToRegex() registry.MustRegister(probeFailedDueToRegex) deadline, _ := ctx.Deadline() @@ -145,9 +135,15 @@ func ProbeTCP(ctx context.Context, target string, module config.Module, registry state := conn.(*tls.Conn).ConnectionState() registry.MustRegister(probeSSLEarliestCertExpiry, probeTLSVersion, probeSSLLastChainExpiryTimestampSeconds, probeSSLLastInformation) probeSSLEarliestCertExpiry.Set(float64(getEarliestCertExpiry(&state).Unix())) - probeTLSVersion.WithLabelValues(getTLSVersion(&state)).Set(1) + probeTLSVersion.With(getTLSVersion(&state)).Set(1) probeSSLLastChainExpiryTimestampSeconds.Set(float64(getLastChainExpiry(&state).Unix())) - probeSSLLastInformation.WithLabelValues(getFingerprint(&state), getSubject(&state), getIssuer(&state), getDNSNames(&state), getSerialNumber(&state)).Set(1) + probeSSLLastInformation.With( + getFingerprint(&state), + getIssuer(&state), + getSerialNumber(&state), + getSubject(&state), + getDNSNames(&state), + ).Set(1) } scanner := bufio.NewScanner(conn) for i, qr := range module.TCP.QueryResponse { @@ -214,9 +210,15 @@ func ProbeTCP(ctx context.Context, target string, module config.Module, registry state := tlsConn.ConnectionState() registry.MustRegister(probeSSLEarliestCertExpiry, probeTLSVersion, probeSSLLastChainExpiryTimestampSeconds, probeSSLLastInformation) probeSSLEarliestCertExpiry.Set(float64(getEarliestCertExpiry(&state).Unix())) - probeTLSVersion.WithLabelValues(getTLSVersion(&state)).Set(1) + probeTLSVersion.With(getTLSVersion(&state)).Set(1) probeSSLLastChainExpiryTimestampSeconds.Set(float64(getLastChainExpiry(&state).Unix())) - probeSSLLastInformation.WithLabelValues(getFingerprint(&state), getSubject(&state), getIssuer(&state), getDNSNames(&state), getSerialNumber(&state)).Set(1) + probeSSLLastInformation.With( + getFingerprint(&state), + getIssuer(&state), + getSerialNumber(&state), + getSubject(&state), + getDNSNames(&state), + ).Set(1) } } return true diff --git a/prober/tls.go b/prober/tls.go index 0589036e..ea732ec4 100644 --- a/prober/tls.go +++ b/prober/tls.go @@ -20,6 +20,8 @@ import ( "fmt" "strings" "time" + + "github.com/prometheus/blackbox_exporter/internal/metrics/other" ) func getEarliestCertExpiry(state *tls.ConnectionState) time.Time { @@ -32,25 +34,25 @@ func getEarliestCertExpiry(state *tls.ConnectionState) time.Time { return earliest } -func getFingerprint(state *tls.ConnectionState) string { +func getFingerprint(state *tls.ConnectionState) other.AttrFingerprintSha256 { cert := state.PeerCertificates[0] fingerprint := sha256.Sum256(cert.Raw) - return hex.EncodeToString(fingerprint[:]) + return other.AttrFingerprintSha256(hex.EncodeToString(fingerprint[:])) } -func getSubject(state *tls.ConnectionState) string { +func getSubject(state *tls.ConnectionState) other.AttrSubject { cert := state.PeerCertificates[0] - return cert.Subject.String() + return other.AttrSubject(cert.Subject.String()) } -func getIssuer(state *tls.ConnectionState) string { +func getIssuer(state *tls.ConnectionState) other.AttrIssuer { cert := state.PeerCertificates[0] - return cert.Issuer.String() + return other.AttrIssuer(cert.Issuer.String()) } -func getDNSNames(state *tls.ConnectionState) string { +func getDNSNames(state *tls.ConnectionState) other.AttrSubjectalternative { cert := state.PeerCertificates[0] - return strings.Join(cert.DNSNames, ",") + return other.AttrSubjectalternative(strings.Join(cert.DNSNames, ",")) } func getLastChainExpiry(state *tls.ConnectionState) time.Time { @@ -70,26 +72,26 @@ func getLastChainExpiry(state *tls.ConnectionState) time.Time { return lastChainExpiry } -func getSerialNumber(state *tls.ConnectionState) string { +func getSerialNumber(state *tls.ConnectionState) other.AttrSerialnumber { cert := state.PeerCertificates[0] // Using `cert.SerialNumber.Text(16)` will drop the leading zeros when converting the SerialNumber to String, see https://github.com/mozilla/tls-observatory/pull/245. // To avoid that, we format in lowercase the bytes with `%x` to base 16, with lower-case letters for a-f, see https://go.dev/play/p/Fylce70N2Zl. - return fmt.Sprintf("%x", cert.SerialNumber.Bytes()) + return other.AttrSerialnumber(fmt.Sprintf("%x", cert.SerialNumber.Bytes())) } -func getTLSVersion(state *tls.ConnectionState) string { +func getTLSVersion(state *tls.ConnectionState) other.AttrVersion { switch state.Version { case tls.VersionTLS10: - return "TLS 1.0" + return other.AttrVersion("TLS 1.0") case tls.VersionTLS11: - return "TLS 1.1" + return other.AttrVersion("TLS 1.1") case tls.VersionTLS12: - return "TLS 1.2" + return other.AttrVersion("TLS 1.2") case tls.VersionTLS13: - return "TLS 1.3" + return other.AttrVersion("TLS 1.3") default: - return "unknown" + return other.AttrVersion("unknown") } } diff --git a/prober/utils.go b/prober/utils.go index 3dc4153c..720be9ba 100644 --- a/prober/utils.go +++ b/prober/utils.go @@ -21,6 +21,7 @@ import ( "net" "time" + "github.com/prometheus/blackbox_exporter/internal/metrics/probe" "github.com/prometheus/client_golang/prometheus" ) @@ -32,23 +33,15 @@ var protocolToGauge = map[string]float64{ // Returns the IP for the IPProtocol and lookup time. func chooseProtocol(ctx context.Context, IPProtocol string, fallbackIPProtocol bool, target string, registry *prometheus.Registry, logger *slog.Logger) (ip *net.IPAddr, lookupTime float64, err error) { var fallbackProtocol string - probeDNSLookupTimeSeconds := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_dns_lookup_time_seconds", - Help: "Returns the time taken for probe dns lookup in seconds", - }) - - probeIPProtocolGauge := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_ip_protocol", - Help: "Specifies whether probe ip protocol is IP4 or IP6", - }) - - probeIPAddrHash := prometheus.NewGauge(prometheus.GaugeOpts{ - Name: "probe_ip_addr_hash", - Help: "Specifies the hash of IP address. It's useful to detect if the IP address changes.", - }) - registry.MustRegister(probeIPProtocolGauge) - registry.MustRegister(probeDNSLookupTimeSeconds) - registry.MustRegister(probeIPAddrHash) + probeDNSLookupTimeSeconds := probe.NewDnsLookupTimeSeconds() + probeIPProtocolGauge := probe.NewIpProtocol() + probeIPAddrHash := probe.NewIpAddrHash() + + registry.MustRegister( + probeIPProtocolGauge, + probeDNSLookupTimeSeconds, + probeIPAddrHash, + ) if IPProtocol == "ip6" || IPProtocol == "" { IPProtocol = "ip6" diff --git a/prober/utils_test.go b/prober/utils_test.go index bc85d23d..d84ef01d 100644 --- a/prober/utils_test.go +++ b/prober/utils_test.go @@ -28,6 +28,7 @@ import ( "testing" "time" + "github.com/prometheus/blackbox_exporter/internal/metrics/other" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" "github.com/prometheus/common/promslog" @@ -256,7 +257,7 @@ func TestGetSerialNumber(t *testing.T) { tests := []struct { name string serialNumber *big.Int - expected string + expected other.AttrSerialnumber }{ { name: "Serial number with leading zeros", diff --git a/semconv/blackbox/metrics.yaml b/semconv/blackbox/metrics.yaml new file mode 100644 index 00000000..9043dc37 --- /dev/null +++ b/semconv/blackbox/metrics.yaml @@ -0,0 +1,9 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json +groups: + - id: metric.blackbox.module.unknown + type: metric + metric_name: blackbox_module_unknown_total + brief: "Count of unknown modules requested by probes" + instrument: "counter" + unit: "1" + stability: stable diff --git a/semconv/config/metrics.yaml b/semconv/config/metrics.yaml new file mode 100644 index 00000000..8765a8b8 --- /dev/null +++ b/semconv/config/metrics.yaml @@ -0,0 +1,17 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json +groups: + - id: metric.config.last.reload.successful + type: metric + metric_name: blackbox_exporter_config_last_reload_successful + brief: "Blackbox exporter config loaded successfully" + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.config.last.reload.success.timestamp.seconds + type: metric + metric_name: blackbox_exporter_config_last_reload_success_timestamp_seconds + brief: "Timestamp of the last successful configuration reload" + instrument: "gauge" + unit: "s" + stability: stable diff --git a/semconv/dns/metrics.yaml b/semconv/dns/metrics.yaml index 7754e995..fb13f3ba 100644 --- a/semconv/dns/metrics.yaml +++ b/semconv/dns/metrics.yaml @@ -42,3 +42,11 @@ groups: instrument: "gauge" unit: "1" stability: stable + + - id: metric.dns.probe.serial + type: metric + metric_name: probe_dns_serial + brief: "Returns the serial number of the zone" + instrument: "gauge" + unit: "1" + stability: stable diff --git a/semconv/grpc/metrics.yaml b/semconv/grpc/metrics.yaml new file mode 100644 index 00000000..2d3710de --- /dev/null +++ b/semconv/grpc/metrics.yaml @@ -0,0 +1,39 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json +groups: + - id: metric.grpc.probe.duration.seconds + type: metric + metric_name: probe_grpc_duration_seconds + brief: "Duration of gRPC request by phase" + instrument: "gauge" + unit: "s" + attributes: + - ref: phase + requirement_level: required + stability: stable + + - id: metric.grpc.probe.ssl + type: metric + metric_name: probe_grpc_ssl + brief: "Indicates if SSL was used for the connection" + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.grpc.probe.status.code + type: metric + metric_name: probe_grpc_status_code + brief: "Response gRPC status code" + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.grpc.probe.healthcheck.response + type: metric + metric_name: probe_grpc_healthcheck_response + brief: "Response HealthCheck response" + instrument: "gauge" + unit: "1" + attributes: + - ref: serving_status + requirement_level: required + stability: stable diff --git a/semconv/grpc/registry.yaml b/semconv/grpc/registry.yaml new file mode 100644 index 00000000..3ee5281a --- /dev/null +++ b/semconv/grpc/registry.yaml @@ -0,0 +1,24 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json +groups: + - id: registry.grpc + type: attribute_group + brief: gRPC attributes + attributes: + - id: status_code + type: int + stability: stable + brief: "gRPC status code" + examples: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] + - id: serving_status + type: + members: + - { id: "serving", value: "SERVING", stability: stable } + - { id: "not_serving", value: "NOT_SERVING", stability: stable } + - { id: "unknown", value: "UNKNOWN", stability: stable } + - { + id: "service_unknown", + value: "SERVICE_UNKNOWN", + stability: stable, + } + stability: stable + brief: "gRPC health check serving status" diff --git a/semconv/http/metrics.yaml b/semconv/http/metrics.yaml index 90e9eb29..b667785c 100644 --- a/semconv/http/metrics.yaml +++ b/semconv/http/metrics.yaml @@ -59,14 +59,6 @@ groups: unit: "1" stability: stable - - id: metric.http.probe.failed.due.to.regex - type: metric - metric_name: probe_failed_due_to_regex - brief: "Indicates if probe failed due to regex" - instrument: "gauge" - unit: "1" - stability: stable - - id: metric.http.probe.failed.due.to.cel type: metric metric_name: probe_failed_due_to_cel diff --git a/semconv/icmp/metrics.yaml b/semconv/icmp/metrics.yaml new file mode 100644 index 00000000..2544db45 --- /dev/null +++ b/semconv/icmp/metrics.yaml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json +groups: + - id: metric.icmp.probe.duration.seconds + type: metric + metric_name: probe_icmp_duration_seconds + brief: "Duration of icmp request by phase" + instrument: "gauge" + unit: "s" + attributes: + - ref: phase + requirement_level: required + stability: stable + + - id: metric.icmp.probe.reply.hop.limit + type: metric + metric_name: probe_icmp_reply_hop_limit + brief: "Replied packet hop limit (TTL for ipv4)" + instrument: "gauge" + unit: "1" + stability: stable diff --git a/semconv/icmp/registry.yaml b/semconv/icmp/registry.yaml new file mode 100644 index 00000000..d3784fd3 --- /dev/null +++ b/semconv/icmp/registry.yaml @@ -0,0 +1,11 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json +groups: + - id: registry.icmp + type: attribute_group + brief: ICMP attributes + attributes: + - id: hop_limit + type: int + stability: stable + brief: "Hop limit (TTL for IPv4) of the replied packet" + examples: [64, 128, 255] diff --git a/semconv/probe/metrics.yaml b/semconv/probe/metrics.yaml new file mode 100644 index 00000000..57420b55 --- /dev/null +++ b/semconv/probe/metrics.yaml @@ -0,0 +1,49 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json +groups: + - id: metric.probe.success + type: metric + metric_name: probe_success + brief: "Displays whether or not the probe was a success" + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.probe.duration.seconds + type: metric + metric_name: probe_duration_seconds + brief: "Returns how long the probe took to complete in seconds" + instrument: "gauge" + unit: "s" + stability: stable + + - id: metric.probe.dns.lookup.time.seconds + type: metric + metric_name: probe_dns_lookup_time_seconds + brief: "Returns the time taken for probe dns lookup in seconds" + instrument: "gauge" + unit: "s" + stability: stable + + - id: metric.probe.ip.protocol + type: metric + metric_name: probe_ip_protocol + brief: "Specifies whether probe ip protocol is IP4 or IP6" + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.probe.ip.addr.hash + type: metric + metric_name: probe_ip_addr_hash + brief: "Specifies the hash of IP address. It's useful to detect if the IP address changes." + instrument: "gauge" + unit: "1" + stability: stable + + - id: metric.probe.failed.due.to.regex + type: metric + metric_name: probe_failed_due_to_regex + brief: "Indicates if probe failed due to regex" + instrument: "gauge" + unit: "1" + stability: stable diff --git a/semconv/tcp/metrics.yaml b/semconv/tcp/metrics.yaml new file mode 100644 index 00000000..46736ef1 --- /dev/null +++ b/semconv/tcp/metrics.yaml @@ -0,0 +1,10 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/open-telemetry/weaver/refs/heads/main/schemas/semconv.schema.json +groups: + - id: metric.tcp.probe.expect.info + type: metric + metric_name: probe_expect_info + brief: "Explicit content matched" + instrument: "gauge" + unit: "1" + note: "This metric uses dynamic labels based on the TCP module configuration" + stability: stable From 00be112cbbec5236e7bf6fc2fa65f75ed7670285 Mon Sep 17 00:00:00 2001 From: sh0rez Date: Fri, 13 Jun 2025 13:18:34 +0200 Subject: [PATCH 5/7] doc: switch brief and type --- internal/metrics/metrics.md | 108 ++++++++++++++++++++++++------------ 1 file changed, 72 insertions(+), 36 deletions(-) diff --git a/internal/metrics/metrics.md b/internal/metrics/metrics.md index 67868edc..ede78755 100644 --- a/internal/metrics/metrics.md +++ b/internal/metrics/metrics.md @@ -4,13 +4,14 @@ ## blackbox ### blackbox_module_unknown_total -Count of unknown modules requested by probes ```promql # TYPE blackbox_module_unknown_total COUNTER blackbox_module_unknown_total{} ``` +Count of unknown modules requested by probes + @@ -18,24 +19,26 @@ blackbox_module_unknown_total{} ## config ### blackbox_exporter_config_last_reload_success_timestamp_seconds -Timestamp of the last successful configuration reload ```promql # TYPE blackbox_exporter_config_last_reload_success_timestamp_seconds GAUGE blackbox_exporter_config_last_reload_success_timestamp_seconds{} ``` +Timestamp of the last successful configuration reload + ### blackbox_exporter_config_last_reload_successful -Blackbox exporter config loaded successfully ```promql # TYPE blackbox_exporter_config_last_reload_successful GAUGE blackbox_exporter_config_last_reload_successful{} ``` +Blackbox exporter config loaded successfully + @@ -43,46 +46,50 @@ blackbox_exporter_config_last_reload_successful{} ## dns ### probe_dns_additional_rrs -Returns number of entries in the additional resource record list ```promql # TYPE probe_dns_additional_rrs GAUGE probe_dns_additional_rrs{} ``` +Returns number of entries in the additional resource record list + ### probe_dns_answer_rrs -Returns number of entries in the answer resource record list ```promql # TYPE probe_dns_answer_rrs GAUGE probe_dns_answer_rrs{} ``` +Returns number of entries in the answer resource record list + ### probe_dns_authority_rrs -Returns number of entries in the authority resource record list ```promql # TYPE probe_dns_authority_rrs GAUGE probe_dns_authority_rrs{} ``` +Returns number of entries in the authority resource record list + ### probe_dns_duration_seconds -Duration of DNS request by phase ```promql # TYPE probe_dns_duration_seconds GAUGE probe_dns_duration_seconds{phase} ``` +Duration of DNS request by phase + |Attribute|Type|Description| |-|-|-| @@ -92,24 +99,26 @@ probe_dns_duration_seconds{phase} ### probe_dns_query_succeeded -Displays whether or not the query was executed successfully ```promql # TYPE probe_dns_query_succeeded GAUGE probe_dns_query_succeeded{} ``` +Displays whether or not the query was executed successfully + ### probe_dns_serial -Returns the serial number of the zone ```promql # TYPE probe_dns_serial GAUGE probe_dns_serial{} ``` +Returns the serial number of the zone + @@ -117,13 +126,14 @@ probe_dns_serial{} ## grpc ### probe_grpc_duration_seconds -Duration of gRPC request by phase ```promql # TYPE probe_grpc_duration_seconds GAUGE probe_grpc_duration_seconds{phase} ``` +Duration of gRPC request by phase + |Attribute|Type|Description| |-|-|-| @@ -133,13 +143,14 @@ probe_grpc_duration_seconds{phase} ### probe_grpc_healthcheck_response -Response HealthCheck response ```promql # TYPE probe_grpc_healthcheck_response GAUGE probe_grpc_healthcheck_response{serving_status} ``` +Response HealthCheck response + |Attribute|Type|Description| |-|-|-| @@ -149,24 +160,26 @@ probe_grpc_healthcheck_response{serving_status} ### probe_grpc_ssl -Indicates if SSL was used for the connection ```promql # TYPE probe_grpc_ssl GAUGE probe_grpc_ssl{} ``` +Indicates if SSL was used for the connection + ### probe_grpc_status_code -Response gRPC status code ```promql # TYPE probe_grpc_status_code GAUGE probe_grpc_status_code{} ``` +Response gRPC status code + @@ -174,35 +187,38 @@ probe_grpc_status_code{} ## http ### probe_failed_due_to_cel -Indicates if probe failed due to CEL expression not matching ```promql # TYPE probe_failed_due_to_cel GAUGE probe_failed_due_to_cel{} ``` +Indicates if probe failed due to CEL expression not matching + ### probe_http_content_length -Length of http content response ```promql # TYPE probe_http_content_length GAUGE probe_http_content_length{} ``` +Length of http content response + ### probe_http_duration_seconds -Duration of http request by phase, summed over all redirects ```promql # TYPE probe_http_duration_seconds GAUGE probe_http_duration_seconds{phase} ``` +Duration of http request by phase, summed over all redirects + |Attribute|Type|Description| |-|-|-| @@ -212,68 +228,74 @@ probe_http_duration_seconds{phase} ### probe_http_last_modified_timestamp_seconds -Returns the Last-Modified HTTP response header in unixtime ```promql # TYPE probe_http_last_modified_timestamp_seconds GAUGE probe_http_last_modified_timestamp_seconds{} ``` +Returns the Last-Modified HTTP response header in unixtime + ### probe_http_redirects -The number of redirects ```promql # TYPE probe_http_redirects GAUGE probe_http_redirects{} ``` +The number of redirects + ### probe_http_ssl -Indicates if SSL was used for the final redirect ```promql # TYPE probe_http_ssl GAUGE probe_http_ssl{} ``` +Indicates if SSL was used for the final redirect + ### probe_http_status_code -Response HTTP status code ```promql # TYPE probe_http_status_code GAUGE probe_http_status_code{} ``` +Response HTTP status code + ### probe_http_uncompressed_body_length -Length of uncompressed response body ```promql # TYPE probe_http_uncompressed_body_length GAUGE probe_http_uncompressed_body_length{} ``` +Length of uncompressed response body + ### probe_http_version -Returns the version of HTTP of the probe response ```promql # TYPE probe_http_version GAUGE probe_http_version{} ``` +Returns the version of HTTP of the probe response + @@ -281,13 +303,14 @@ probe_http_version{} ## icmp ### probe_icmp_duration_seconds -Duration of icmp request by phase ```promql # TYPE probe_icmp_duration_seconds GAUGE probe_icmp_duration_seconds{phase} ``` +Duration of icmp request by phase + |Attribute|Type|Description| |-|-|-| @@ -297,13 +320,14 @@ probe_icmp_duration_seconds{phase} ### probe_icmp_reply_hop_limit -Replied packet hop limit (TTL for ipv4) ```promql # TYPE probe_icmp_reply_hop_limit GAUGE probe_icmp_reply_hop_limit{} ``` +Replied packet hop limit (TTL for ipv4) + @@ -311,68 +335,74 @@ probe_icmp_reply_hop_limit{} ## probe ### probe_dns_lookup_time_seconds -Returns the time taken for probe dns lookup in seconds ```promql # TYPE probe_dns_lookup_time_seconds GAUGE probe_dns_lookup_time_seconds{} ``` +Returns the time taken for probe dns lookup in seconds + ### probe_duration_seconds -Returns how long the probe took to complete in seconds ```promql # TYPE probe_duration_seconds GAUGE probe_duration_seconds{} ``` +Returns how long the probe took to complete in seconds + ### probe_failed_due_to_regex -Indicates if probe failed due to regex ```promql # TYPE probe_failed_due_to_regex GAUGE probe_failed_due_to_regex{} ``` +Indicates if probe failed due to regex + ### probe_ip_addr_hash -Specifies the hash of IP address. It's useful to detect if the IP address changes. ```promql # TYPE probe_ip_addr_hash GAUGE probe_ip_addr_hash{} ``` +Specifies the hash of IP address. It's useful to detect if the IP address changes. + ### probe_ip_protocol -Specifies whether probe ip protocol is IP4 or IP6 ```promql # TYPE probe_ip_protocol GAUGE probe_ip_protocol{} ``` +Specifies whether probe ip protocol is IP4 or IP6 + ### probe_success -Displays whether or not the probe was a success ```promql # TYPE probe_success GAUGE probe_success{} ``` +Displays whether or not the probe was a success + @@ -380,35 +410,38 @@ probe_success{} ## ssl ### probe_ssl_earliest_cert_expiry -Returns earliest SSL cert expiry date ```promql # TYPE probe_ssl_earliest_cert_expiry GAUGE probe_ssl_earliest_cert_expiry{} ``` +Returns earliest SSL cert expiry date + ### probe_ssl_last_chain_expiry_timestamp_seconds -Returns last SSL chain expiry timestamp ```promql # TYPE probe_ssl_last_chain_expiry_timestamp_seconds GAUGE probe_ssl_last_chain_expiry_timestamp_seconds{} ``` +Returns last SSL chain expiry timestamp + ### probe_ssl_last_chain_info -Contains SSL leaf certificate information ```promql # TYPE probe_ssl_last_chain_info GAUGE probe_ssl_last_chain_info{fingerprint_sha256, subject, issuer, subjectalternative, serialnumber} ``` +Contains SSL leaf certificate information + |Attribute|Type|Description| |-|-|-| @@ -425,13 +458,14 @@ probe_ssl_last_chain_info{fingerprint_sha256, subject, issuer, subjectalternativ ## tcp ### probe_expect_info -Explicit content matched ```promql # TYPE probe_expect_info GAUGE probe_expect_info{} ``` +Explicit content matched + @@ -439,13 +473,14 @@ probe_expect_info{} ## tls ### probe_tls_cipher_info -Contains TLS cipher information ```promql # TYPE probe_tls_cipher_info GAUGE probe_tls_cipher_info{cipher} ``` +Contains TLS cipher information + |Attribute|Type|Description| |-|-|-| @@ -455,13 +490,14 @@ probe_tls_cipher_info{cipher} ### probe_tls_version_info -Contains TLS version information ```promql # TYPE probe_tls_version_info GAUGE probe_tls_version_info{version} ``` +Contains TLS version information + |Attribute|Type|Description| |-|-|-| From 77bf15aae20086558e51120f0fee44b92947b780 Mon Sep 17 00:00:00 2001 From: sh0rez Date: Fri, 13 Jun 2025 13:20:52 +0200 Subject: [PATCH 6/7] doc: use py for better highlighting --- internal/metrics/metrics.md | 72 ++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/internal/metrics/metrics.md b/internal/metrics/metrics.md index ede78755..dbe4e861 100644 --- a/internal/metrics/metrics.md +++ b/internal/metrics/metrics.md @@ -5,7 +5,7 @@ ### blackbox_module_unknown_total -```promql +```py # TYPE blackbox_module_unknown_total COUNTER blackbox_module_unknown_total{} ``` @@ -20,7 +20,7 @@ Count of unknown modules requested by probes ### blackbox_exporter_config_last_reload_success_timestamp_seconds -```promql +```py # TYPE blackbox_exporter_config_last_reload_success_timestamp_seconds GAUGE blackbox_exporter_config_last_reload_success_timestamp_seconds{} ``` @@ -32,7 +32,7 @@ Timestamp of the last successful configuration reload ### blackbox_exporter_config_last_reload_successful -```promql +```py # TYPE blackbox_exporter_config_last_reload_successful GAUGE blackbox_exporter_config_last_reload_successful{} ``` @@ -47,7 +47,7 @@ Blackbox exporter config loaded successfully ### probe_dns_additional_rrs -```promql +```py # TYPE probe_dns_additional_rrs GAUGE probe_dns_additional_rrs{} ``` @@ -59,7 +59,7 @@ Returns number of entries in the additional resource record list ### probe_dns_answer_rrs -```promql +```py # TYPE probe_dns_answer_rrs GAUGE probe_dns_answer_rrs{} ``` @@ -71,7 +71,7 @@ Returns number of entries in the answer resource record list ### probe_dns_authority_rrs -```promql +```py # TYPE probe_dns_authority_rrs GAUGE probe_dns_authority_rrs{} ``` @@ -83,7 +83,7 @@ Returns number of entries in the authority resource record list ### probe_dns_duration_seconds -```promql +```py # TYPE probe_dns_duration_seconds GAUGE probe_dns_duration_seconds{phase} ``` @@ -100,7 +100,7 @@ Duration of DNS request by phase ### probe_dns_query_succeeded -```promql +```py # TYPE probe_dns_query_succeeded GAUGE probe_dns_query_succeeded{} ``` @@ -112,7 +112,7 @@ Displays whether or not the query was executed successfully ### probe_dns_serial -```promql +```py # TYPE probe_dns_serial GAUGE probe_dns_serial{} ``` @@ -127,7 +127,7 @@ Returns the serial number of the zone ### probe_grpc_duration_seconds -```promql +```py # TYPE probe_grpc_duration_seconds GAUGE probe_grpc_duration_seconds{phase} ``` @@ -144,7 +144,7 @@ Duration of gRPC request by phase ### probe_grpc_healthcheck_response -```promql +```py # TYPE probe_grpc_healthcheck_response GAUGE probe_grpc_healthcheck_response{serving_status} ``` @@ -161,7 +161,7 @@ Response HealthCheck response ### probe_grpc_ssl -```promql +```py # TYPE probe_grpc_ssl GAUGE probe_grpc_ssl{} ``` @@ -173,7 +173,7 @@ Indicates if SSL was used for the connection ### probe_grpc_status_code -```promql +```py # TYPE probe_grpc_status_code GAUGE probe_grpc_status_code{} ``` @@ -188,7 +188,7 @@ Response gRPC status code ### probe_failed_due_to_cel -```promql +```py # TYPE probe_failed_due_to_cel GAUGE probe_failed_due_to_cel{} ``` @@ -200,7 +200,7 @@ Indicates if probe failed due to CEL expression not matching ### probe_http_content_length -```promql +```py # TYPE probe_http_content_length GAUGE probe_http_content_length{} ``` @@ -212,7 +212,7 @@ Length of http content response ### probe_http_duration_seconds -```promql +```py # TYPE probe_http_duration_seconds GAUGE probe_http_duration_seconds{phase} ``` @@ -229,7 +229,7 @@ Duration of http request by phase, summed over all redirects ### probe_http_last_modified_timestamp_seconds -```promql +```py # TYPE probe_http_last_modified_timestamp_seconds GAUGE probe_http_last_modified_timestamp_seconds{} ``` @@ -241,7 +241,7 @@ Returns the Last-Modified HTTP response header in unixtime ### probe_http_redirects -```promql +```py # TYPE probe_http_redirects GAUGE probe_http_redirects{} ``` @@ -253,7 +253,7 @@ The number of redirects ### probe_http_ssl -```promql +```py # TYPE probe_http_ssl GAUGE probe_http_ssl{} ``` @@ -265,7 +265,7 @@ Indicates if SSL was used for the final redirect ### probe_http_status_code -```promql +```py # TYPE probe_http_status_code GAUGE probe_http_status_code{} ``` @@ -277,7 +277,7 @@ Response HTTP status code ### probe_http_uncompressed_body_length -```promql +```py # TYPE probe_http_uncompressed_body_length GAUGE probe_http_uncompressed_body_length{} ``` @@ -289,7 +289,7 @@ Length of uncompressed response body ### probe_http_version -```promql +```py # TYPE probe_http_version GAUGE probe_http_version{} ``` @@ -304,7 +304,7 @@ Returns the version of HTTP of the probe response ### probe_icmp_duration_seconds -```promql +```py # TYPE probe_icmp_duration_seconds GAUGE probe_icmp_duration_seconds{phase} ``` @@ -321,7 +321,7 @@ Duration of icmp request by phase ### probe_icmp_reply_hop_limit -```promql +```py # TYPE probe_icmp_reply_hop_limit GAUGE probe_icmp_reply_hop_limit{} ``` @@ -336,7 +336,7 @@ Replied packet hop limit (TTL for ipv4) ### probe_dns_lookup_time_seconds -```promql +```py # TYPE probe_dns_lookup_time_seconds GAUGE probe_dns_lookup_time_seconds{} ``` @@ -348,7 +348,7 @@ Returns the time taken for probe dns lookup in seconds ### probe_duration_seconds -```promql +```py # TYPE probe_duration_seconds GAUGE probe_duration_seconds{} ``` @@ -360,7 +360,7 @@ Returns how long the probe took to complete in seconds ### probe_failed_due_to_regex -```promql +```py # TYPE probe_failed_due_to_regex GAUGE probe_failed_due_to_regex{} ``` @@ -372,7 +372,7 @@ Indicates if probe failed due to regex ### probe_ip_addr_hash -```promql +```py # TYPE probe_ip_addr_hash GAUGE probe_ip_addr_hash{} ``` @@ -384,7 +384,7 @@ Specifies the hash of IP address. It's useful to detect if the IP address change ### probe_ip_protocol -```promql +```py # TYPE probe_ip_protocol GAUGE probe_ip_protocol{} ``` @@ -396,7 +396,7 @@ Specifies whether probe ip protocol is IP4 or IP6 ### probe_success -```promql +```py # TYPE probe_success GAUGE probe_success{} ``` @@ -411,7 +411,7 @@ Displays whether or not the probe was a success ### probe_ssl_earliest_cert_expiry -```promql +```py # TYPE probe_ssl_earliest_cert_expiry GAUGE probe_ssl_earliest_cert_expiry{} ``` @@ -423,7 +423,7 @@ Returns earliest SSL cert expiry date ### probe_ssl_last_chain_expiry_timestamp_seconds -```promql +```py # TYPE probe_ssl_last_chain_expiry_timestamp_seconds GAUGE probe_ssl_last_chain_expiry_timestamp_seconds{} ``` @@ -435,7 +435,7 @@ Returns last SSL chain expiry timestamp ### probe_ssl_last_chain_info -```promql +```py # TYPE probe_ssl_last_chain_info GAUGE probe_ssl_last_chain_info{fingerprint_sha256, subject, issuer, subjectalternative, serialnumber} ``` @@ -459,7 +459,7 @@ Contains SSL leaf certificate information ### probe_expect_info -```promql +```py # TYPE probe_expect_info GAUGE probe_expect_info{} ``` @@ -474,7 +474,7 @@ Explicit content matched ### probe_tls_cipher_info -```promql +```py # TYPE probe_tls_cipher_info GAUGE probe_tls_cipher_info{cipher} ``` @@ -491,7 +491,7 @@ Contains TLS cipher information ### probe_tls_version_info -```promql +```py # TYPE probe_tls_version_info GAUGE probe_tls_version_info{version} ``` From f776f861d11e49433104ea4a318d16e585fa16d6 Mon Sep 17 00:00:00 2001 From: sh0rez Date: Fri, 13 Jun 2025 15:18:53 +0200 Subject: [PATCH 7/7] *: remove debug comments --- .../metric_blackbox_module_unknown.go | 238 --------- ...g_last_reload_success_timestamp_seconds.go | 238 --------- .../metric_config_last_reload_successful.go | 238 --------- .../dns/metric_dns_probe_additional_rrs.go | 238 --------- .../dns/metric_dns_probe_answer_rrs.go | 238 --------- .../dns/metric_dns_probe_authority_rrs.go | 238 --------- .../dns/metric_dns_probe_duration_seconds.go | 423 +--------------- .../dns/metric_dns_probe_query_succeeded.go | 238 --------- .../metrics/dns/metric_dns_probe_serial.go | 238 --------- .../metric_grpc_probe_duration_seconds.go | 423 +--------------- .../metric_grpc_probe_healthcheck_response.go | 345 +------------ .../metrics/grpc/metric_grpc_probe_ssl.go | 238 --------- .../grpc/metric_grpc_probe_status_code.go | 238 --------- .../http/metric_http_probe_content_length.go | 238 --------- .../metric_http_probe_duration_seconds.go | 423 +--------------- .../metric_http_probe_failed_due_to_cel.go | 238 --------- ...p_probe_last_modified_timestamp_seconds.go | 238 --------- .../http/metric_http_probe_redirects.go | 238 --------- .../metrics/http/metric_http_probe_ssl.go | 238 --------- .../http/metric_http_probe_status_code.go | 238 --------- ...ric_http_probe_uncompressed_body_length.go | 238 --------- .../metrics/http/metric_http_probe_version.go | 238 --------- .../metric_icmp_probe_duration_seconds.go | 423 +--------------- .../icmp/metric_icmp_probe_reply_hop_limit.go | 238 --------- internal/metrics/other/attributes.go | 457 ------------------ .../metric_probe_dns_lookup_time_seconds.go | 238 --------- .../probe/metric_probe_duration_seconds.go | 238 --------- .../probe/metric_probe_failed_due_to_regex.go | 238 --------- .../probe/metric_probe_ip_addr_hash.go | 238 --------- .../metrics/probe/metric_probe_ip_protocol.go | 238 --------- .../metrics/probe/metric_probe_success.go | 238 --------- .../metric_ssl_probe_earliest_cert_expiry.go | 238 --------- ...obe_last_chain_expiry_timestamp_seconds.go | 238 --------- .../ssl/metric_ssl_probe_last_chain_info.go | 410 +--------------- .../tcp/metric_tcp_probe_expect_info.go | 239 --------- .../metrics/tls/metric_tls_probe_cipher.go | 282 +---------- .../metrics/tls/metric_tls_probe_version.go | 282 +---------- 37 files changed, 10 insertions(+), 10123 deletions(-) diff --git a/internal/metrics/blackbox/metric_blackbox_module_unknown.go b/internal/metrics/blackbox/metric_blackbox_module_unknown.go index 78ab885c..68b41da2 100644 --- a/internal/metrics/blackbox/metric_blackbox_module_unknown.go +++ b/internal/metrics/blackbox/metric_blackbox_module_unknown.go @@ -25,241 +25,3 @@ func (m ModuleUnknown) Register(regs ...prometheus.Registerer) ModuleUnknown { } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Counter", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "module.unknown", - "Type": "ModuleUnknown", - "ctx": { - "attributes": [], - "brief": "Count of unknown modules requested by probes", - "events": [], - "id": "metric.blackbox.module.unknown", - "instrument": "counter", - "lineage": { - "provenance": { - "path": "../../semconv/blackbox/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "blackbox_module_unknown_total", - "name": none, - "root_namespace": "blackbox", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/config/metric_config_last_reload_success_timestamp_seconds.go b/internal/metrics/config/metric_config_last_reload_success_timestamp_seconds.go index 2f9d78e3..eb70e0e1 100644 --- a/internal/metrics/config/metric_config_last_reload_success_timestamp_seconds.go +++ b/internal/metrics/config/metric_config_last_reload_success_timestamp_seconds.go @@ -25,241 +25,3 @@ func (m LastReloadSuccessTimestampSeconds) Register(regs ...prometheus.Registere } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "last.reload.success.timestamp.seconds", - "Type": "LastReloadSuccessTimestampSeconds", - "ctx": { - "attributes": [], - "brief": "Timestamp of the last successful configuration reload", - "events": [], - "id": "metric.config.last.reload.success.timestamp.seconds", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/config/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "blackbox_exporter_config_last_reload_success_timestamp_seconds", - "name": none, - "root_namespace": "config", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "s", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/config/metric_config_last_reload_successful.go b/internal/metrics/config/metric_config_last_reload_successful.go index b266cfee..e91aae28 100644 --- a/internal/metrics/config/metric_config_last_reload_successful.go +++ b/internal/metrics/config/metric_config_last_reload_successful.go @@ -25,241 +25,3 @@ func (m LastReloadSuccessful) Register(regs ...prometheus.Registerer) LastReload } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "last.reload.successful", - "Type": "LastReloadSuccessful", - "ctx": { - "attributes": [], - "brief": "Blackbox exporter config loaded successfully", - "events": [], - "id": "metric.config.last.reload.successful", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/config/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "blackbox_exporter_config_last_reload_successful", - "name": none, - "root_namespace": "config", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/dns/metric_dns_probe_additional_rrs.go b/internal/metrics/dns/metric_dns_probe_additional_rrs.go index c5c70a1c..1714a7e3 100644 --- a/internal/metrics/dns/metric_dns_probe_additional_rrs.go +++ b/internal/metrics/dns/metric_dns_probe_additional_rrs.go @@ -25,241 +25,3 @@ func (m ProbeAdditionalRrs) Register(regs ...prometheus.Registerer) ProbeAdditio } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.additional.rrs", - "Type": "ProbeAdditionalRrs", - "ctx": { - "attributes": [], - "brief": "Returns number of entries in the additional resource record list", - "events": [], - "id": "metric.dns.probe.additional.rrs", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/dns/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_dns_additional_rrs", - "name": none, - "root_namespace": "dns", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/dns/metric_dns_probe_answer_rrs.go b/internal/metrics/dns/metric_dns_probe_answer_rrs.go index 788e1b73..49ae1ac3 100644 --- a/internal/metrics/dns/metric_dns_probe_answer_rrs.go +++ b/internal/metrics/dns/metric_dns_probe_answer_rrs.go @@ -25,241 +25,3 @@ func (m ProbeAnswerRrs) Register(regs ...prometheus.Registerer) ProbeAnswerRrs { } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.answer.rrs", - "Type": "ProbeAnswerRrs", - "ctx": { - "attributes": [], - "brief": "Returns number of entries in the answer resource record list", - "events": [], - "id": "metric.dns.probe.answer.rrs", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/dns/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_dns_answer_rrs", - "name": none, - "root_namespace": "dns", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/dns/metric_dns_probe_authority_rrs.go b/internal/metrics/dns/metric_dns_probe_authority_rrs.go index bcb1766f..adf5eedd 100644 --- a/internal/metrics/dns/metric_dns_probe_authority_rrs.go +++ b/internal/metrics/dns/metric_dns_probe_authority_rrs.go @@ -25,241 +25,3 @@ func (m ProbeAuthorityRrs) Register(regs ...prometheus.Registerer) ProbeAuthorit } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.authority.rrs", - "Type": "ProbeAuthorityRrs", - "ctx": { - "attributes": [], - "brief": "Returns number of entries in the authority resource record list", - "events": [], - "id": "metric.dns.probe.authority.rrs", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/dns/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_dns_authority_rrs", - "name": none, - "root_namespace": "dns", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/dns/metric_dns_probe_duration_seconds.go b/internal/metrics/dns/metric_dns_probe_duration_seconds.go index ede4949b..cd036a1a 100644 --- a/internal/metrics/dns/metric_dns_probe_duration_seconds.go +++ b/internal/metrics/dns/metric_dns_probe_duration_seconds.go @@ -23,7 +23,7 @@ func NewProbeDurationSeconds() ProbeDurationSeconds { } func (m ProbeDurationSeconds) With(phase other.AttrPhase, extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(string(phase)) + return m.GaugeVec.WithLabelValues(phase.Value()) } // Deprecated: Use [ProbeDurationSeconds.With] instead @@ -33,424 +33,3 @@ func (m ProbeDurationSeconds) WithLabelValues(lvs ...string) prometheus.Gauge { type ProbeDurationSecondsExtra struct { } - -/* -State { - name: "vec.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "AttrExtra": "ProbeDurationSecondsExtra", - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.duration.seconds", - "Type": "ProbeDurationSeconds", - "attributes": [ - { - "brief": "Probe phase", - "name": "phase", - "requirement_level": "required", - "stability": "stable", - "type": { - "members": [ - { - "brief": none, - "deprecated": none, - "id": "resolve", - "note": none, - "stability": "stable", - "value": "resolve", - }, - { - "brief": none, - "deprecated": none, - "id": "connect", - "note": none, - "stability": "stable", - "value": "connect", - }, - { - "brief": none, - "deprecated": none, - "id": "request", - "note": none, - "stability": "stable", - "value": "request", - }, - { - "brief": none, - "deprecated": none, - "id": "tls", - "note": none, - "stability": "stable", - "value": "tls", - }, - { - "brief": none, - "deprecated": none, - "id": "processing", - "note": none, - "stability": "stable", - "value": "processing", - }, - { - "brief": none, - "deprecated": none, - "id": "transfer", - "note": none, - "stability": "stable", - "value": "transfer", - }, - { - "brief": none, - "deprecated": none, - "id": "setup", - "note": none, - "stability": "stable", - "value": "setup", - }, - { - "brief": none, - "deprecated": none, - "id": "rtt", - "note": none, - "stability": "stable", - "value": "rtt", - }, - { - "brief": none, - "deprecated": none, - "id": "check", - "note": none, - "stability": "stable", - "value": "check", - }, - ], - }, - }, - ], - "ctx": { - "attributes": [ - { - "brief": "Probe phase", - "name": "phase", - "requirement_level": "required", - "stability": "stable", - "type": { - "members": [ - { - "brief": none, - "deprecated": none, - "id": "resolve", - "note": none, - "stability": "stable", - "value": "resolve", - }, - { - "brief": none, - "deprecated": none, - "id": "connect", - "note": none, - "stability": "stable", - "value": "connect", - }, - { - "brief": none, - "deprecated": none, - "id": "request", - "note": none, - "stability": "stable", - "value": "request", - }, - { - "brief": none, - "deprecated": none, - "id": "tls", - "note": none, - "stability": "stable", - "value": "tls", - }, - { - "brief": none, - "deprecated": none, - "id": "processing", - "note": none, - "stability": "stable", - "value": "processing", - }, - { - "brief": none, - "deprecated": none, - "id": "transfer", - "note": none, - "stability": "stable", - "value": "transfer", - }, - { - "brief": none, - "deprecated": none, - "id": "setup", - "note": none, - "stability": "stable", - "value": "setup", - }, - { - "brief": none, - "deprecated": none, - "id": "rtt", - "note": none, - "stability": "stable", - "value": "rtt", - }, - { - "brief": none, - "deprecated": none, - "id": "check", - "note": none, - "stability": "stable", - "value": "check", - }, - ], - }, - }, - ], - "brief": "Duration of DNS request by phase", - "events": [], - "id": "metric.dns.probe.duration.seconds", - "instrument": "gauge", - "lineage": { - "attributes": { - "phase": { - "inherited_fields": [ - "brief", - "note", - "stability", - ], - "locally_overridden_fields": [ - "requirement_level", - ], - "source_group": "registry.other", - }, - }, - "provenance": { - "path": "../../semconv/dns/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_dns_duration_seconds", - "name": none, - "root_namespace": "dns", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "s", - }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "vec.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/dns/metric_dns_probe_query_succeeded.go b/internal/metrics/dns/metric_dns_probe_query_succeeded.go index f98a85cc..7058ee12 100644 --- a/internal/metrics/dns/metric_dns_probe_query_succeeded.go +++ b/internal/metrics/dns/metric_dns_probe_query_succeeded.go @@ -25,241 +25,3 @@ func (m ProbeQuerySucceeded) Register(regs ...prometheus.Registerer) ProbeQueryS } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.query.succeeded", - "Type": "ProbeQuerySucceeded", - "ctx": { - "attributes": [], - "brief": "Displays whether or not the query was executed successfully", - "events": [], - "id": "metric.dns.probe.query.succeeded", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/dns/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_dns_query_succeeded", - "name": none, - "root_namespace": "dns", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/dns/metric_dns_probe_serial.go b/internal/metrics/dns/metric_dns_probe_serial.go index 7026a4dc..0cd0353e 100644 --- a/internal/metrics/dns/metric_dns_probe_serial.go +++ b/internal/metrics/dns/metric_dns_probe_serial.go @@ -25,241 +25,3 @@ func (m ProbeSerial) Register(regs ...prometheus.Registerer) ProbeSerial { } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.serial", - "Type": "ProbeSerial", - "ctx": { - "attributes": [], - "brief": "Returns the serial number of the zone", - "events": [], - "id": "metric.dns.probe.serial", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/dns/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_dns_serial", - "name": none, - "root_namespace": "dns", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/grpc/metric_grpc_probe_duration_seconds.go b/internal/metrics/grpc/metric_grpc_probe_duration_seconds.go index 1fbe1c31..d21a104e 100644 --- a/internal/metrics/grpc/metric_grpc_probe_duration_seconds.go +++ b/internal/metrics/grpc/metric_grpc_probe_duration_seconds.go @@ -23,7 +23,7 @@ func NewProbeDurationSeconds() ProbeDurationSeconds { } func (m ProbeDurationSeconds) With(phase other.AttrPhase, extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(string(phase)) + return m.GaugeVec.WithLabelValues(phase.Value()) } // Deprecated: Use [ProbeDurationSeconds.With] instead @@ -33,424 +33,3 @@ func (m ProbeDurationSeconds) WithLabelValues(lvs ...string) prometheus.Gauge { type ProbeDurationSecondsExtra struct { } - -/* -State { - name: "vec.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "AttrExtra": "ProbeDurationSecondsExtra", - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.duration.seconds", - "Type": "ProbeDurationSeconds", - "attributes": [ - { - "brief": "Probe phase", - "name": "phase", - "requirement_level": "required", - "stability": "stable", - "type": { - "members": [ - { - "brief": none, - "deprecated": none, - "id": "resolve", - "note": none, - "stability": "stable", - "value": "resolve", - }, - { - "brief": none, - "deprecated": none, - "id": "connect", - "note": none, - "stability": "stable", - "value": "connect", - }, - { - "brief": none, - "deprecated": none, - "id": "request", - "note": none, - "stability": "stable", - "value": "request", - }, - { - "brief": none, - "deprecated": none, - "id": "tls", - "note": none, - "stability": "stable", - "value": "tls", - }, - { - "brief": none, - "deprecated": none, - "id": "processing", - "note": none, - "stability": "stable", - "value": "processing", - }, - { - "brief": none, - "deprecated": none, - "id": "transfer", - "note": none, - "stability": "stable", - "value": "transfer", - }, - { - "brief": none, - "deprecated": none, - "id": "setup", - "note": none, - "stability": "stable", - "value": "setup", - }, - { - "brief": none, - "deprecated": none, - "id": "rtt", - "note": none, - "stability": "stable", - "value": "rtt", - }, - { - "brief": none, - "deprecated": none, - "id": "check", - "note": none, - "stability": "stable", - "value": "check", - }, - ], - }, - }, - ], - "ctx": { - "attributes": [ - { - "brief": "Probe phase", - "name": "phase", - "requirement_level": "required", - "stability": "stable", - "type": { - "members": [ - { - "brief": none, - "deprecated": none, - "id": "resolve", - "note": none, - "stability": "stable", - "value": "resolve", - }, - { - "brief": none, - "deprecated": none, - "id": "connect", - "note": none, - "stability": "stable", - "value": "connect", - }, - { - "brief": none, - "deprecated": none, - "id": "request", - "note": none, - "stability": "stable", - "value": "request", - }, - { - "brief": none, - "deprecated": none, - "id": "tls", - "note": none, - "stability": "stable", - "value": "tls", - }, - { - "brief": none, - "deprecated": none, - "id": "processing", - "note": none, - "stability": "stable", - "value": "processing", - }, - { - "brief": none, - "deprecated": none, - "id": "transfer", - "note": none, - "stability": "stable", - "value": "transfer", - }, - { - "brief": none, - "deprecated": none, - "id": "setup", - "note": none, - "stability": "stable", - "value": "setup", - }, - { - "brief": none, - "deprecated": none, - "id": "rtt", - "note": none, - "stability": "stable", - "value": "rtt", - }, - { - "brief": none, - "deprecated": none, - "id": "check", - "note": none, - "stability": "stable", - "value": "check", - }, - ], - }, - }, - ], - "brief": "Duration of gRPC request by phase", - "events": [], - "id": "metric.grpc.probe.duration.seconds", - "instrument": "gauge", - "lineage": { - "attributes": { - "phase": { - "inherited_fields": [ - "brief", - "note", - "stability", - ], - "locally_overridden_fields": [ - "requirement_level", - ], - "source_group": "registry.other", - }, - }, - "provenance": { - "path": "../../semconv/grpc/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_grpc_duration_seconds", - "name": none, - "root_namespace": "grpc", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "s", - }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "vec.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/grpc/metric_grpc_probe_healthcheck_response.go b/internal/metrics/grpc/metric_grpc_probe_healthcheck_response.go index b304a245..02b09f20 100644 --- a/internal/metrics/grpc/metric_grpc_probe_healthcheck_response.go +++ b/internal/metrics/grpc/metric_grpc_probe_healthcheck_response.go @@ -22,8 +22,8 @@ func NewProbeHealthcheckResponse() ProbeHealthcheckResponse { }, labels)} } -func (m ProbeHealthcheckResponse) With(serving_status other.AttrServingStatus, extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(string(serving_status)) +func (m ProbeHealthcheckResponse) With(servingStatus other.AttrServingStatus, extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(servingStatus.Value()) } // Deprecated: Use [ProbeHealthcheckResponse.With] instead @@ -33,344 +33,3 @@ func (m ProbeHealthcheckResponse) WithLabelValues(lvs ...string) prometheus.Gaug type ProbeHealthcheckResponseExtra struct { } - -/* -State { - name: "vec.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "AttrExtra": "ProbeHealthcheckResponseExtra", - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.healthcheck.response", - "Type": "ProbeHealthcheckResponse", - "attributes": [ - { - "brief": "gRPC health check serving status", - "name": "serving_status", - "requirement_level": "required", - "stability": "stable", - "type": { - "members": [ - { - "brief": none, - "deprecated": none, - "id": "serving", - "note": none, - "stability": "stable", - "value": "SERVING", - }, - { - "brief": none, - "deprecated": none, - "id": "not_serving", - "note": none, - "stability": "stable", - "value": "NOT_SERVING", - }, - { - "brief": none, - "deprecated": none, - "id": "unknown", - "note": none, - "stability": "stable", - "value": "UNKNOWN", - }, - { - "brief": none, - "deprecated": none, - "id": "service_unknown", - "note": none, - "stability": "stable", - "value": "SERVICE_UNKNOWN", - }, - ], - }, - }, - ], - "ctx": { - "attributes": [ - { - "brief": "gRPC health check serving status", - "name": "serving_status", - "requirement_level": "required", - "stability": "stable", - "type": { - "members": [ - { - "brief": none, - "deprecated": none, - "id": "serving", - "note": none, - "stability": "stable", - "value": "SERVING", - }, - { - "brief": none, - "deprecated": none, - "id": "not_serving", - "note": none, - "stability": "stable", - "value": "NOT_SERVING", - }, - { - "brief": none, - "deprecated": none, - "id": "unknown", - "note": none, - "stability": "stable", - "value": "UNKNOWN", - }, - { - "brief": none, - "deprecated": none, - "id": "service_unknown", - "note": none, - "stability": "stable", - "value": "SERVICE_UNKNOWN", - }, - ], - }, - }, - ], - "brief": "Response HealthCheck response", - "events": [], - "id": "metric.grpc.probe.healthcheck.response", - "instrument": "gauge", - "lineage": { - "attributes": { - "serving_status": { - "inherited_fields": [ - "brief", - "note", - "stability", - ], - "locally_overridden_fields": [ - "requirement_level", - ], - "source_group": "registry.grpc", - }, - }, - "provenance": { - "path": "../../semconv/grpc/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_grpc_healthcheck_response", - "name": none, - "root_namespace": "grpc", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "vec.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/grpc/metric_grpc_probe_ssl.go b/internal/metrics/grpc/metric_grpc_probe_ssl.go index b5a22412..8049b0c2 100644 --- a/internal/metrics/grpc/metric_grpc_probe_ssl.go +++ b/internal/metrics/grpc/metric_grpc_probe_ssl.go @@ -25,241 +25,3 @@ func (m ProbeSsl) Register(regs ...prometheus.Registerer) ProbeSsl { } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.ssl", - "Type": "ProbeSsl", - "ctx": { - "attributes": [], - "brief": "Indicates if SSL was used for the connection", - "events": [], - "id": "metric.grpc.probe.ssl", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/grpc/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_grpc_ssl", - "name": none, - "root_namespace": "grpc", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/grpc/metric_grpc_probe_status_code.go b/internal/metrics/grpc/metric_grpc_probe_status_code.go index 280139eb..9de9f7d6 100644 --- a/internal/metrics/grpc/metric_grpc_probe_status_code.go +++ b/internal/metrics/grpc/metric_grpc_probe_status_code.go @@ -25,241 +25,3 @@ func (m ProbeStatusCode) Register(regs ...prometheus.Registerer) ProbeStatusCode } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.status.code", - "Type": "ProbeStatusCode", - "ctx": { - "attributes": [], - "brief": "Response gRPC status code", - "events": [], - "id": "metric.grpc.probe.status.code", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/grpc/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_grpc_status_code", - "name": none, - "root_namespace": "grpc", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/http/metric_http_probe_content_length.go b/internal/metrics/http/metric_http_probe_content_length.go index 3d57ec07..1ccded62 100644 --- a/internal/metrics/http/metric_http_probe_content_length.go +++ b/internal/metrics/http/metric_http_probe_content_length.go @@ -25,241 +25,3 @@ func (m ProbeContentLength) Register(regs ...prometheus.Registerer) ProbeContent } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.content.length", - "Type": "ProbeContentLength", - "ctx": { - "attributes": [], - "brief": "Length of http content response", - "events": [], - "id": "metric.http.probe.content.length", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/http/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_http_content_length", - "name": none, - "root_namespace": "http", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "By", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/http/metric_http_probe_duration_seconds.go b/internal/metrics/http/metric_http_probe_duration_seconds.go index 82d033ac..e2565a6e 100644 --- a/internal/metrics/http/metric_http_probe_duration_seconds.go +++ b/internal/metrics/http/metric_http_probe_duration_seconds.go @@ -23,7 +23,7 @@ func NewProbeDurationSeconds() ProbeDurationSeconds { } func (m ProbeDurationSeconds) With(phase other.AttrPhase, extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(string(phase)) + return m.GaugeVec.WithLabelValues(phase.Value()) } // Deprecated: Use [ProbeDurationSeconds.With] instead @@ -33,424 +33,3 @@ func (m ProbeDurationSeconds) WithLabelValues(lvs ...string) prometheus.Gauge { type ProbeDurationSecondsExtra struct { } - -/* -State { - name: "vec.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "AttrExtra": "ProbeDurationSecondsExtra", - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.duration.seconds", - "Type": "ProbeDurationSeconds", - "attributes": [ - { - "brief": "Probe phase", - "name": "phase", - "requirement_level": "required", - "stability": "stable", - "type": { - "members": [ - { - "brief": none, - "deprecated": none, - "id": "resolve", - "note": none, - "stability": "stable", - "value": "resolve", - }, - { - "brief": none, - "deprecated": none, - "id": "connect", - "note": none, - "stability": "stable", - "value": "connect", - }, - { - "brief": none, - "deprecated": none, - "id": "request", - "note": none, - "stability": "stable", - "value": "request", - }, - { - "brief": none, - "deprecated": none, - "id": "tls", - "note": none, - "stability": "stable", - "value": "tls", - }, - { - "brief": none, - "deprecated": none, - "id": "processing", - "note": none, - "stability": "stable", - "value": "processing", - }, - { - "brief": none, - "deprecated": none, - "id": "transfer", - "note": none, - "stability": "stable", - "value": "transfer", - }, - { - "brief": none, - "deprecated": none, - "id": "setup", - "note": none, - "stability": "stable", - "value": "setup", - }, - { - "brief": none, - "deprecated": none, - "id": "rtt", - "note": none, - "stability": "stable", - "value": "rtt", - }, - { - "brief": none, - "deprecated": none, - "id": "check", - "note": none, - "stability": "stable", - "value": "check", - }, - ], - }, - }, - ], - "ctx": { - "attributes": [ - { - "brief": "Probe phase", - "name": "phase", - "requirement_level": "required", - "stability": "stable", - "type": { - "members": [ - { - "brief": none, - "deprecated": none, - "id": "resolve", - "note": none, - "stability": "stable", - "value": "resolve", - }, - { - "brief": none, - "deprecated": none, - "id": "connect", - "note": none, - "stability": "stable", - "value": "connect", - }, - { - "brief": none, - "deprecated": none, - "id": "request", - "note": none, - "stability": "stable", - "value": "request", - }, - { - "brief": none, - "deprecated": none, - "id": "tls", - "note": none, - "stability": "stable", - "value": "tls", - }, - { - "brief": none, - "deprecated": none, - "id": "processing", - "note": none, - "stability": "stable", - "value": "processing", - }, - { - "brief": none, - "deprecated": none, - "id": "transfer", - "note": none, - "stability": "stable", - "value": "transfer", - }, - { - "brief": none, - "deprecated": none, - "id": "setup", - "note": none, - "stability": "stable", - "value": "setup", - }, - { - "brief": none, - "deprecated": none, - "id": "rtt", - "note": none, - "stability": "stable", - "value": "rtt", - }, - { - "brief": none, - "deprecated": none, - "id": "check", - "note": none, - "stability": "stable", - "value": "check", - }, - ], - }, - }, - ], - "brief": "Duration of http request by phase, summed over all redirects", - "events": [], - "id": "metric.http.probe.duration.seconds", - "instrument": "gauge", - "lineage": { - "attributes": { - "phase": { - "inherited_fields": [ - "brief", - "note", - "stability", - ], - "locally_overridden_fields": [ - "requirement_level", - ], - "source_group": "registry.other", - }, - }, - "provenance": { - "path": "../../semconv/http/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_http_duration_seconds", - "name": none, - "root_namespace": "http", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "s", - }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "vec.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/http/metric_http_probe_failed_due_to_cel.go b/internal/metrics/http/metric_http_probe_failed_due_to_cel.go index 34246000..fc7d1b97 100644 --- a/internal/metrics/http/metric_http_probe_failed_due_to_cel.go +++ b/internal/metrics/http/metric_http_probe_failed_due_to_cel.go @@ -25,241 +25,3 @@ func (m ProbeFailedDueToCel) Register(regs ...prometheus.Registerer) ProbeFailed } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.failed.due.to.cel", - "Type": "ProbeFailedDueToCel", - "ctx": { - "attributes": [], - "brief": "Indicates if probe failed due to CEL expression not matching", - "events": [], - "id": "metric.http.probe.failed.due.to.cel", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/http/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_failed_due_to_cel", - "name": none, - "root_namespace": "http", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/http/metric_http_probe_last_modified_timestamp_seconds.go b/internal/metrics/http/metric_http_probe_last_modified_timestamp_seconds.go index 3993d656..350dbd0e 100644 --- a/internal/metrics/http/metric_http_probe_last_modified_timestamp_seconds.go +++ b/internal/metrics/http/metric_http_probe_last_modified_timestamp_seconds.go @@ -25,241 +25,3 @@ func (m ProbeLastModifiedTimestampSeconds) Register(regs ...prometheus.Registere } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.last.modified.timestamp.seconds", - "Type": "ProbeLastModifiedTimestampSeconds", - "ctx": { - "attributes": [], - "brief": "Returns the Last-Modified HTTP response header in unixtime", - "events": [], - "id": "metric.http.probe.last.modified.timestamp.seconds", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/http/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_http_last_modified_timestamp_seconds", - "name": none, - "root_namespace": "http", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "s", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/http/metric_http_probe_redirects.go b/internal/metrics/http/metric_http_probe_redirects.go index 89d45a9d..777442e0 100644 --- a/internal/metrics/http/metric_http_probe_redirects.go +++ b/internal/metrics/http/metric_http_probe_redirects.go @@ -25,241 +25,3 @@ func (m ProbeRedirects) Register(regs ...prometheus.Registerer) ProbeRedirects { } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.redirects", - "Type": "ProbeRedirects", - "ctx": { - "attributes": [], - "brief": "The number of redirects", - "events": [], - "id": "metric.http.probe.redirects", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/http/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_http_redirects", - "name": none, - "root_namespace": "http", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/http/metric_http_probe_ssl.go b/internal/metrics/http/metric_http_probe_ssl.go index 9343da16..ba102a04 100644 --- a/internal/metrics/http/metric_http_probe_ssl.go +++ b/internal/metrics/http/metric_http_probe_ssl.go @@ -25,241 +25,3 @@ func (m ProbeSsl) Register(regs ...prometheus.Registerer) ProbeSsl { } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.ssl", - "Type": "ProbeSsl", - "ctx": { - "attributes": [], - "brief": "Indicates if SSL was used for the final redirect", - "events": [], - "id": "metric.http.probe.ssl", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/http/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_http_ssl", - "name": none, - "root_namespace": "http", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/http/metric_http_probe_status_code.go b/internal/metrics/http/metric_http_probe_status_code.go index a17effc9..01946614 100644 --- a/internal/metrics/http/metric_http_probe_status_code.go +++ b/internal/metrics/http/metric_http_probe_status_code.go @@ -25,241 +25,3 @@ func (m ProbeStatusCode) Register(regs ...prometheus.Registerer) ProbeStatusCode } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.status.code", - "Type": "ProbeStatusCode", - "ctx": { - "attributes": [], - "brief": "Response HTTP status code", - "events": [], - "id": "metric.http.probe.status.code", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/http/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_http_status_code", - "name": none, - "root_namespace": "http", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/http/metric_http_probe_uncompressed_body_length.go b/internal/metrics/http/metric_http_probe_uncompressed_body_length.go index c6a4a117..06eff160 100644 --- a/internal/metrics/http/metric_http_probe_uncompressed_body_length.go +++ b/internal/metrics/http/metric_http_probe_uncompressed_body_length.go @@ -25,241 +25,3 @@ func (m ProbeUncompressedBodyLength) Register(regs ...prometheus.Registerer) Pro } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.uncompressed.body.length", - "Type": "ProbeUncompressedBodyLength", - "ctx": { - "attributes": [], - "brief": "Length of uncompressed response body", - "events": [], - "id": "metric.http.probe.uncompressed.body.length", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/http/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_http_uncompressed_body_length", - "name": none, - "root_namespace": "http", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "By", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/http/metric_http_probe_version.go b/internal/metrics/http/metric_http_probe_version.go index b943e5c0..18ffcdaa 100644 --- a/internal/metrics/http/metric_http_probe_version.go +++ b/internal/metrics/http/metric_http_probe_version.go @@ -25,241 +25,3 @@ func (m ProbeVersion) Register(regs ...prometheus.Registerer) ProbeVersion { } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.version", - "Type": "ProbeVersion", - "ctx": { - "attributes": [], - "brief": "Returns the version of HTTP of the probe response", - "events": [], - "id": "metric.http.probe.version", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/http/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_http_version", - "name": none, - "root_namespace": "http", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/icmp/metric_icmp_probe_duration_seconds.go b/internal/metrics/icmp/metric_icmp_probe_duration_seconds.go index 996defd6..7aa97839 100644 --- a/internal/metrics/icmp/metric_icmp_probe_duration_seconds.go +++ b/internal/metrics/icmp/metric_icmp_probe_duration_seconds.go @@ -23,7 +23,7 @@ func NewProbeDurationSeconds() ProbeDurationSeconds { } func (m ProbeDurationSeconds) With(phase other.AttrPhase, extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(string(phase)) + return m.GaugeVec.WithLabelValues(phase.Value()) } // Deprecated: Use [ProbeDurationSeconds.With] instead @@ -33,424 +33,3 @@ func (m ProbeDurationSeconds) WithLabelValues(lvs ...string) prometheus.Gauge { type ProbeDurationSecondsExtra struct { } - -/* -State { - name: "vec.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "AttrExtra": "ProbeDurationSecondsExtra", - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.duration.seconds", - "Type": "ProbeDurationSeconds", - "attributes": [ - { - "brief": "Probe phase", - "name": "phase", - "requirement_level": "required", - "stability": "stable", - "type": { - "members": [ - { - "brief": none, - "deprecated": none, - "id": "resolve", - "note": none, - "stability": "stable", - "value": "resolve", - }, - { - "brief": none, - "deprecated": none, - "id": "connect", - "note": none, - "stability": "stable", - "value": "connect", - }, - { - "brief": none, - "deprecated": none, - "id": "request", - "note": none, - "stability": "stable", - "value": "request", - }, - { - "brief": none, - "deprecated": none, - "id": "tls", - "note": none, - "stability": "stable", - "value": "tls", - }, - { - "brief": none, - "deprecated": none, - "id": "processing", - "note": none, - "stability": "stable", - "value": "processing", - }, - { - "brief": none, - "deprecated": none, - "id": "transfer", - "note": none, - "stability": "stable", - "value": "transfer", - }, - { - "brief": none, - "deprecated": none, - "id": "setup", - "note": none, - "stability": "stable", - "value": "setup", - }, - { - "brief": none, - "deprecated": none, - "id": "rtt", - "note": none, - "stability": "stable", - "value": "rtt", - }, - { - "brief": none, - "deprecated": none, - "id": "check", - "note": none, - "stability": "stable", - "value": "check", - }, - ], - }, - }, - ], - "ctx": { - "attributes": [ - { - "brief": "Probe phase", - "name": "phase", - "requirement_level": "required", - "stability": "stable", - "type": { - "members": [ - { - "brief": none, - "deprecated": none, - "id": "resolve", - "note": none, - "stability": "stable", - "value": "resolve", - }, - { - "brief": none, - "deprecated": none, - "id": "connect", - "note": none, - "stability": "stable", - "value": "connect", - }, - { - "brief": none, - "deprecated": none, - "id": "request", - "note": none, - "stability": "stable", - "value": "request", - }, - { - "brief": none, - "deprecated": none, - "id": "tls", - "note": none, - "stability": "stable", - "value": "tls", - }, - { - "brief": none, - "deprecated": none, - "id": "processing", - "note": none, - "stability": "stable", - "value": "processing", - }, - { - "brief": none, - "deprecated": none, - "id": "transfer", - "note": none, - "stability": "stable", - "value": "transfer", - }, - { - "brief": none, - "deprecated": none, - "id": "setup", - "note": none, - "stability": "stable", - "value": "setup", - }, - { - "brief": none, - "deprecated": none, - "id": "rtt", - "note": none, - "stability": "stable", - "value": "rtt", - }, - { - "brief": none, - "deprecated": none, - "id": "check", - "note": none, - "stability": "stable", - "value": "check", - }, - ], - }, - }, - ], - "brief": "Duration of icmp request by phase", - "events": [], - "id": "metric.icmp.probe.duration.seconds", - "instrument": "gauge", - "lineage": { - "attributes": { - "phase": { - "inherited_fields": [ - "brief", - "note", - "stability", - ], - "locally_overridden_fields": [ - "requirement_level", - ], - "source_group": "registry.other", - }, - }, - "provenance": { - "path": "../../semconv/icmp/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_icmp_duration_seconds", - "name": none, - "root_namespace": "icmp", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "s", - }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "vec.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/icmp/metric_icmp_probe_reply_hop_limit.go b/internal/metrics/icmp/metric_icmp_probe_reply_hop_limit.go index d90a7327..be6efec3 100644 --- a/internal/metrics/icmp/metric_icmp_probe_reply_hop_limit.go +++ b/internal/metrics/icmp/metric_icmp_probe_reply_hop_limit.go @@ -25,241 +25,3 @@ func (m ProbeReplyHopLimit) Register(regs ...prometheus.Registerer) ProbeReplyHo } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.reply.hop.limit", - "Type": "ProbeReplyHopLimit", - "ctx": { - "attributes": [], - "brief": "Replied packet hop limit (TTL for ipv4)", - "events": [], - "id": "metric.icmp.probe.reply.hop.limit", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/icmp/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_icmp_reply_hop_limit", - "name": none, - "root_namespace": "icmp", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/other/attributes.go b/internal/metrics/other/attributes.go index 7f9c1edc..7bc1c94e 100644 --- a/internal/metrics/other/attributes.go +++ b/internal/metrics/other/attributes.go @@ -102,460 +102,3 @@ func (AttrVersion) Stable() {} func (AttrVersion) Recommended() {} func (AttrVersion) Key() string { return "version" } func (a AttrVersion) Value() string { return string(a) } - -/* State { - name: "attr.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "ctx": { - "attributes": [ - { - "brief": "TLS cipher suite", - "examples": [ - "TLS_AES_256_GCM_SHA384", - "ECDHE-RSA-AES256-GCM-SHA384", - ], - "name": "cipher", - "requirement_level": "recommended", - "root_namespace": "other", - "stability": "stable", - "type": "string", - }, - { - "brief": "SHA256 fingerprint of the certificate", - "examples": [ - "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - ], - "name": "fingerprint_sha256", - "requirement_level": "recommended", - "root_namespace": "other", - "stability": "stable", - "type": "string", - }, - { - "brief": "Hop limit (TTL for IPv4) of the replied packet", - "examples": [ - 64, - 128, - 255, - ], - "name": "hop_limit", - "requirement_level": "recommended", - "root_namespace": "other", - "stability": "stable", - "type": "int", - }, - { - "brief": "Issuer of the certificate", - "examples": [ - "CN=Example CA,O=Example Corp,C=US", - ], - "name": "issuer", - "requirement_level": "recommended", - "root_namespace": "other", - "stability": "stable", - "type": "string", - }, - { - "brief": "Probe phase", - "name": "phase", - "requirement_level": "recommended", - "root_namespace": "other", - "stability": "stable", - "type": { - "members": [ - { - "brief": none, - "deprecated": none, - "id": "resolve", - "note": none, - "stability": "stable", - "value": "resolve", - }, - { - "brief": none, - "deprecated": none, - "id": "connect", - "note": none, - "stability": "stable", - "value": "connect", - }, - { - "brief": none, - "deprecated": none, - "id": "request", - "note": none, - "stability": "stable", - "value": "request", - }, - { - "brief": none, - "deprecated": none, - "id": "tls", - "note": none, - "stability": "stable", - "value": "tls", - }, - { - "brief": none, - "deprecated": none, - "id": "processing", - "note": none, - "stability": "stable", - "value": "processing", - }, - { - "brief": none, - "deprecated": none, - "id": "transfer", - "note": none, - "stability": "stable", - "value": "transfer", - }, - { - "brief": none, - "deprecated": none, - "id": "setup", - "note": none, - "stability": "stable", - "value": "setup", - }, - { - "brief": none, - "deprecated": none, - "id": "rtt", - "note": none, - "stability": "stable", - "value": "rtt", - }, - { - "brief": none, - "deprecated": none, - "id": "check", - "note": none, - "stability": "stable", - "value": "check", - }, - ], - }, - }, - { - "brief": "Serial number of the certificate", - "examples": [ - "1234567890abcdef", - ], - "name": "serialnumber", - "requirement_level": "recommended", - "root_namespace": "other", - "stability": "stable", - "type": "string", - }, - { - "brief": "gRPC health check serving status", - "name": "serving_status", - "requirement_level": "recommended", - "root_namespace": "other", - "stability": "stable", - "type": { - "members": [ - { - "brief": none, - "deprecated": none, - "id": "serving", - "note": none, - "stability": "stable", - "value": "SERVING", - }, - { - "brief": none, - "deprecated": none, - "id": "not_serving", - "note": none, - "stability": "stable", - "value": "NOT_SERVING", - }, - { - "brief": none, - "deprecated": none, - "id": "unknown", - "note": none, - "stability": "stable", - "value": "UNKNOWN", - }, - { - "brief": none, - "deprecated": none, - "id": "service_unknown", - "note": none, - "stability": "stable", - "value": "SERVICE_UNKNOWN", - }, - ], - }, - }, - { - "brief": "gRPC status code", - "examples": [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - ], - "name": "status_code", - "requirement_level": "recommended", - "root_namespace": "other", - "stability": "stable", - "type": "int", - }, - { - "brief": "Subject of the certificate", - "examples": [ - "CN=example.com,O=Example Corp,L=San Francisco,ST=CA,C=US", - ], - "name": "subject", - "requirement_level": "recommended", - "root_namespace": "other", - "stability": "stable", - "type": "string", - }, - { - "brief": "Subject alternative names of the certificate", - "examples": [ - "DNS:example.com,DNS:www.example.com", - ], - "name": "subjectalternative", - "requirement_level": "recommended", - "root_namespace": "other", - "stability": "stable", - "type": "string", - }, - { - "brief": "TLS version", - "examples": [ - "TLS 1.3", - "TLS 1.2", - ], - "name": "version", - "requirement_level": "recommended", - "root_namespace": "other", - "stability": "stable", - "type": "string", - }, - ], - "root_namespace": "other", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "attr.go.j2", - ], - }, -} */ diff --git a/internal/metrics/probe/metric_probe_dns_lookup_time_seconds.go b/internal/metrics/probe/metric_probe_dns_lookup_time_seconds.go index 161c6f3e..c62e6a69 100644 --- a/internal/metrics/probe/metric_probe_dns_lookup_time_seconds.go +++ b/internal/metrics/probe/metric_probe_dns_lookup_time_seconds.go @@ -25,241 +25,3 @@ func (m DnsLookupTimeSeconds) Register(regs ...prometheus.Registerer) DnsLookupT } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "dns.lookup.time.seconds", - "Type": "DnsLookupTimeSeconds", - "ctx": { - "attributes": [], - "brief": "Returns the time taken for probe dns lookup in seconds", - "events": [], - "id": "metric.probe.dns.lookup.time.seconds", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/probe/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_dns_lookup_time_seconds", - "name": none, - "root_namespace": "probe", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "s", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/probe/metric_probe_duration_seconds.go b/internal/metrics/probe/metric_probe_duration_seconds.go index a34da62c..bb3a6931 100644 --- a/internal/metrics/probe/metric_probe_duration_seconds.go +++ b/internal/metrics/probe/metric_probe_duration_seconds.go @@ -25,241 +25,3 @@ func (m DurationSeconds) Register(regs ...prometheus.Registerer) DurationSeconds } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "duration.seconds", - "Type": "DurationSeconds", - "ctx": { - "attributes": [], - "brief": "Returns how long the probe took to complete in seconds", - "events": [], - "id": "metric.probe.duration.seconds", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/probe/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_duration_seconds", - "name": none, - "root_namespace": "probe", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "s", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/probe/metric_probe_failed_due_to_regex.go b/internal/metrics/probe/metric_probe_failed_due_to_regex.go index 41444ead..2f2018aa 100644 --- a/internal/metrics/probe/metric_probe_failed_due_to_regex.go +++ b/internal/metrics/probe/metric_probe_failed_due_to_regex.go @@ -25,241 +25,3 @@ func (m FailedDueToRegex) Register(regs ...prometheus.Registerer) FailedDueToReg } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "failed.due.to.regex", - "Type": "FailedDueToRegex", - "ctx": { - "attributes": [], - "brief": "Indicates if probe failed due to regex", - "events": [], - "id": "metric.probe.failed.due.to.regex", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/probe/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_failed_due_to_regex", - "name": none, - "root_namespace": "probe", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/probe/metric_probe_ip_addr_hash.go b/internal/metrics/probe/metric_probe_ip_addr_hash.go index 035e821f..22e00f33 100644 --- a/internal/metrics/probe/metric_probe_ip_addr_hash.go +++ b/internal/metrics/probe/metric_probe_ip_addr_hash.go @@ -25,241 +25,3 @@ func (m IpAddrHash) Register(regs ...prometheus.Registerer) IpAddrHash { } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "ip.addr.hash", - "Type": "IpAddrHash", - "ctx": { - "attributes": [], - "brief": "Specifies the hash of IP address. It's useful to detect if the IP address changes.", - "events": [], - "id": "metric.probe.ip.addr.hash", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/probe/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_ip_addr_hash", - "name": none, - "root_namespace": "probe", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/probe/metric_probe_ip_protocol.go b/internal/metrics/probe/metric_probe_ip_protocol.go index 5808ad8d..d5b7ae6c 100644 --- a/internal/metrics/probe/metric_probe_ip_protocol.go +++ b/internal/metrics/probe/metric_probe_ip_protocol.go @@ -25,241 +25,3 @@ func (m IpProtocol) Register(regs ...prometheus.Registerer) IpProtocol { } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "ip.protocol", - "Type": "IpProtocol", - "ctx": { - "attributes": [], - "brief": "Specifies whether probe ip protocol is IP4 or IP6", - "events": [], - "id": "metric.probe.ip.protocol", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/probe/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_ip_protocol", - "name": none, - "root_namespace": "probe", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/probe/metric_probe_success.go b/internal/metrics/probe/metric_probe_success.go index e3ddbd49..6c109b13 100644 --- a/internal/metrics/probe/metric_probe_success.go +++ b/internal/metrics/probe/metric_probe_success.go @@ -25,241 +25,3 @@ func (m Success) Register(regs ...prometheus.Registerer) Success { } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "success", - "Type": "Success", - "ctx": { - "attributes": [], - "brief": "Displays whether or not the probe was a success", - "events": [], - "id": "metric.probe.success", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/probe/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_success", - "name": none, - "root_namespace": "probe", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/ssl/metric_ssl_probe_earliest_cert_expiry.go b/internal/metrics/ssl/metric_ssl_probe_earliest_cert_expiry.go index 68b91825..fb0282b8 100644 --- a/internal/metrics/ssl/metric_ssl_probe_earliest_cert_expiry.go +++ b/internal/metrics/ssl/metric_ssl_probe_earliest_cert_expiry.go @@ -25,241 +25,3 @@ func (m ProbeEarliestCertExpiry) Register(regs ...prometheus.Registerer) ProbeEa } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.earliest.cert.expiry", - "Type": "ProbeEarliestCertExpiry", - "ctx": { - "attributes": [], - "brief": "Returns earliest SSL cert expiry date", - "events": [], - "id": "metric.ssl.probe.earliest.cert.expiry", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/tls/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_ssl_earliest_cert_expiry", - "name": none, - "root_namespace": "ssl", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "s", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/ssl/metric_ssl_probe_last_chain_expiry_timestamp_seconds.go b/internal/metrics/ssl/metric_ssl_probe_last_chain_expiry_timestamp_seconds.go index 9af5f232..4fa48bd4 100644 --- a/internal/metrics/ssl/metric_ssl_probe_last_chain_expiry_timestamp_seconds.go +++ b/internal/metrics/ssl/metric_ssl_probe_last_chain_expiry_timestamp_seconds.go @@ -25,241 +25,3 @@ func (m ProbeLastChainExpiryTimestampSeconds) Register(regs ...prometheus.Regist } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.last.chain.expiry.timestamp.seconds", - "Type": "ProbeLastChainExpiryTimestampSeconds", - "ctx": { - "attributes": [], - "brief": "Returns last SSL chain expiry timestamp", - "events": [], - "id": "metric.ssl.probe.last.chain.expiry.timestamp.seconds", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/tls/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_ssl_last_chain_expiry_timestamp_seconds", - "name": none, - "root_namespace": "ssl", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "s", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/ssl/metric_ssl_probe_last_chain_info.go b/internal/metrics/ssl/metric_ssl_probe_last_chain_info.go index 605ceed6..094ce0bc 100644 --- a/internal/metrics/ssl/metric_ssl_probe_last_chain_info.go +++ b/internal/metrics/ssl/metric_ssl_probe_last_chain_info.go @@ -22,8 +22,8 @@ func NewProbeLastChainInfo() ProbeLastChainInfo { }, labels)} } -func (m ProbeLastChainInfo) With(fingerprint_sha256 other.AttrFingerprintSha256, issuer other.AttrIssuer, serialnumber other.AttrSerialnumber, subject other.AttrSubject, subjectalternative other.AttrSubjectalternative, extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(string(fingerprint_sha256), string(issuer), string(serialnumber), string(subject), string(subjectalternative)) +func (m ProbeLastChainInfo) With(fingerprintSha256 other.AttrFingerprintSha256, issuer other.AttrIssuer, serialnumber other.AttrSerialnumber, subject other.AttrSubject, subjectalternative other.AttrSubjectalternative, extras ...interface{}) prometheus.Gauge { + return m.GaugeVec.WithLabelValues(fingerprintSha256.Value(), issuer.Value(), serialnumber.Value(), subject.Value(), subjectalternative.Value()) } // Deprecated: Use [ProbeLastChainInfo.With] instead @@ -33,409 +33,3 @@ func (m ProbeLastChainInfo) WithLabelValues(lvs ...string) prometheus.Gauge { type ProbeLastChainInfoExtra struct { } - -/* -State { - name: "vec.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "AttrExtra": "ProbeLastChainInfoExtra", - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.last.chain.info", - "Type": "ProbeLastChainInfo", - "attributes": [ - { - "brief": "SHA256 fingerprint of the certificate", - "examples": [ - "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - ], - "name": "fingerprint_sha256", - "requirement_level": "required", - "stability": "stable", - "type": "string", - }, - { - "brief": "Issuer of the certificate", - "examples": [ - "CN=Example CA,O=Example Corp,C=US", - ], - "name": "issuer", - "requirement_level": "required", - "stability": "stable", - "type": "string", - }, - { - "brief": "Serial number of the certificate", - "examples": [ - "1234567890abcdef", - ], - "name": "serialnumber", - "requirement_level": "required", - "stability": "stable", - "type": "string", - }, - { - "brief": "Subject of the certificate", - "examples": [ - "CN=example.com,O=Example Corp,L=San Francisco,ST=CA,C=US", - ], - "name": "subject", - "requirement_level": "required", - "stability": "stable", - "type": "string", - }, - { - "brief": "Subject alternative names of the certificate", - "examples": [ - "DNS:example.com,DNS:www.example.com", - ], - "name": "subjectalternative", - "requirement_level": "required", - "stability": "stable", - "type": "string", - }, - ], - "ctx": { - "attributes": [ - { - "brief": "SHA256 fingerprint of the certificate", - "examples": [ - "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - ], - "name": "fingerprint_sha256", - "requirement_level": "required", - "stability": "stable", - "type": "string", - }, - { - "brief": "Subject of the certificate", - "examples": [ - "CN=example.com,O=Example Corp,L=San Francisco,ST=CA,C=US", - ], - "name": "subject", - "requirement_level": "required", - "stability": "stable", - "type": "string", - }, - { - "brief": "Issuer of the certificate", - "examples": [ - "CN=Example CA,O=Example Corp,C=US", - ], - "name": "issuer", - "requirement_level": "required", - "stability": "stable", - "type": "string", - }, - { - "brief": "Subject alternative names of the certificate", - "examples": [ - "DNS:example.com,DNS:www.example.com", - ], - "name": "subjectalternative", - "requirement_level": "required", - "stability": "stable", - "type": "string", - }, - { - "brief": "Serial number of the certificate", - "examples": [ - "1234567890abcdef", - ], - "name": "serialnumber", - "requirement_level": "required", - "stability": "stable", - "type": "string", - }, - ], - "brief": "Contains SSL leaf certificate information", - "events": [], - "id": "metric.ssl.probe.last.chain.info", - "instrument": "gauge", - "lineage": { - "attributes": { - "fingerprint_sha256": { - "inherited_fields": [ - "brief", - "examples", - "note", - "stability", - ], - "locally_overridden_fields": [ - "requirement_level", - ], - "source_group": "registry.tls", - }, - "issuer": { - "inherited_fields": [ - "brief", - "examples", - "note", - "stability", - ], - "locally_overridden_fields": [ - "requirement_level", - ], - "source_group": "registry.tls", - }, - "serialnumber": { - "inherited_fields": [ - "brief", - "examples", - "note", - "stability", - ], - "locally_overridden_fields": [ - "requirement_level", - ], - "source_group": "registry.tls", - }, - "subject": { - "inherited_fields": [ - "brief", - "examples", - "note", - "stability", - ], - "locally_overridden_fields": [ - "requirement_level", - ], - "source_group": "registry.tls", - }, - "subjectalternative": { - "inherited_fields": [ - "brief", - "examples", - "note", - "stability", - ], - "locally_overridden_fields": [ - "requirement_level", - ], - "source_group": "registry.tls", - }, - }, - "provenance": { - "path": "../../semconv/tls/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_ssl_last_chain_info", - "name": none, - "root_namespace": "ssl", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "vec.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/tcp/metric_tcp_probe_expect_info.go b/internal/metrics/tcp/metric_tcp_probe_expect_info.go index a5f4759c..e2085ab2 100644 --- a/internal/metrics/tcp/metric_tcp_probe_expect_info.go +++ b/internal/metrics/tcp/metric_tcp_probe_expect_info.go @@ -25,242 +25,3 @@ func (m ProbeExpectInfo) Register(regs ...prometheus.Registerer) ProbeExpectInfo } return m } - -/* -State { - name: "scalar.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.expect.info", - "Type": "ProbeExpectInfo", - "ctx": { - "attributes": [], - "brief": "Explicit content matched", - "events": [], - "id": "metric.tcp.probe.expect.info", - "instrument": "gauge", - "lineage": { - "provenance": { - "path": "../../semconv/tcp/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_expect_info", - "name": none, - "note": "This metric uses dynamic labels based on the TCP module configuration", - "root_namespace": "tcp", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "scalar.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/tls/metric_tls_probe_cipher.go b/internal/metrics/tls/metric_tls_probe_cipher.go index 7b340e85..62786c84 100644 --- a/internal/metrics/tls/metric_tls_probe_cipher.go +++ b/internal/metrics/tls/metric_tls_probe_cipher.go @@ -23,7 +23,7 @@ func NewProbeCipher() ProbeCipher { } func (m ProbeCipher) With(cipher other.AttrCipher, extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(string(cipher)) + return m.GaugeVec.WithLabelValues(cipher.Value()) } // Deprecated: Use [ProbeCipher.With] instead @@ -33,283 +33,3 @@ func (m ProbeCipher) WithLabelValues(lvs ...string) prometheus.Gauge { type ProbeCipherExtra struct { } - -/* -State { - name: "vec.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "AttrExtra": "ProbeCipherExtra", - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.cipher", - "Type": "ProbeCipher", - "attributes": [ - { - "brief": "TLS cipher suite", - "examples": [ - "TLS_AES_256_GCM_SHA384", - "ECDHE-RSA-AES256-GCM-SHA384", - ], - "name": "cipher", - "requirement_level": "required", - "stability": "stable", - "type": "string", - }, - ], - "ctx": { - "attributes": [ - { - "brief": "TLS cipher suite", - "examples": [ - "TLS_AES_256_GCM_SHA384", - "ECDHE-RSA-AES256-GCM-SHA384", - ], - "name": "cipher", - "requirement_level": "required", - "stability": "stable", - "type": "string", - }, - ], - "brief": "Contains TLS cipher information", - "events": [], - "id": "metric.tls.probe.cipher", - "instrument": "gauge", - "lineage": { - "attributes": { - "cipher": { - "inherited_fields": [ - "brief", - "examples", - "note", - "stability", - ], - "locally_overridden_fields": [ - "requirement_level", - ], - "source_group": "registry.tls", - }, - }, - "provenance": { - "path": "../../semconv/tls/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_tls_cipher_info", - "name": none, - "root_namespace": "tls", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "vec.go.j2", - ], - }, -} -*/ diff --git a/internal/metrics/tls/metric_tls_probe_version.go b/internal/metrics/tls/metric_tls_probe_version.go index abf7aaa8..febee143 100644 --- a/internal/metrics/tls/metric_tls_probe_version.go +++ b/internal/metrics/tls/metric_tls_probe_version.go @@ -23,7 +23,7 @@ func NewProbeVersion() ProbeVersion { } func (m ProbeVersion) With(version other.AttrVersion, extras ...interface{}) prometheus.Gauge { - return m.GaugeVec.WithLabelValues(string(version)) + return m.GaugeVec.WithLabelValues(version.Value()) } // Deprecated: Use [ProbeVersion.With] instead @@ -33,283 +33,3 @@ func (m ProbeVersion) WithLabelValues(lvs ...string) prometheus.Gauge { type ProbeVersionExtra struct { } - -/* -State { - name: "vec.go.j2", - current_block: None, - auto_escape: None, - ctx: { - "AttrExtra": "ProbeVersionExtra", - "Instr": "Gauge", - "InstrMap": { - "counter": "Counter", - "gauge": "Gauge", - "histogram": "Histogram", - "updowncounter": "Gauge", - }, - "Name": "probe.version", - "Type": "ProbeVersion", - "attributes": [ - { - "brief": "TLS version", - "examples": [ - "TLS 1.3", - "TLS 1.2", - ], - "name": "version", - "requirement_level": "required", - "stability": "stable", - "type": "string", - }, - ], - "ctx": { - "attributes": [ - { - "brief": "TLS version", - "examples": [ - "TLS 1.3", - "TLS 1.2", - ], - "name": "version", - "requirement_level": "required", - "stability": "stable", - "type": "string", - }, - ], - "brief": "Contains TLS version information", - "events": [], - "id": "metric.tls.probe.version", - "instrument": "gauge", - "lineage": { - "attributes": { - "version": { - "inherited_fields": [ - "brief", - "examples", - "note", - "stability", - ], - "locally_overridden_fields": [ - "requirement_level", - ], - "source_group": "registry.tls", - }, - }, - "provenance": { - "path": "../../semconv/tls/metrics.yaml", - "registry_id": "main", - }, - }, - "metric_name": "probe_tls_version_info", - "name": none, - "root_namespace": "tls", - "span_kind": none, - "stability": "stable", - "type": "metric", - "unit": "1", - }, - "for_each_attr": , - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - env: Environment { - globals: { - "concat_if": weaver_forge::extensions::util::concat_if, - "cycler": minijinja_contrib::globals::cycler, - "debug": minijinja::functions::builtins::debug, - "dict": minijinja::functions::builtins::dict, - "joiner": minijinja_contrib::globals::joiner, - "namespace": minijinja::functions::builtins::namespace, - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - "params": { - "module": "github.com/prometheus/blackbox_exporter/internal/metrics", - }, - }, - "range": minijinja::functions::builtins::range, - "template": {}, - }, - tests: [ - "!=", - "<", - "<=", - "==", - ">", - ">=", - "array", - "boolean", - "defined", - "deprecated", - "divisibleby", - "endingwith", - "enum", - "enum_type", - "eq", - "equalto", - "escaped", - "even", - "experimental", - "false", - "filter", - "float", - "ge", - "greaterthan", - "gt", - "in", - "int", - "integer", - "iterable", - "le", - "lessthan", - "lower", - "lt", - "mapping", - "ne", - "none", - "number", - "odd", - "safe", - "sameas", - "sequence", - "simple_type", - "stable", - "startingwith", - "string", - "template_type", - "test", - "true", - "undefined", - "upper", - ], - filters: [ - "abs", - "acronym", - "ansi_bg_black", - "ansi_bg_blue", - "ansi_bg_bright_black", - "ansi_bg_bright_blue", - "ansi_bg_bright_cyan", - "ansi_bg_bright_green", - "ansi_bg_bright_magenta", - "ansi_bg_bright_red", - "ansi_bg_bright_white", - "ansi_bg_bright_yellow", - "ansi_bg_cyan", - "ansi_bg_green", - "ansi_bg_magenta", - "ansi_bg_red", - "ansi_bg_white", - "ansi_bg_yellow", - "ansi_black", - "ansi_blue", - "ansi_bold", - "ansi_bright_black", - "ansi_bright_blue", - "ansi_bright_cyan", - "ansi_bright_green", - "ansi_bright_magenta", - "ansi_bright_red", - "ansi_bright_white", - "ansi_bright_yellow", - "ansi_cyan", - "ansi_green", - "ansi_italic", - "ansi_magenta", - "ansi_red", - "ansi_strikethrough", - "ansi_underline", - "ansi_white", - "ansi_yellow", - "attr", - "attribute_id", - "attribute_namespace", - "attribute_registry_file", - "attribute_registry_namespace", - "attribute_registry_title", - "attribute_sort", - "batch", - "body_fields", - "bool", - "camel_case", - "camel_case_const", - "capitalize", - "capitalize_first", - "comment", - "comment_with_prefix", - "count", - "d", - "default", - "dictsort", - "e", - "enum_type", - "escape", - "filesizeformat", - "first", - "flatten", - "float", - "groupby", - "indent", - "instantiated_type", - "int", - "items", - "join", - "kebab_case", - "kebab_case_const", - "last", - "length", - "lines", - "list", - "lower", - "lower_case", - "map", - "map_text", - "markdown_to_html", - "max", - "metric_namespace", - "min", - "not_required", - "pascal_case", - "pascal_case_const", - "pluralize", - "pprint", - "print_member_value", - "regex_replace", - "reject", - "rejectattr", - "replace", - "required", - "reverse", - "round", - "safe", - "screaming_kebab_case", - "screaming_snake_case", - "screaming_snake_case_const", - "select", - "selectattr", - "slice", - "snake_case", - "snake_case_const", - "sort", - "split", - "split_id", - "string", - "striptags", - "sum", - "title", - "title_case", - "tojson", - "toyaml", - "trim", - "truncate", - "type_mapping", - "unique", - "upper", - "upper_case", - "urlencode", - ], - templates: [ - "vec.go.j2", - ], - }, -} -*/