summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Newdigate <andrew@gitlab.com>2019-06-21 13:07:22 +0200
committerAndrew Newdigate <andrew@gitlab.com>2019-06-21 14:29:25 +0200
commit5a4cab069dce05b14ce2f094926dba36a33dcbed (patch)
treebabc371b82206319f38cbac3dfc3c4e6be67ee4d
parentea795837fdaf23c4da423e0c71268e31687d7849 (diff)
downloadgitlab-ce-always-allow-prometheus-access-in-dev.tar.gz
In dev, always allow access to health endpoints from localhostalways-allow-prometheus-access-in-dev
This change will allow developers to easily hook up a Prometheus instance to their local development instance, without making any configuration changes.
-rw-r--r--app/controllers/concerns/requires_whitelisted_monitoring_client.rb4
-rw-r--r--changelogs/unreleased/always-allow-prometheus-access-in-dev.yml5
2 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/concerns/requires_whitelisted_monitoring_client.rb b/app/controllers/concerns/requires_whitelisted_monitoring_client.rb
index 426f224d26b..f47ead2f0da 100644
--- a/app/controllers/concerns/requires_whitelisted_monitoring_client.rb
+++ b/app/controllers/concerns/requires_whitelisted_monitoring_client.rb
@@ -14,6 +14,10 @@ module RequiresWhitelistedMonitoringClient
end
def client_ip_whitelisted?
+ # Always allow developers to access http://localhost:3000/-/metrics for
+ # debugging purposes
+ return true if Rails.env.development? && request.local?
+
ip_whitelist.any? { |e| e.include?(Gitlab::RequestContext.client_ip) }
end
diff --git a/changelogs/unreleased/always-allow-prometheus-access-in-dev.yml b/changelogs/unreleased/always-allow-prometheus-access-in-dev.yml
new file mode 100644
index 00000000000..acd944ea684
--- /dev/null
+++ b/changelogs/unreleased/always-allow-prometheus-access-in-dev.yml
@@ -0,0 +1,5 @@
+---
+title: Always allow access to health endpoints from localhost in dev
+merge_request: 29930
+author:
+type: other