Class: NewRelic::MetricParser::External

Inherits:
NewRelic::MetricParser show all
Defined in:
lib/new_relic/metric_parser/external.rb

Constant Summary

Constants inherited from NewRelic::MetricParser

SEPARATOR

Instance Attribute Summary

Attributes inherited from NewRelic::MetricParser

#name

Instance Method Summary collapse

Methods inherited from NewRelic::MetricParser

#apdex_metric_path, #base_metric_name, #call_rate_suffix, #category, for_metric_named, #initialize, #last_segment, #method_missing, parse, #pie_chart_label, #segment_0, #segment_1, #segment_2, #segment_3, #segment_4, #segments, #short_name, #url

Constructor Details

This class inherits a constructor from NewRelic::MetricParser

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NewRelic::MetricParser

Instance Method Details

#all?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/new_relic/metric_parser/external.rb', line 3

def all?
  host == 'all' || host == 'allWeb' || host == 'allOther'
end

#developer_nameObject



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/new_relic/metric_parser/external.rb', line 38

def developer_name
  case 
  when all?
    'All External'
  when hosts_all?
    host
  when operation
    "#{library}[#{host}]: #{operation}"
  else
    "#{library}[#{host}]"
  end
end

#hostObject



9
10
11
# File 'lib/new_relic/metric_parser/external.rb', line 9

def host
  segments[1]
end

#hosts_all?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/new_relic/metric_parser/external.rb', line 6

def hosts_all?
  library == 'all'
end

#legend_nameObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/new_relic/metric_parser/external.rb', line 18

def legend_name
  case
  when all?
    "External Services"
  when hosts_all?
    "All #{host} calls"
  else
    developer_name
  end
end

#libraryObject



12
13
14
# File 'lib/new_relic/metric_parser/external.rb', line 12

def library
  segments[2]
end

#operationObject



15
16
17
# File 'lib/new_relic/metric_parser/external.rb', line 15

def operation
  segments[3] && segments[3..-1].join("/")
end

#tooltip_nameObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/new_relic/metric_parser/external.rb', line 28

def tooltip_name
  case
  when all?
    "calls to external systems"
  when hosts_all?
    "calls to #{host}"
  else
    "calls to #{developer_name}"
  end
end