Commit 75c603a2 authored by Jarka Košanová's avatar Jarka Košanová

Merge branch 'osw-add-worker-label-to-prom' into 'master'

Add worker label to Sidekiq prometheus metrics

See merge request gitlab-org/gitlab!28593
parents f4d891f3 096c200c
......@@ -9,7 +9,13 @@ module Gitlab
private
def create_labels(worker_class, queue)
labels = { queue: queue.to_s, urgency: "", external_dependencies: FALSE_LABEL, feature_category: "", boundary: "" }
labels = { queue: queue.to_s,
worker: worker_class.to_s,
urgency: "",
external_dependencies: FALSE_LABEL,
feature_category: "",
boundary: "" }
return labels unless worker_class && worker_class.include?(WorkerAttributes)
labels[:urgency] = worker_class.get_urgency.to_s
......
......@@ -9,7 +9,14 @@ describe Gitlab::SidekiqMiddleware::ClientMetrics do
let(:queue) { :test }
let(:worker_class) { worker.class }
let(:job) { {} }
let(:default_labels) { { queue: queue.to_s, boundary: "", external_dependencies: "no", feature_category: "", urgency: "low" } }
let(:default_labels) do
{ queue: queue.to_s,
worker: worker_class.to_s,
boundary: "",
external_dependencies: "no",
feature_category: "",
urgency: "low" }
end
shared_examples "a metrics client middleware" do
context "with mocked prometheus" do
......
......@@ -11,7 +11,14 @@ describe Gitlab::SidekiqMiddleware::ServerMetrics do
let(:job) { {} }
let(:job_status) { :done }
let(:labels_with_job_status) { labels.merge(job_status: job_status.to_s) }
let(:default_labels) { { queue: queue.to_s, boundary: "", external_dependencies: "no", feature_category: "", urgency: "low" } }
let(:default_labels) do
{ queue: queue.to_s,
worker: worker_class.to_s,
boundary: "",
external_dependencies: "no",
feature_category: "",
urgency: "low" }
end
shared_examples "a metrics middleware" do
context "with mocked prometheus" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment