Class: Fluent::Plugin::PrometheusPull::LabeledUrl
- Inherits:
-
Object
- Object
- Fluent::Plugin::PrometheusPull::LabeledUrl
- Defined in:
- lib/fluent/plugin/prometheus_pull/labeled_url.rb
Constant Summary collapse
- LABELED_URL_RE =
/^(?:@(?<label>[^@]*)@)?(?<url>.*)$/.freeze
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(url:, label: nil) ⇒ LabeledUrl
constructor
A new instance of LabeledUrl.
- #to_s ⇒ Object
Constructor Details
#initialize(url:, label: nil) ⇒ LabeledUrl
11 12 13 14 |
# File 'lib/fluent/plugin/prometheus_pull/labeled_url.rb', line 11 def initialize(url:, label: nil) @url = url @label = label end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
9 10 11 |
# File 'lib/fluent/plugin/prometheus_pull/labeled_url.rb', line 9 def label @label end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/fluent/plugin/prometheus_pull/labeled_url.rb', line 9 def url @url end |
Class Method Details
.parse_labeled_url(url) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/fluent/plugin/prometheus_pull/labeled_url.rb', line 20 def self.parse_labeled_url(url) match_data = LABELED_URL_RE.match(url) raise Fluent::ConfigError, "unable to use url '#{url}'" unless match_data new(url: match_data[:url], label: match_data[:label]) end |
Instance Method Details
#to_s ⇒ Object
16 17 18 |
# File 'lib/fluent/plugin/prometheus_pull/labeled_url.rb', line 16 def to_s url end |