application_insights 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +6 -14
- data/.travis.yml +21 -9
- data/CONTRIBUTING.md +30 -0
- data/Gemfile +4 -4
- data/LICENSE.txt +11 -11
- data/README.md +13 -14
- data/Rakefile +14 -14
- data/application_insights.gemspec +28 -29
- data/lib/application_insights.rb +9 -9
- data/lib/application_insights/channel/asynchronous_queue.rb +58 -51
- data/lib/application_insights/channel/asynchronous_sender.rb +132 -123
- data/lib/application_insights/channel/contracts/application.rb +14 -53
- data/lib/application_insights/channel/contracts/cloud.rb +14 -0
- data/lib/application_insights/channel/contracts/data.rb +14 -48
- data/lib/application_insights/channel/contracts/data_point.rb +24 -130
- data/lib/application_insights/channel/contracts/data_point_type.rb +7 -16
- data/lib/application_insights/channel/contracts/dependency_kind.rb +9 -19
- data/lib/application_insights/channel/contracts/dependency_source_type.rb +9 -19
- data/lib/application_insights/channel/contracts/device.rb +28 -257
- data/lib/application_insights/channel/contracts/envelope.rb +40 -266
- data/lib/application_insights/channel/contracts/event_data.rb +28 -77
- data/lib/application_insights/channel/contracts/exception_data.rb +37 -140
- data/lib/application_insights/channel/contracts/exception_details.rb +28 -129
- data/lib/application_insights/channel/contracts/internal.rb +14 -53
- data/lib/application_insights/channel/contracts/json_serializable.rb +59 -59
- data/lib/application_insights/channel/contracts/location.rb +16 -36
- data/lib/application_insights/channel/contracts/message_data.rb +24 -77
- data/lib/application_insights/channel/contracts/metric_data.rb +27 -60
- data/lib/application_insights/channel/contracts/operation.rb +19 -121
- data/lib/application_insights/channel/contracts/page_view_data.rb +30 -111
- data/lib/application_insights/channel/contracts/remote_dependency_data.rb +56 -260
- data/lib/application_insights/channel/contracts/request_data.rb +36 -176
- data/lib/application_insights/channel/contracts/session.rb +15 -70
- data/lib/application_insights/channel/contracts/severity_level.rb +13 -25
- data/lib/application_insights/channel/contracts/stack_frame.rb +17 -94
- data/lib/application_insights/channel/contracts/user.rb +19 -104
- data/lib/application_insights/channel/event.rb +68 -64
- data/lib/application_insights/channel/queue_base.rb +65 -62
- data/lib/application_insights/channel/sender_base.rb +79 -72
- data/lib/application_insights/channel/synchronous_queue.rb +45 -39
- data/lib/application_insights/channel/synchronous_sender.rb +17 -15
- data/lib/application_insights/channel/telemetry_channel.rb +120 -102
- data/lib/application_insights/channel/telemetry_context.rb +85 -68
- data/lib/application_insights/rack/track_request.rb +87 -84
- data/lib/application_insights/telemetry_client.rb +229 -217
- data/lib/application_insights/unhandled_exception.rb +49 -47
- data/lib/application_insights/version.rb +3 -3
- data/test/application_insights.rb +8 -9
- data/test/application_insights/channel/contracts/test_application.rb +44 -44
- data/test/application_insights/channel/contracts/test_cloud.rb +44 -0
- data/test/application_insights/channel/contracts/test_data.rb +44 -44
- data/test/application_insights/channel/contracts/test_data_point.rb +109 -109
- data/test/application_insights/channel/contracts/test_device.rb +200 -200
- data/test/application_insights/channel/contracts/test_envelope.rb +209 -209
- data/test/application_insights/channel/contracts/test_event_data.rb +62 -62
- data/test/application_insights/channel/contracts/test_exception_data.rb +111 -111
- data/test/application_insights/channel/contracts/test_exception_details.rb +106 -106
- data/test/application_insights/channel/contracts/test_internal.rb +44 -44
- data/test/application_insights/channel/contracts/test_location.rb +70 -31
- data/test/application_insights/channel/contracts/test_message_data.rb +66 -66
- data/test/application_insights/channel/contracts/test_metric_data.rb +50 -50
- data/test/application_insights/channel/contracts/test_operation.rb +109 -96
- data/test/application_insights/channel/contracts/test_page_view_data.rb +88 -88
- data/test/application_insights/channel/contracts/test_remote_dependency_data.rb +209 -209
- data/test/application_insights/channel/contracts/test_request_data.rb +153 -153
- data/test/application_insights/channel/contracts/test_session.rb +57 -57
- data/test/application_insights/channel/contracts/test_stack_frame.rb +83 -83
- data/test/application_insights/channel/contracts/test_user.rb +96 -83
- data/test/application_insights/channel/test_asynchronous_queue.rb +47 -47
- data/test/application_insights/channel/test_asynchronous_sender.rb +80 -80
- data/test/application_insights/channel/test_event.rb +52 -52
- data/test/application_insights/channel/test_queue_base.rb +88 -88
- data/test/application_insights/channel/test_sender_base.rb +87 -87
- data/test/application_insights/channel/test_synchronous_queue.rb +27 -27
- data/test/application_insights/channel/test_synchronous_sender.rb +10 -10
- data/test/application_insights/channel/test_telemetry_channel.rb +126 -102
- data/test/application_insights/channel/test_telemetry_context.rb +82 -74
- data/test/application_insights/mock_sender.rb +37 -37
- data/test/application_insights/rack/test_track_request.rb +142 -139
- data/test/application_insights/test_telemetry_client.rb +133 -123
- data/test/application_insights/test_unhandled_exception.rb +23 -24
- metadata +23 -33
@@ -1,129 +1,28 @@
|
|
1
|
-
require_relative 'json_serializable'
|
2
|
-
|
3
|
-
module ApplicationInsights
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
@values.fetch('id') {
|
30
|
-
@values['id'] = nil
|
31
|
-
}
|
32
|
-
end
|
33
|
-
|
34
|
-
# Sets the id property.
|
35
|
-
def id=(value)
|
36
|
-
if value == @defaults['id']
|
37
|
-
@values.delete 'id' if @values.key? 'id'
|
38
|
-
else
|
39
|
-
@values['id'] = value
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
# Gets the outer_id property.
|
44
|
-
def outer_id
|
45
|
-
@values.fetch('outerId') {
|
46
|
-
@values['outerId'] = nil
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
# Sets the outer_id property.
|
51
|
-
def outer_id=(value)
|
52
|
-
if value == @defaults['outerId']
|
53
|
-
@values.delete 'outerId' if @values.key? 'outerId'
|
54
|
-
else
|
55
|
-
@values['outerId'] = value
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Gets the type_name property.
|
60
|
-
def type_name
|
61
|
-
@values['typeName']
|
62
|
-
end
|
63
|
-
|
64
|
-
# Sets the type_name property.
|
65
|
-
def type_name=(value)
|
66
|
-
@values['typeName'] = value
|
67
|
-
end
|
68
|
-
|
69
|
-
# Gets the message property.
|
70
|
-
def message
|
71
|
-
@values['message']
|
72
|
-
end
|
73
|
-
|
74
|
-
# Sets the message property.
|
75
|
-
def message=(value)
|
76
|
-
@values['message'] = value
|
77
|
-
end
|
78
|
-
|
79
|
-
# Gets the has_full_stack property.
|
80
|
-
def has_full_stack
|
81
|
-
@values.fetch('hasFullStack') {
|
82
|
-
@values['hasFullStack'] = true
|
83
|
-
}
|
84
|
-
end
|
85
|
-
|
86
|
-
# Sets the has_full_stack property.
|
87
|
-
def has_full_stack=(value)
|
88
|
-
if value == @defaults['hasFullStack']
|
89
|
-
@values.delete 'hasFullStack' if @values.key? 'hasFullStack'
|
90
|
-
else
|
91
|
-
@values['hasFullStack'] = value
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
# Gets the stack property.
|
96
|
-
def stack
|
97
|
-
@values.fetch('stack') {
|
98
|
-
@values['stack'] = nil
|
99
|
-
}
|
100
|
-
end
|
101
|
-
|
102
|
-
# Sets the stack property.
|
103
|
-
def stack=(value)
|
104
|
-
if value == @defaults['stack']
|
105
|
-
@values.delete 'stack' if @values.key? 'stack'
|
106
|
-
else
|
107
|
-
@values['stack'] = value
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
# Gets the parsed_stack property.
|
112
|
-
def parsed_stack
|
113
|
-
@values.fetch('parsedStack') {
|
114
|
-
@values['parsedStack'] = []
|
115
|
-
}
|
116
|
-
end
|
117
|
-
|
118
|
-
# Sets the parsed_stack property.
|
119
|
-
def parsed_stack=(value)
|
120
|
-
if value == @defaults['parsedStack']
|
121
|
-
@values.delete 'parsedStack' if @values.key? 'parsedStack'
|
122
|
-
else
|
123
|
-
@values['parsedStack'] = value
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
1
|
+
require_relative 'json_serializable'
|
2
|
+
|
3
|
+
module ApplicationInsights::Channel::Contracts
|
4
|
+
class ExceptionDetails
|
5
|
+
include JsonSerializable
|
6
|
+
|
7
|
+
attr_accessor :id, :outer_id, :type_name, :message, :has_full_stack, :stack,
|
8
|
+
:parsed_stack
|
9
|
+
|
10
|
+
attribute_mapping(
|
11
|
+
id: 'id',
|
12
|
+
outer_id: 'outerId',
|
13
|
+
type_name: 'typeName',
|
14
|
+
message: 'message',
|
15
|
+
has_full_stack: 'hasFullStack',
|
16
|
+
stack: 'stack',
|
17
|
+
parsed_stack: 'parsedStack'
|
18
|
+
)
|
19
|
+
|
20
|
+
def has_full_stack
|
21
|
+
@has_full_stack.nil? ? true : @has_full_stack
|
22
|
+
end
|
23
|
+
|
24
|
+
def parsed_stack
|
25
|
+
@parsed_stack ||= []
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -1,53 +1,14 @@
|
|
1
|
-
require_relative 'json_serializable'
|
2
|
-
|
3
|
-
module ApplicationInsights
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
}
|
16
|
-
super defaults, values, options
|
17
|
-
end
|
18
|
-
|
19
|
-
# Gets the sdk_version property.
|
20
|
-
def sdk_version
|
21
|
-
@values.fetch('ai.internal.sdkVersion') {
|
22
|
-
@values['ai.internal.sdkVersion'] = nil
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
# Sets the sdk_version property.
|
27
|
-
def sdk_version=(value)
|
28
|
-
if value == @defaults['ai.internal.sdkVersion']
|
29
|
-
@values.delete 'ai.internal.sdkVersion' if @values.key? 'ai.internal.sdkVersion'
|
30
|
-
else
|
31
|
-
@values['ai.internal.sdkVersion'] = value
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# Gets the agent_version property.
|
36
|
-
def agent_version
|
37
|
-
@values.fetch('ai.internal.agentVersion') {
|
38
|
-
@values['ai.internal.agentVersion'] = nil
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
# Sets the agent_version property.
|
43
|
-
def agent_version=(value)
|
44
|
-
if value == @defaults['ai.internal.agentVersion']
|
45
|
-
@values.delete 'ai.internal.agentVersion' if @values.key? 'ai.internal.agentVersion'
|
46
|
-
else
|
47
|
-
@values['ai.internal.agentVersion'] = value
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
1
|
+
require_relative 'json_serializable'
|
2
|
+
|
3
|
+
module ApplicationInsights::Channel::Contracts
|
4
|
+
class Internal
|
5
|
+
include JsonSerializable
|
6
|
+
|
7
|
+
attr_accessor :sdk_version, :agent_version
|
8
|
+
|
9
|
+
attribute_mapping(
|
10
|
+
sdk_version: 'ai.internal.sdkVersion',
|
11
|
+
agent_version: 'ai.internal.agentVersion'
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
@@ -1,59 +1,59 @@
|
|
1
|
-
require 'json'
|
2
|
-
|
3
|
-
module ApplicationInsights
|
4
|
-
module Channel
|
5
|
-
module Contracts
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
59
|
-
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module ApplicationInsights
|
4
|
+
module Channel
|
5
|
+
module Contracts
|
6
|
+
module JsonSerializable
|
7
|
+
module ClassMethods
|
8
|
+
attr_reader :json_mappings
|
9
|
+
|
10
|
+
def attribute_mapping(mappings)
|
11
|
+
@json_mappings = mappings
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.included(klass)
|
16
|
+
klass.extend JsonSerializable::ClassMethods
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(attributes = {})
|
20
|
+
attributes.each { |k, v| send(:"#{k}=", v) }
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_h
|
24
|
+
output = {}
|
25
|
+
klass = self.class
|
26
|
+
|
27
|
+
klass.json_mappings.each do |attr, name|
|
28
|
+
value = visit self.send(attr)
|
29
|
+
is_empty = value.respond_to?(:empty?) && value.empty?
|
30
|
+
|
31
|
+
output[name] = value unless value.nil? || is_empty
|
32
|
+
end
|
33
|
+
|
34
|
+
output
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_json(args = {})
|
38
|
+
JSON.generate self.to_h, args
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def visit(object)
|
44
|
+
return if object.nil?
|
45
|
+
|
46
|
+
if object.is_a? Array
|
47
|
+
object.map { |e| visit e }
|
48
|
+
elsif object.is_a? Hash
|
49
|
+
Hash[object.map { |k, v| [k, visit(v)] }]
|
50
|
+
elsif object.respond_to? :to_h
|
51
|
+
object.to_h
|
52
|
+
else
|
53
|
+
object
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -1,36 +1,16 @@
|
|
1
|
-
require_relative 'json_serializable'
|
2
|
-
|
3
|
-
module ApplicationInsights
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
# Gets the ip property.
|
19
|
-
def ip
|
20
|
-
@values.fetch('ai.location.ip') {
|
21
|
-
@values['ai.location.ip'] = nil
|
22
|
-
}
|
23
|
-
end
|
24
|
-
|
25
|
-
# Sets the ip property.
|
26
|
-
def ip=(value)
|
27
|
-
if value == @defaults['ai.location.ip']
|
28
|
-
@values.delete 'ai.location.ip' if @values.key? 'ai.location.ip'
|
29
|
-
else
|
30
|
-
@values['ai.location.ip'] = value
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
1
|
+
require_relative 'json_serializable'
|
2
|
+
|
3
|
+
module ApplicationInsights::Channel::Contracts
|
4
|
+
class Location
|
5
|
+
include JsonSerializable
|
6
|
+
|
7
|
+
attr_accessor :ip, :country, :province, :city
|
8
|
+
|
9
|
+
attribute_mapping(
|
10
|
+
ip: 'ai.location.ip',
|
11
|
+
country: 'ai.location.country',
|
12
|
+
province: 'ai.location.province',
|
13
|
+
city: 'ai.location.city'
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
@@ -1,77 +1,24 @@
|
|
1
|
-
require_relative 'json_serializable'
|
2
|
-
|
3
|
-
module ApplicationInsights
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
@values['ver']
|
26
|
-
end
|
27
|
-
|
28
|
-
# Sets the ver property.
|
29
|
-
def ver=(value)
|
30
|
-
@values['ver'] = value
|
31
|
-
end
|
32
|
-
|
33
|
-
# Gets the message property.
|
34
|
-
def message
|
35
|
-
@values['message']
|
36
|
-
end
|
37
|
-
|
38
|
-
# Sets the message property.
|
39
|
-
def message=(value)
|
40
|
-
@values['message'] = value
|
41
|
-
end
|
42
|
-
|
43
|
-
# Gets the severity_level property.
|
44
|
-
def severity_level
|
45
|
-
@values.fetch('severityLevel') {
|
46
|
-
@values['severityLevel'] = nil
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
# Sets the severity_level property.
|
51
|
-
def severity_level=(value)
|
52
|
-
if value == @defaults['severityLevel']
|
53
|
-
@values.delete 'severityLevel' if @values.key? 'severityLevel'
|
54
|
-
else
|
55
|
-
@values['severityLevel'] = value
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Gets the properties property.
|
60
|
-
def properties
|
61
|
-
@values.fetch('properties') {
|
62
|
-
@values['properties'] = {}
|
63
|
-
}
|
64
|
-
end
|
65
|
-
|
66
|
-
# Sets the properties property.
|
67
|
-
def properties=(value)
|
68
|
-
if value == @defaults['properties']
|
69
|
-
@values.delete 'properties' if @values.key? 'properties'
|
70
|
-
else
|
71
|
-
@values['properties'] = value
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
1
|
+
require_relative 'json_serializable'
|
2
|
+
|
3
|
+
module ApplicationInsights::Channel::Contracts
|
4
|
+
class MessageData
|
5
|
+
include JsonSerializable
|
6
|
+
|
7
|
+
attr_accessor :ver, :message, :severity_level, :properties
|
8
|
+
|
9
|
+
attribute_mapping(
|
10
|
+
ver: 'ver',
|
11
|
+
message: 'message',
|
12
|
+
severity_level: 'severityLevel',
|
13
|
+
properties: 'properties'
|
14
|
+
)
|
15
|
+
|
16
|
+
def ver
|
17
|
+
@ver ||= 2
|
18
|
+
end
|
19
|
+
|
20
|
+
def properties
|
21
|
+
@properties ||= {}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|