application_insights 0.1.0

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.
Files changed (68) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +40 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +106 -0
  6. data/Rakefile +10 -0
  7. data/application_insights.gemspec +25 -0
  8. data/lib/application_insights.rb +2 -0
  9. data/lib/application_insights/channel/contracts/application.rb +35 -0
  10. data/lib/application_insights/channel/contracts/data.rb +47 -0
  11. data/lib/application_insights/channel/contracts/data_point.rb +125 -0
  12. data/lib/application_insights/channel/contracts/data_point_type.rb +16 -0
  13. data/lib/application_insights/channel/contracts/dependency_kind.rb +22 -0
  14. data/lib/application_insights/channel/contracts/dependency_source_type.rb +19 -0
  15. data/lib/application_insights/channel/contracts/device.rb +243 -0
  16. data/lib/application_insights/channel/contracts/envelope.rb +254 -0
  17. data/lib/application_insights/channel/contracts/event_data.rb +77 -0
  18. data/lib/application_insights/channel/contracts/exception_data.rb +105 -0
  19. data/lib/application_insights/channel/contracts/exception_details.rb +125 -0
  20. data/lib/application_insights/channel/contracts/internal.rb +51 -0
  21. data/lib/application_insights/channel/contracts/json_serializable.rb +59 -0
  22. data/lib/application_insights/channel/contracts/location.rb +35 -0
  23. data/lib/application_insights/channel/contracts/message_data.rb +76 -0
  24. data/lib/application_insights/channel/contracts/metric_data.rb +60 -0
  25. data/lib/application_insights/channel/contracts/operation.rb +83 -0
  26. data/lib/application_insights/channel/contracts/page_view_data.rb +109 -0
  27. data/lib/application_insights/channel/contracts/remote_dependency_data.rb +218 -0
  28. data/lib/application_insights/channel/contracts/request_data.rb +173 -0
  29. data/lib/application_insights/channel/contracts/session.rb +67 -0
  30. data/lib/application_insights/channel/contracts/severity_level.rb +25 -0
  31. data/lib/application_insights/channel/contracts/stack_frame.rb +91 -0
  32. data/lib/application_insights/channel/contracts/user.rb +83 -0
  33. data/lib/application_insights/channel/queue_base.rb +48 -0
  34. data/lib/application_insights/channel/sender_base.rb +46 -0
  35. data/lib/application_insights/channel/synchronous_queue.rb +28 -0
  36. data/lib/application_insights/channel/synchronous_sender.rb +13 -0
  37. data/lib/application_insights/channel/telemetry_channel.rb +81 -0
  38. data/lib/application_insights/channel/telemetry_context.rb +49 -0
  39. data/lib/application_insights/telemetry_client.rb +111 -0
  40. data/lib/application_insights/version.rb +3 -0
  41. data/test/application_insights.rb +9 -0
  42. data/test/application_insights/channel/contracts/test_application.rb +31 -0
  43. data/test/application_insights/channel/contracts/test_data.rb +44 -0
  44. data/test/application_insights/channel/contracts/test_data_point.rb +109 -0
  45. data/test/application_insights/channel/contracts/test_device.rb +200 -0
  46. data/test/application_insights/channel/contracts/test_envelope.rb +209 -0
  47. data/test/application_insights/channel/contracts/test_event_data.rb +62 -0
  48. data/test/application_insights/channel/contracts/test_exception_data.rb +85 -0
  49. data/test/application_insights/channel/contracts/test_exception_details.rb +106 -0
  50. data/test/application_insights/channel/contracts/test_internal.rb +44 -0
  51. data/test/application_insights/channel/contracts/test_location.rb +31 -0
  52. data/test/application_insights/channel/contracts/test_message_data.rb +66 -0
  53. data/test/application_insights/channel/contracts/test_metric_data.rb +50 -0
  54. data/test/application_insights/channel/contracts/test_operation.rb +70 -0
  55. data/test/application_insights/channel/contracts/test_page_view_data.rb +88 -0
  56. data/test/application_insights/channel/contracts/test_remote_dependency_data.rb +183 -0
  57. data/test/application_insights/channel/contracts/test_request_data.rb +153 -0
  58. data/test/application_insights/channel/contracts/test_session.rb +57 -0
  59. data/test/application_insights/channel/contracts/test_stack_frame.rb +83 -0
  60. data/test/application_insights/channel/contracts/test_user.rb +70 -0
  61. data/test/application_insights/channel/test_queue_base.rb +88 -0
  62. data/test/application_insights/channel/test_sender_base.rb +96 -0
  63. data/test/application_insights/channel/test_synchronous_queue.rb +42 -0
  64. data/test/application_insights/channel/test_synchronous_sender.rb +11 -0
  65. data/test/application_insights/channel/test_telemetry_channel.rb +102 -0
  66. data/test/application_insights/channel/test_telemetry_context.rb +72 -0
  67. data/test/application_insights/test_telemetry_client.rb +107 -0
  68. metadata +166 -0
