Class: GitLab::Exporter::Database::CiBuildsProber
- Inherits:
-
Object
- Object
- GitLab::Exporter::Database::CiBuildsProber
- Defined in:
- lib/gitlab_exporter/database/ci_builds.rb
Overview
The prober which is called when gathering metrics
Constant Summary collapse
- DEPRECATED =
The stdout notice in #probe_db reaches whoever reads the exporter's log, which is not who reads the metrics. HELP is the one channel that travels with the sample to the scraper, so the deprecation rides there too: it survives into Prometheus and shows up in Grafana's metric browser.
"(deprecated, to be removed in a future major version)".freeze
- REPLACEMENT =
"See the CI builds entry in README.md for replacements.".freeze
Instance Method Summary collapse
-
#initialize(metrics: PrometheusMetrics.new, **opts) ⇒ CiBuildsProber
constructor
A new instance of CiBuildsProber.
- #probe_db ⇒ Object
- #write_to(target) ⇒ Object
Constructor Details
#initialize(metrics: PrometheusMetrics.new, **opts) ⇒ CiBuildsProber
Returns a new instance of CiBuildsProber.
334 335 336 337 |
# File 'lib/gitlab_exporter/database/ci_builds.rb', line 334 def initialize(metrics: PrometheusMetrics.new, **opts) @metrics = metrics @collector = CiBuildsCollector.new(**opts) end |
Instance Method Details
#probe_db ⇒ Object
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/gitlab_exporter/database/ci_builds.rb', line 339 def probe_db puts "[DEPRECATED] probe_db and CiBuildsProber are now considered obsolete"\ " and will be removed in a future major version,"\ " please use the CI/CD queuing metrics emitted by GitLab Rails instead" @results = @collector.run ci_builds_metrics(@results[:created_builds], "ci_created_builds") if @results[:created_builds] ci_builds_metrics(@results[:pending_builds], "ci_pending_builds") ci_stale_builds_metrics metrics_per_runner unarchived_traces_metrics self rescue PG::ConnectionBad self end |
#write_to(target) ⇒ Object
357 358 359 |
# File 'lib/gitlab_exporter/database/ci_builds.rb', line 357 def write_to(target) target.write(@metrics.to_s) end |