Class: Gitlab::Prometheus::Adapter
- Inherits:
-
Object
- Object
- Gitlab::Prometheus::Adapter
- Defined in:
- lib/gitlab/prometheus/adapter.rb
Instance Attribute Summary collapse
-
#cluster ⇒ Object
readonly
Returns the value of attribute cluster.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #cluster_prometheus_adapter ⇒ Object
-
#initialize(project, cluster) ⇒ Adapter
constructor
A new instance of Adapter.
- #prometheus_adapter ⇒ Object
Constructor Details
#initialize(project, cluster) ⇒ Adapter
Returns a new instance of Adapter.
8 9 10 11 |
# File 'lib/gitlab/prometheus/adapter.rb', line 8 def initialize(project, cluster) @project = project @cluster = cluster end |
Instance Attribute Details
#cluster ⇒ Object (readonly)
Returns the value of attribute cluster.
6 7 8 |
# File 'lib/gitlab/prometheus/adapter.rb', line 6 def cluster @cluster end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
6 7 8 |
# File 'lib/gitlab/prometheus/adapter.rb', line 6 def project @project end |
Instance Method Details
#cluster_prometheus_adapter ⇒ Object
21 22 23 24 |
# File 'lib/gitlab/prometheus/adapter.rb', line 21 def cluster_prometheus_adapter integration = cluster&.integration_prometheus integration if integration&.available? end |
#prometheus_adapter ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/gitlab/prometheus/adapter.rb', line 13 def prometheus_adapter @prometheus_adapter ||= if service_prometheus_adapter.can_query? service_prometheus_adapter else cluster_prometheus_adapter end end |