Class: NewRelic::MetricParser::Apdex

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

Constant Summary collapse

CLIENT =
'Client'

Constants inherited from NewRelic::MetricParser

SEPARATOR

Instance Attribute Summary

Attributes inherited from NewRelic::MetricParser

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NewRelic::MetricParser

#apdex_metric_path, #base_metric_name, #category, for_metric_named, #initialize, #is_controller?, #is_transaction?, #last_segment, #legend_name, #method_missing, parse, #pie_chart_label, #segment_0, #segment_1, #segment_2, #segment_3, #segment_4, #segment_5, #segments, #summary_metrics, #tooltip_name

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

Class Method Details

.browser_client_metric(os, browser, version, apdex_t) ⇒ Object



13
14
15
# File 'lib/new_relic/metric_parser/apdex.rb', line 13

def self.browser_client_metric(os, browser, version, apdex_t)
  "#{self.client_metric(apdex_t)}/#{os}/#{browser}/#{version}"
end

.client_metric(apdex_t) ⇒ Object

Convenience method for creating the appropriate client metric name.



10
11
12
# File 'lib/new_relic/metric_parser/apdex.rb', line 10

def self.client_metric(apdex_t)
  "Apdex/#{CLIENT}/#{apdex_t}"
end

Instance Method Details

#apdex_tObject

Apdex/Client/N



31
32
33
# File 'lib/new_relic/metric_parser/apdex.rb', line 31

def apdex_t
  is_client? && segments[2].to_f
end

#browserObject



39
40
41
# File 'lib/new_relic/metric_parser/apdex.rb', line 39

def browser
  is_browser_summary? && segments[4]
end

#browser_versionObject



43
44
45
# File 'lib/new_relic/metric_parser/apdex.rb', line 43

def browser_version
  is_browser_summary? && segments[5]
end

#call_rate_suffixObject



83
84
85
# File 'lib/new_relic/metric_parser/apdex.rb', line 83

def call_rate_suffix
  'rpm'
end

#developer_nameObject



55
56
57
58
59
60
61
62
# File 'lib/new_relic/metric_parser/apdex.rb', line 55

def developer_name
  case
  when is_client? then "Apdex Client (#{apdex_t})"
  when is_browser_summary? then "Apdex Client for #{os_and_browser} (#{apdex_t})"
  when is_summary? then "Apdex"
  else "Apdex #{segments[1..-1].join("/")}"
  end
end

#is_browser_summary?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/new_relic/metric_parser/apdex.rb', line 23

def is_browser_summary?
  is_client? && segments.size == 6
end

#is_client?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/new_relic/metric_parser/apdex.rb', line 17

def is_client?
  segments[1] == CLIENT
end

#is_client_summary?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/new_relic/metric_parser/apdex.rb', line 20

def is_client_summary?
  is_client? && segments.size == 3
end

#is_summary?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/new_relic/metric_parser/apdex.rb', line 26

def is_summary?
  segments.size == 1
end

#platformObject



35
36
37
# File 'lib/new_relic/metric_parser/apdex.rb', line 35

def platform
  is_browser_summary? && segments[3]
end

#platform_and_user_agentObject



51
52
53
# File 'lib/new_relic/metric_parser/apdex.rb', line 51

def platform_and_user_agent
  is_browser_summary? && segments[3..-1].join(" ")
end

#short_nameObject



64
65
66
67
68
69
70
71
# File 'lib/new_relic/metric_parser/apdex.rb', line 64

def short_name
  # standard controller actions
  if segments.length > 1
    url
  else
    'All Frontend Urls'
  end
end

#tt_pathObject

this is used to match transaction traces to controller actions. TT’s don’t have a preceding slash :P



79
80
81
# File 'lib/new_relic/metric_parser/apdex.rb', line 79

def tt_path
  segments[1..-1].join('/')
end

#urlObject



73
74
75
# File 'lib/new_relic/metric_parser/apdex.rb', line 73

def url
  '/' + segments[1..-1].join('/')
end

#user_agentObject



47
48
49
# File 'lib/new_relic/metric_parser/apdex.rb', line 47

def user_agent
  is_browser_summary? && segments[4..-1].join(" ")
end