Module: D13n::Metric::Helper
- Defined in:
- lib/d13n/metric/helper.rb
Class Method Summary collapse
- .biz_tracable? ⇒ Boolean
- .db_tracable? ⇒ Boolean
- .endpoint_for(uri) ⇒ Object
- .exception_tracable? ⇒ Boolean
- .http_in_tracable? ⇒ Boolean
- .http_out_tracable? ⇒ Boolean
- .http_request_count_for(service, direction) ⇒ Object
- .http_request_for(app_name, direction) ⇒ Object
- .http_request_timing_for(service, direction) ⇒ Object
- .service_for(uri) ⇒ Object
Class Method Details
.biz_tracable? ⇒ Boolean
39 40 41 |
# File 'lib/d13n/metric/helper.rb', line 39 def self.biz_tracable? D13n.config[:'metric.business.state.tracable'] == 'true' || D13n.config[:'metric.business.state.tracable'] == true end |
.db_tracable? ⇒ Boolean
35 36 37 |
# File 'lib/d13n/metric/helper.rb', line 35 def self.db_tracable? D13n.config[:'metric.app.db.tracable'] == 'true' || D13n.config[:'metric.app.db.tracable'] == true end |
.endpoint_for(uri) ⇒ Object
55 56 57 58 59 60 |
# File 'lib/d13n/metric/helper.rb', line 55 def self.endpoint_for(uri) path = uri.path expected_path = D13n.config.alias_key_for(path) return nil if expected_path.nil? expected_path.to_s.downcase end |
.exception_tracable? ⇒ Boolean
43 44 45 |
# File 'lib/d13n/metric/helper.rb', line 43 def self.exception_tracable? D13n.config[:'metric.app.state.exception.tracable'] == 'true' || D13n.config[:'metric.app.state.exception.tracable'] == true end |
.http_in_tracable? ⇒ Boolean
27 28 29 |
# File 'lib/d13n/metric/helper.rb', line 27 def self.http_in_tracable? D13n.config[:'metric.app.http.in.tracable'] == 'true' || D13n.config[:'metric.app.http.in.tracable'] == true end |
.http_out_tracable? ⇒ Boolean
31 32 33 |
# File 'lib/d13n/metric/helper.rb', line 31 def self.http_out_tracable? D13n.config[:'metric.app.http.out.tracable'] == 'true' || D13n.config[:'metric.app.http.out.tracable'] == true end |
.http_request_count_for(service, direction) ⇒ Object
15 16 17 18 19 |
# File 'lib/d13n/metric/helper.rb', line 15 def self.http_request_count_for(service, direction) scope = http_request_for(service, direction) scope << "count" scope.join('.') end |
.http_request_for(app_name, direction) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/d13n/metric/helper.rb', line 3 def self.http_request_for(app_name, direction) downcase_direction = direction.to_s.downcase check_direction(downcase_direction) scope ||= [] scope << D13n.idc_name scope << D13n.app_name.downcase scope << D13n.idc_env scope << 'http' scope << downcase_direction scope end |
.http_request_timing_for(service, direction) ⇒ Object
21 22 23 24 25 |
# File 'lib/d13n/metric/helper.rb', line 21 def self.http_request_timing_for(service, direction) scope = http_request_for(service, direction) scope << "timing" scope.join('.') end |
.service_for(uri) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/d13n/metric/helper.rb', line 47 def self.service_for(uri) port = (uri.port.to_i == 80 ? "" : ":#{uri.port}") url = "#{uri.scheme}://#{uri.host}#{port}" expected_service = D13n.config.alias_key_for(url) return nil if expected_service.nil? expected_service.to_s.downcase end |