Module: D13n::Metric::Stream::StreamTracerHelpers::Namer

Included in:
D13n::Metric::Stream::SpanTracerHelpers, D13n::Metric::Stream::StreamTracerHelpers
Defined in:
lib/d13n/metric/stream/stream_tracer_helpers.rb

Instance Method Summary collapse

Instance Method Details

#metric_name(type) ⇒ Object



9
10
11
# File 'lib/d13n/metric/stream/stream_tracer_helpers.rb', line 9

def metric_name(type)
  "#{prefix}.#{type}"
end

#prefixObject



5
6
7
# File 'lib/d13n/metric/stream/stream_tracer_helpers.rb', line 5

def prefix
  "app.http.i"
end

#stream_apdex_tags(metric_data) ⇒ Object



74
75
76
77
78
# File 'lib/d13n/metric/stream/stream_tracer_helpers.rb', line 74

def stream_apdex_tags(metric_data)
  tags = stream_basic_tags(metric_data)
  tags << "apdex_zone:#{metric_data[:apdex_perf_zone]}"
  tags
end

#stream_basic_tags(metric_data) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/d13n/metric/stream/stream_tracer_helpers.rb', line 13

def stream_basic_tags(metric_data)
  tags = []
  tags << "idc:#{D13n.idc_name}"
  tags << "env:#{D13n.idc_env}"
  tags << "app:#{D13n.app_name}"
  tags << "name:#{metric_data[:name]}"
  tags << "uuid:#{metric_data[:uuid]}"
  tags << "stream_id:#{metric_data[:referring_stream_id] || metric_data[:uuid]}"
  tags << "type:#{metric_data[:referring_stream_id].nil? ? 'stream' : 'span'}"
  tags
end

#stream_duration_tags(metric_data) ⇒ Object



25
26
27
28
29
# File 'lib/d13n/metric/stream/stream_tracer_helpers.rb', line 25

def stream_duration_tags(metric_data)
  tags = stream_basic_tags(metric_data)
  tags << "time:duration"
  tags
end

#stream_error_tags(metric_data, error) ⇒ Object



68
69
70
71
72
# File 'lib/d13n/metric/stream/stream_tracer_helpers.rb', line 68

def stream_error_tags(metric_data, error)
  tags = stream_basic_tags(metric_data)
  tags << "error:#{error.is_a?(Class) ? error.name : error.class.name}"
  tags
end

#stream_exclusive_tags(metric_data) ⇒ Object



31
32
33
34
35
# File 'lib/d13n/metric/stream/stream_tracer_helpers.rb', line 31

def stream_exclusive_tags(metric_data)
  tags = stream_basic_tags(metric_data)
  tags << "time:exclusive"
  tags
end

#stream_http_request_content_length_tags(metric_data) ⇒ Object



56
57
58
59
60
# File 'lib/d13n/metric/stream/stream_tracer_helpers.rb', line 56

def stream_http_request_content_length_tags(metric_data)
  tags = stream_basic_tags(metric_data)
  tags << "request:length"
  tags
end

#stream_http_response_code_tags(metric_data) ⇒ Object



42
43
44
45
46
47
# File 'lib/d13n/metric/stream/stream_tracer_helpers.rb', line 42

def stream_http_response_code_tags(metric_data)
  tags = stream_basic_tags(metric_data)
  tags << "response:code"
  tags << "code:#{metric_data[:http_response_code]}"
  tags
end

#stream_http_response_content_length_tags(metric_data) ⇒ Object



62
63
64
65
66
# File 'lib/d13n/metric/stream/stream_tracer_helpers.rb', line 62

def stream_http_response_content_length_tags(metric_data)
  tags = stream_basic_tags(metric_data)
  tags << "response:length"
  tags
end

#stream_http_response_content_type_tags(metric_data) ⇒ Object



49
50
51
52
53
54
# File 'lib/d13n/metric/stream/stream_tracer_helpers.rb', line 49

def stream_http_response_content_type_tags(metric_data)
  tags = stream_basic_tags(metric_data)
  tags << "response:type"
  tags << "type:#{metric_data[:http_response_content_type]}"
  tags
end

#stream_request_tags(metric_data) ⇒ Object



37
38
39
40
# File 'lib/d13n/metric/stream/stream_tracer_helpers.rb', line 37

def stream_request_tags(metric_data)
  tags = stream_basic_tags(metric_data)
  tags
end