application_insights 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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,22 @@
1
+ require_relative 'json_serializable'
2
+
3
+ module ApplicationInsights
4
+ module Channel
5
+ module Contracts
6
+ # Data contract class for type DependencyKind.
7
+ class DependencyKind
8
+ # Enumeration value UNDEFINED.
9
+ UNDEFINED = 0
10
+
11
+ # Enumeration value HTTP_ONLY.
12
+ HTTP_ONLY = 1
13
+
14
+ # Enumeration value HTTP_ANY.
15
+ HTTP_ANY = 2
16
+
17
+ # Enumeration value SQL.
18
+ SQL = 3
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ require_relative 'json_serializable'
2
+
3
+ module ApplicationInsights
4
+ module Channel
5
+ module Contracts
6
+ # Data contract class for type DependencySourceType.
7
+ class DependencySourceType
8
+ # Enumeration value UNDEFINED.
9
+ UNDEFINED = 0
10
+
11
+ # Enumeration value AIC.
12
+ AIC = 1
13
+
14
+ # Enumeration value APMC.
15
+ APMC = 2
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,243 @@
1
+ require_relative 'json_serializable'
2
+
3
+ module ApplicationInsights
4
+ module Channel
5
+ module Contracts
6
+ # Data contract class for type Device.
7
+ class Device < JsonSerializable
8
+ # Initializes a new instance of the Device class.
9
+ def initialize(options={})
10
+ defaults = {
11
+ 'ai.device.id' => nil,
12
+ 'ai.device.ip' => nil,
13
+ 'ai.device.language' => nil,
14
+ 'ai.device.locale' => nil,
15
+ 'ai.device.model' => nil,
16
+ 'ai.device.network' => nil,
17
+ 'ai.device.oemName' => nil,
18
+ 'ai.device.os' => nil,
19
+ 'ai.device.osVersion' => nil,
20
+ 'ai.device.roleInstance' => nil,
21
+ 'ai.device.roleName' => nil,
22
+ 'ai.device.screenResolution' => nil,
23
+ 'ai.device.type' => nil,
24
+ 'ai.device.vmName' => nil
25
+ }
26
+ values = {
27
+ }
28
+ super defaults, values, options
29
+ end
30
+
31
+ # Gets the id property.
32
+ def id
33
+ return @values['ai.device.id'] if @values.key?('ai.device.id')
34
+ @defaults['ai.device.id']
35
+ end
36
+
37
+ # Sets the id property.
38
+ def id=(value)
39
+ if value == @defaults['ai.device.id']
40
+ @values.delete 'ai.device.id' if @values.key? 'ai.device.id'
41
+ else
42
+ @values['ai.device.id'] = value
43
+ end
44
+ end
45
+
46
+ # Gets the ip property.
47
+ def ip
48
+ return @values['ai.device.ip'] if @values.key?('ai.device.ip')
49
+ @defaults['ai.device.ip']
50
+ end
51
+
52
+ # Sets the ip property.
53
+ def ip=(value)
54
+ if value == @defaults['ai.device.ip']
55
+ @values.delete 'ai.device.ip' if @values.key? 'ai.device.ip'
56
+ else
57
+ @values['ai.device.ip'] = value
58
+ end
59
+ end
60
+
61
+ # Gets the language property.
62
+ def language
63
+ return @values['ai.device.language'] if @values.key?('ai.device.language')
64
+ @defaults['ai.device.language']
65
+ end
66
+
67
+ # Sets the language property.
68
+ def language=(value)
69
+ if value == @defaults['ai.device.language']
70
+ @values.delete 'ai.device.language' if @values.key? 'ai.device.language'
71
+ else
72
+ @values['ai.device.language'] = value
73
+ end
74
+ end
75
+
76
+ # Gets the locale property.
77
+ def locale
78
+ return @values['ai.device.locale'] if @values.key?('ai.device.locale')
79
+ @defaults['ai.device.locale']
80
+ end
81
+
82
+ # Sets the locale property.
83
+ def locale=(value)
84
+ if value == @defaults['ai.device.locale']
85
+ @values.delete 'ai.device.locale' if @values.key? 'ai.device.locale'
86
+ else
87
+ @values['ai.device.locale'] = value
88
+ end
89
+ end
90
+
91
+ # Gets the model property.
92
+ def model
93
+ return @values['ai.device.model'] if @values.key?('ai.device.model')
94
+ @defaults['ai.device.model']
95
+ end
96
+
97
+ # Sets the model property.
98
+ def model=(value)
99
+ if value == @defaults['ai.device.model']
100
+ @values.delete 'ai.device.model' if @values.key? 'ai.device.model'
101
+ else
102
+ @values['ai.device.model'] = value
103
+ end
104
+ end
105
+
106
+ # Gets the network property.
107
+ def network
108
+ return @values['ai.device.network'] if @values.key?('ai.device.network')
109
+ @defaults['ai.device.network']
110
+ end
111
+
112
+ # Sets the network property.
113
+ def network=(value)
114
+ if value == @defaults['ai.device.network']
115
+ @values.delete 'ai.device.network' if @values.key? 'ai.device.network'
116
+ else
117
+ @values['ai.device.network'] = value
118
+ end
119
+ end
120
+
121
+ # Gets the oem_name property.
122
+ def oem_name
123
+ return @values['ai.device.oemName'] if @values.key?('ai.device.oemName')
124
+ @defaults['ai.device.oemName']
125
+ end
126
+
127
+ # Sets the oem_name property.
128
+ def oem_name=(value)
129
+ if value == @defaults['ai.device.oemName']
130
+ @values.delete 'ai.device.oemName' if @values.key? 'ai.device.oemName'
131
+ else
132
+ @values['ai.device.oemName'] = value
133
+ end
134
+ end
135
+
136
+ # Gets the os property.
137
+ def os
138
+ return @values['ai.device.os'] if @values.key?('ai.device.os')
139
+ @defaults['ai.device.os']
140
+ end
141
+
142
+ # Sets the os property.
143
+ def os=(value)
144
+ if value == @defaults['ai.device.os']
145
+ @values.delete 'ai.device.os' if @values.key? 'ai.device.os'
146
+ else
147
+ @values['ai.device.os'] = value
148
+ end
149
+ end
150
+
151
+ # Gets the os_version property.
152
+ def os_version
153
+ return @values['ai.device.osVersion'] if @values.key?('ai.device.osVersion')
154
+ @defaults['ai.device.osVersion']
155
+ end
156
+
157
+ # Sets the os_version property.
158
+ def os_version=(value)
159
+ if value == @defaults['ai.device.osVersion']
160
+ @values.delete 'ai.device.osVersion' if @values.key? 'ai.device.osVersion'
161
+ else
162
+ @values['ai.device.osVersion'] = value
163
+ end
164
+ end
165
+
166
+ # Gets the role_instance property.
167
+ def role_instance
168
+ return @values['ai.device.roleInstance'] if @values.key?('ai.device.roleInstance')
169
+ @defaults['ai.device.roleInstance']
170
+ end
171
+
172
+ # Sets the role_instance property.
173
+ def role_instance=(value)
174
+ if value == @defaults['ai.device.roleInstance']
175
+ @values.delete 'ai.device.roleInstance' if @values.key? 'ai.device.roleInstance'
176
+ else
177
+ @values['ai.device.roleInstance'] = value
178
+ end
179
+ end
180
+
181
+ # Gets the role_name property.
182
+ def role_name
183
+ return @values['ai.device.roleName'] if @values.key?('ai.device.roleName')
184
+ @defaults['ai.device.roleName']
185
+ end
186
+
187
+ # Sets the role_name property.
188
+ def role_name=(value)
189
+ if value == @defaults['ai.device.roleName']
190
+ @values.delete 'ai.device.roleName' if @values.key? 'ai.device.roleName'
191
+ else
192
+ @values['ai.device.roleName'] = value
193
+ end
194
+ end
195
+
196
+ # Gets the screen_resolution property.
197
+ def screen_resolution
198
+ return @values['ai.device.screenResolution'] if @values.key?('ai.device.screenResolution')
199
+ @defaults['ai.device.screenResolution']
200
+ end
201
+
202
+ # Sets the screen_resolution property.
203
+ def screen_resolution=(value)
204
+ if value == @defaults['ai.device.screenResolution']
205
+ @values.delete 'ai.device.screenResolution' if @values.key? 'ai.device.screenResolution'
206
+ else
207
+ @values['ai.device.screenResolution'] = value
208
+ end
209
+ end
210
+
211
+ # Gets the type property.
212
+ def type
213
+ return @values['ai.device.type'] if @values.key?('ai.device.type')
214
+ @defaults['ai.device.type']
215
+ end
216
+
217
+ # Sets the type property.
218
+ def type=(value)
219
+ if value == @defaults['ai.device.type']
220
+ @values.delete 'ai.device.type' if @values.key? 'ai.device.type'
221
+ else
222
+ @values['ai.device.type'] = value
223
+ end
224
+ end
225
+
226
+ # Gets the vm_name property.
227
+ def vm_name
228
+ return @values['ai.device.vmName'] if @values.key?('ai.device.vmName')
229
+ @defaults['ai.device.vmName']
230
+ end
231
+
232
+ # Sets the vm_name property.
233
+ def vm_name=(value)
234
+ if value == @defaults['ai.device.vmName']
235
+ @values.delete 'ai.device.vmName' if @values.key? 'ai.device.vmName'
236
+ else
237
+ @values['ai.device.vmName'] = value
238
+ end
239
+ end
240
+ end
241
+ end
242
+ end
243
+ end
@@ -0,0 +1,254 @@
1
+ require_relative 'json_serializable'
2
+
3
+ module ApplicationInsights
4
+ module Channel
5
+ module Contracts
6
+ # Data contract class for type Envelope.
7
+ class Envelope < JsonSerializable
8
+ # Initializes a new instance of the Envelope class.
9
+ def initialize(options={})
10
+ defaults = {
11
+ 'ver' => 1,
12
+ 'name' => nil,
13
+ 'time' => nil,
14
+ 'sampleRate' => 100.0,
15
+ 'seq' => nil,
16
+ 'iKey' => nil,
17
+ 'flags' => nil,
18
+ 'deviceId' => nil,
19
+ 'os' => nil,
20
+ 'osVer' => nil,
21
+ 'appId' => nil,
22
+ 'appVer' => nil,
23
+ 'userId' => nil,
24
+ 'tags' => {},
25
+ 'data' => nil
26
+ }
27
+ values = {
28
+ 'ver' => 1,
29
+ 'name' => nil,
30
+ 'time' => nil,
31
+ 'sampleRate' => 100.0
32
+ }
33
+ super defaults, values, options
34
+ end
35
+
36
+ # Gets the ver property.
37
+ def ver
38
+ return @values['ver'] if @values.key?('ver')
39
+ @defaults['ver']
40
+ end
41
+
42
+ # Sets the ver property.
43
+ def ver=(value)
44
+ if value == @defaults['ver']
45
+ @values.delete 'ver' if @values.key? 'ver'
46
+ else
47
+ @values['ver'] = value
48
+ end
49
+ end
50
+
51
+ # Gets the name property.
52
+ def name
53
+ @values['name']
54
+ end
55
+
56
+ # Sets the name property.
57
+ def name=(value)
58
+ @values['name'] = value
59
+ end
60
+
61
+ # Gets the time property.
62
+ def time
63
+ @values['time']
64
+ end
65
+
66
+ # Sets the time property.
67
+ def time=(value)
68
+ @values['time'] = value
69
+ end
70
+
71
+ # Gets the sample_rate property.
72
+ def sample_rate
73
+ return @values['sampleRate'] if @values.key?('sampleRate')
74
+ @defaults['sampleRate']
75
+ end
76
+
77
+ # Sets the sample_rate property.
78
+ def sample_rate=(value)
79
+ if value == @defaults['sampleRate']
80
+ @values.delete 'sampleRate' if @values.key? 'sampleRate'
81
+ else
82
+ @values['sampleRate'] = value
83
+ end
84
+ end
85
+
86
+ # Gets the seq property.
87
+ def seq
88
+ return @values['seq'] if @values.key?('seq')
89
+ @defaults['seq']
90
+ end
91
+
92
+ # Sets the seq property.
93
+ def seq=(value)
94
+ if value == @defaults['seq']
95
+ @values.delete 'seq' if @values.key? 'seq'
96
+ else
97
+ @values['seq'] = value
98
+ end
99
+ end
100
+
101
+ # Gets the i_key property.
102
+ def i_key
103
+ return @values['iKey'] if @values.key?('iKey')
104
+ @defaults['iKey']
105
+ end
106
+
107
+ # Sets the i_key property.
108
+ def i_key=(value)
109
+ if value == @defaults['iKey']
110
+ @values.delete 'iKey' if @values.key? 'iKey'
111
+ else
112
+ @values['iKey'] = value
113
+ end
114
+ end
115
+
116
+ # Gets the flags property.
117
+ def flags
118
+ return @values['flags'] if @values.key?('flags')
119
+ @defaults['flags']
120
+ end
121
+
122
+ # Sets the flags property.
123
+ def flags=(value)
124
+ if value == @defaults['flags']
125
+ @values.delete 'flags' if @values.key? 'flags'
126
+ else
127
+ @values['flags'] = value
128
+ end
129
+ end
130
+
131
+ # Gets the device_id property.
132
+ def device_id
133
+ return @values['deviceId'] if @values.key?('deviceId')
134
+ @defaults['deviceId']
135
+ end
136
+
137
+ # Sets the device_id property.
138
+ def device_id=(value)
139
+ if value == @defaults['deviceId']
140
+ @values.delete 'deviceId' if @values.key? 'deviceId'
141
+ else
142
+ @values['deviceId'] = value
143
+ end
144
+ end
145
+
146
+ # Gets the os property.
147
+ def os
148
+ return @values['os'] if @values.key?('os')
149
+ @defaults['os']
150
+ end
151
+
152
+ # Sets the os property.
153
+ def os=(value)
154
+ if value == @defaults['os']
155
+ @values.delete 'os' if @values.key? 'os'
156
+ else
157
+ @values['os'] = value
158
+ end
159
+ end
160
+
161
+ # Gets the os_ver property.
162
+ def os_ver
163
+ return @values['osVer'] if @values.key?('osVer')
164
+ @defaults['osVer']
165
+ end
166
+
167
+ # Sets the os_ver property.
168
+ def os_ver=(value)
169
+ if value == @defaults['osVer']
170
+ @values.delete 'osVer' if @values.key? 'osVer'
171
+ else
172
+ @values['osVer'] = value
173
+ end
174
+ end
175
+
176
+ # Gets the app_id property.
177
+ def app_id
178
+ return @values['appId'] if @values.key?('appId')
179
+ @defaults['appId']
180
+ end
181
+
182
+ # Sets the app_id property.
183
+ def app_id=(value)
184
+ if value == @defaults['appId']
185
+ @values.delete 'appId' if @values.key? 'appId'
186
+ else
187
+ @values['appId'] = value
188
+ end
189
+ end
190
+
191
+ # Gets the app_ver property.
192
+ def app_ver
193
+ return @values['appVer'] if @values.key?('appVer')
194
+ @defaults['appVer']
195
+ end
196
+
197
+ # Sets the app_ver property.
198
+ def app_ver=(value)
199
+ if value == @defaults['appVer']
200
+ @values.delete 'appVer' if @values.key? 'appVer'
201
+ else
202
+ @values['appVer'] = value
203
+ end
204
+ end
205
+
206
+ # Gets the user_id property.
207
+ def user_id
208
+ return @values['userId'] if @values.key?('userId')
209
+ @defaults['userId']
210
+ end
211
+
212
+ # Sets the user_id property.
213
+ def user_id=(value)
214
+ if value == @defaults['userId']
215
+ @values.delete 'userId' if @values.key? 'userId'
216
+ else
217
+ @values['userId'] = value
218
+ end
219
+ end
220
+
221
+ # Gets the tags property.
222
+ def tags
223
+ return @values['tags'] if @values.key?('tags')
224
+ @values['tags'] = {}
225
+ @values['tags']
226
+ end
227
+
228
+ # Sets the tags property.
229
+ def tags=(value)
230
+ if value == @defaults['tags']
231
+ @values.delete 'tags' if @values.key? 'tags'
232
+ else
233
+ @values['tags'] = value
234
+ end
235
+ end
236
+
237
+ # Gets the data property.
238
+ def data
239
+ return @values['data'] if @values.key?('data')
240
+ @defaults['data']
241
+ end
242
+
243
+ # Sets the data property.
244
+ def data=(value)
245
+ if value == @defaults['data']
246
+ @values.delete 'data' if @values.key? 'data'
247
+ else
248
+ @values['data'] = value
249
+ end
250
+ end
251
+ end
252
+ end
253
+ end
254
+ end