@@ -0,0 +1,76 @@
1
+ require_relative 'json_serializable'
2
+
3
+ module ApplicationInsights
4
+ module Channel
5
+ module Contracts
6
+ # Data contract class for type MessageData.
7
+ class MessageData < JsonSerializable
8
+ # Initializes a new instance of the MessageData class.
9
+ def initialize(options={})
10
+ defaults = {
11
+ 'ver' => 2,
12
+ 'message' => nil,
13
+ 'severityLevel' => nil,
14
+ 'properties' => {}
15
+ }
16
+ values = {
17
+ 'ver' => 2,
18
+ 'message' => nil
19
+ }
20
+ super defaults, values, options
21
+ end
22
+
23
+ # Gets the ver property.
24
+ def ver
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
+ return @values['severityLevel'] if @values.key?('severityLevel')
46
+ @defaults['severityLevel']
47
+ end
48
+
49
+ # Sets the severity_level property.
50
+ def severity_level=(value)
51
+ if value == @defaults['severityLevel']
52
+ @values.delete 'severityLevel' if @values.key? 'severityLevel'
53
+ else
54
+ @values['severityLevel'] = value
55
+ end
56
+ end
57
+
58
+ # Gets the properties property.
59
+ def properties
60
+ return @values['properties'] if @values.key?('properties')
61
+ @values['properties'] = {}
62
+ @values['properties']
63
+ end
64
+
65
+ # Sets the properties property.
66
+ def properties=(value)
67
+ if value == @defaults['properties']
68
+ @values.delete 'properties' if @values.key? 'properties'
69
+ else
70
+ @values['properties'] = value
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,60 @@
1
+ require_relative 'json_serializable'
2
+
3
+ module ApplicationInsights
4
+ module Channel
5
+ module Contracts
6
+ # Data contract class for type MetricData.
7
+ class MetricData < JsonSerializable
8
+ # Initializes a new instance of the MetricData class.
9
+ def initialize(options={})
10
+ defaults = {
11
+ 'ver' => 2,
12
+ 'metrics' => [],
13
+ 'properties' => {}
14
+ }
15
+ values = {
16
+ 'ver' => 2,
17
+ 'metrics' => []
18
+ }
19
+ super defaults, values, options
20
+ end
21
+
22
+ # Gets the ver property.
23
+ def ver
24
+ @values['ver']
25
+ end
26
+
27
+ # Sets the ver property.
28
+ def ver=(value)
29
+ @values['ver'] = value
30
+ end
31
+
32
+ # Gets the metrics property.
33
+ def metrics
34
+ @values['metrics']
35
+ end
36
+
37
+ # Sets the metrics property.
38
+ def metrics=(value)
39
+ @values['metrics'] = value
40
+ end
41
+
42
+ # Gets the properties property.
43
+ def properties
44
+ return @values['properties'] if @values.key?('properties')
45
+ @values['properties'] = {}
46
+ @values['properties']
47
+ end
48
+
49
+ # Sets the properties property.
50
+ def properties=(value)
51
+ if value == @defaults['properties']
52
+ @values.delete 'properties' if @values.key? 'properties'
53
+ else
54
+ @values['properties'] = value
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,83 @@
1
+ require_relative 'json_serializable'
2
+
3
+ module ApplicationInsights
4
+ module Channel
5
+ module Contracts
6
+ # Data contract class for type Operation.
7
+ class Operation < JsonSerializable
8
+ # Initializes a new instance of the Operation class.
9
+ def initialize(options={})
10
+ defaults = {
11
+ 'ai.operation.id' => nil,
12
+ 'ai.operation.name' => nil,
13
+ 'ai.operation.parentId' => nil,
14
+ 'ai.operation.rootId' => nil
15
+ }
16
+ values = {
17
+ }
18
+ super defaults, values, options
19
+ end
20
+
21
+ # Gets the id property.
22
+ def id
23
+ return @values['ai.operation.id'] if @values.key?('ai.operation.id')
24
+ @defaults['ai.operation.id']
25
+ end
26
+
27
+ # Sets the id property.
28
+ def id=(value)
29
+ if value == @defaults['ai.operation.id']
30
+ @values.delete 'ai.operation.id' if @values.key? 'ai.operation.id'
31
+ else
32
+ @values['ai.operation.id'] = value
33
+ end
34
+ end
35
+
36
+ # Gets the name property.
37
+ def name
38
+ return @values['ai.operation.name'] if @values.key?('ai.operation.name')
39
+ @defaults['ai.operation.name']
40
+ end
41
+
42
+ # Sets the name property.
43
+ def name=(value)
44
+ if value == @defaults['ai.operation.name']
45
+ @values.delete 'ai.operation.name' if @values.key? 'ai.operation.name'
46
+ else
47
+ @values['ai.operation.name'] = value
48
+ end
49
+ end
50
+
51
+ # Gets the parent_id property.
52
+ def parent_id
53
+ return @values['ai.operation.parentId'] if @values.key?('ai.operation.parentId')
54
+ @defaults['ai.operation.parentId']
55
+ end
56
+
57
+ # Sets the parent_id property.
58
+ def parent_id=(value)
59
+ if value == @defaults['ai.operation.parentId']
60
+ @values.delete 'ai.operation.parentId' if @values.key? 'ai.operation.parentId'
61
+ else
62
+ @values['ai.operation.parentId'] = value
63
+ end
64
+ end
65
+
66
+ # Gets the root_id property.
67
+ def root_id
68
+ return @values['ai.operation.rootId'] if @values.key?('ai.operation.rootId')
69
+ @defaults['ai.operation.rootId']
70
+ end
71
+
72
+ # Sets the root_id property.
73
+ def root_id=(value)
74
+ if value == @defaults['ai.operation.rootId']
75
+ @values.delete 'ai.operation.rootId' if @values.key? 'ai.operation.rootId'
76
+ else
77
+ @values['ai.operation.rootId'] = value
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,109 @@
1
+ require_relative 'json_serializable'
2
+
3
+ module ApplicationInsights
4
+ module Channel
5
+ module Contracts
6
+ # Data contract class for type PageViewData.
7
+ class PageViewData < JsonSerializable
8
+ # Initializes a new instance of the PageViewData class.
9
+ def initialize(options={})
10
+ defaults = {
11
+ 'ver' => 2,
12
+ 'url' => nil,
13
+ 'name' => nil,
14
+ 'duration' => nil,
15
+ 'properties' => {},
16
+ 'measurements' => {}
17
+ }
18
+ values = {
19
+ 'ver' => 2,
20
+ 'name' => nil
21
+ }
22
+ super defaults, values, options
23
+ end
24
+
25
+ # Gets the ver property.
26
+ def ver
27
+ @values['ver']
28
+ end
29
+
30
+ # Sets the ver property.
31
+ def ver=(value)
32
+ @values['ver'] = value
33
+ end
34
+
35
+ # Gets the url property.
36
+ def url
37
+ return @values['url'] if @values.key?('url')
38
+ @defaults['url']
39
+ end
40
+
41
+ # Sets the url property.
42
+ def url=(value)
43
+ if value == @defaults['url']
44
+ @values.delete 'url' if @values.key? 'url'
45
+ else
46
+ @values['url'] = value
47
+ end
48
+ end
49
+
50
+ # Gets the name property.
51
+ def name
52
+ @values['name']
53
+ end
54
+
55
+ # Sets the name property.
56
+ def name=(value)
57
+ @values['name'] = value
58
+ end
59
+
60
+ # Gets the duration property.
61
+ def duration
62
+ return @values['duration'] if @values.key?('duration')
63
+ @defaults['duration']
64
+ end
65
+
66
+ # Sets the duration property.
67
+ def duration=(value)
68
+ if value == @defaults['duration']
69
+ @values.delete 'duration' if @values.key? 'duration'
70
+ else
71
+ @values['duration'] = value
72
+ end
73
+ end
74
+
75
+ # Gets the properties property.
76
+ def properties
77
+ return @values['properties'] if @values.key?('properties')
78
+ @values['properties'] = {}
79
+ @values['properties']
80
+ end
81
+
82
+ # Sets the properties property.
83
+ def properties=(value)
84
+ if value == @defaults['properties']
85
+ @values.delete 'properties' if @values.key? 'properties'
86
+ else
87
+ @values['properties'] = value
88
+ end
89
+ end
90
+
91
+ # Gets the measurements property.
92
+ def measurements
93
+ return @values['measurements'] if @values.key?('measurements')
94
+ @values['measurements'] = {}
95
+ @values['measurements']
96
+ end
97
+
98
+ # Sets the measurements property.
99
+ def measurements=(value)
100
+ if value == @defaults['measurements']
101
+ @values.delete 'measurements' if @values.key? 'measurements'
102
+ else
103
+ @values['measurements'] = value
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,218 @@
1
+ require_relative 'json_serializable'
2
+
3
+ module ApplicationInsights
4
+ module Channel
5
+ module Contracts
6
+ require_relative 'data_point_type'
7
+ require_relative 'dependency_kind'
8
+ require_relative 'dependency_source_type'
9
+ # Data contract class for type RemoteDependencyData.
10
+ class RemoteDependencyData < JsonSerializable
11
+ # Initializes a new instance of the RemoteDependencyData class.
12
+ def initialize(options={})
13
+ defaults = {
14
+ 'ver' => 2,
15
+ 'name' => nil,
16
+ 'kind' => DataPointType::MEASUREMENT,
17
+ 'value' => nil,
18
+ 'count' => nil,
19
+ 'min' => nil,
20
+ 'max' => nil,
21
+ 'stdDev' => nil,
22
+ 'dependencyKind' => DependencyKind::UNDEFINED,
23
+ 'success' => true,
24
+ 'async' => nil,
25
+ 'dependencySource' => DependencySourceType::UNDEFINED,
26
+ 'properties' => {}
27
+ }
28
+ values = {
29
+ 'ver' => 2,
30
+ 'name' => nil,
31
+ 'kind' => DataPointType::MEASUREMENT,
32
+ 'value' => nil,
33
+ 'dependencyKind' => DependencyKind::UNDEFINED,
34
+ 'success' => true,
35
+ 'dependencySource' => DependencySourceType::UNDEFINED
36
+ }
37
+ super defaults, values, options
38
+ end
39
+
40
+ # Gets the ver property.
41
+ def ver
42
+ @values['ver']
43
+ end
44
+
45
+ # Sets the ver property.
46
+ def ver=(value)
47
+ @values['ver'] = value
48
+ end
49
+
50
+ # Gets the name property.
51
+ def name
52
+ @values['name']
53
+ end
54
+
55
+ # Sets the name property.
56
+ def name=(value)
57
+ @values['name'] = value
58
+ end
59
+
60
+ # Gets the kind property.
61
+ def kind
62
+ return @values['kind'] if @values.key?('kind')
63
+ @defaults['kind']
64
+ end
65
+
66
+ # Sets the kind property.
67
+ def kind=(value)
68
+ if value == @defaults['kind']
69
+ @values.delete 'kind' if @values.key? 'kind'
70
+ else
71
+ @values['kind'] = value
72
+ end
73
+ end
74
+
75
+ # Gets the value property.
76
+ def value
77
+ @values['value']
78
+ end
79
+
80
+ # Sets the value property.
81
+ def value=(value)
82
+ @values['value'] = value
83
+ end
84
+
85
+ # Gets the count property.
86
+ def count
87
+ return @values['count'] if @values.key?('count')
88
+ @defaults['count']
89
+ end
90
+
91
+ # Sets the count property.
92
+ def count=(value)
93
+ if value == @defaults['count']
94
+ @values.delete 'count' if @values.key? 'count'
95
+ else
96
+ @values['count'] = value
97
+ end
98
+ end
99
+
100
+ # Gets the min property.
101
+ def min
102
+ return @values['min'] if @values.key?('min')
103
+ @defaults['min']
104
+ end
105
+
106
+ # Sets the min property.
107
+ def min=(value)
108
+ if value == @defaults['min']
109
+ @values.delete 'min' if @values.key? 'min'
110
+ else
111
+ @values['min'] = value
112
+ end
113
+ end
114
+
115
+ # Gets the max property.
116
+ def max
117
+ return @values['max'] if @values.key?('max')
118
+ @defaults['max']
119
+ end
120
+
121
+ # Sets the max property.
122
+ def max=(value)
123
+ if value == @defaults['max']
124
+ @values.delete 'max' if @values.key? 'max'
125
+ else
126
+ @values['max'] = value
127
+ end
128
+ end
129
+
130
+ # Gets the std_dev property.
131
+ def std_dev
132
+ return @values['stdDev'] if @values.key?('stdDev')
133
+ @defaults['stdDev']
134
+ end
135
+
136
+ # Sets the std_dev property.
137
+ def std_dev=(value)
138
+ if value == @defaults['stdDev']
139
+ @values.delete 'stdDev' if @values.key? 'stdDev'
140
+ else
141
+ @values['stdDev'] = value
142
+ end
143
+ end
144
+
145
+ # Gets the dependency_kind property.
146
+ def dependency_kind
147
+ @values['dependencyKind']
148
+ end
149
+
150
+ # Sets the dependency_kind property.
151
+ def dependency_kind=(value)
152
+ @values['dependencyKind'] = value
153
+ end
154
+
155
+ # Gets the success property.
156
+ def success
157
+ return @values['success'] if @values.key?('success')
158
+ @defaults['success']
159
+ end
160
+
161
+ # Sets the success property.
162
+ def success=(value)
163
+ if value == @defaults['success']
164
+ @values.delete 'success' if @values.key? 'success'
165
+ else
166
+ @values['success'] = value
167
+ end
168
+ end
169
+
170
+ # Gets the async property.
171
+ def async
172
+ return @values['async'] if @values.key?('async')
173
+ @defaults['async']
174
+ end
175
+
176
+ # Sets the async property.
177
+ def async=(value)
178
+ if value == @defaults['async']
179
+ @values.delete 'async' if @values.key? 'async'
180
+ else
181
+ @values['async'] = value
182
+ end
183
+ end
184
+
185
+ # Gets the dependency_source property.
186
+ def dependency_source
187
+ return @values['dependencySource'] if @values.key?('dependencySource')
188
+ @defaults['dependencySource']
189
+ end
190
+
191
+ # Sets the dependency_source property.
192
+ def dependency_source=(value)
193
+ if value == @defaults['dependencySource']
194
+ @values.delete 'dependencySource' if @values.key? 'dependencySource'
195
+ else
196
+ @values['dependencySource'] = value
197
+ end
198
+ end
199
+
200
+ # Gets the properties property.
201
+ def properties
202
+ return @values['properties'] if @values.key?('properties')
203
+ @values['properties'] = {}
204
+ @values['properties']
205
+ end
206
+
207
+ # Sets the properties property.
208
+ def properties=(value)
209
+ if value == @defaults['properties']
210
+ @values.delete 'properties' if @values.key? 'properties'
211
+ else
212
+ @values['properties'] = value
213
+ end
214
+ end
215
+ end
216
+ end
217
+ end
218
+ end