application_insights 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTRkZjYzYTNhMmU2NTc1ZTJiNGY5Zjc1YjIwZGVhMTFhZWYyNGMwZQ==
4
+ YmYzZWY1NTZhMmUyZGE5MmFiMWU0N2YwZjVmMjEzMmUyNDQwMGIwZg==
5
5
  data.tar.gz: !binary |-
6
- NzM5ODdlMTYxNmM4OTNlODM0MWE2MzY1OTc2Y2Q0YzZiYmE3YTJjNw==
6
+ YTU5M2NlN2NhMjJmZDVkNGVjYjE5NzIxODEzZTU4NGIwNzNmNThmMQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ODNmYWQ0M2NmMzQxMGMyZDM2Y2RmYzg5YWM0M2U1MjgyYTJiZjM0OWUxMjVj
10
- ZjE0M2Q5NzhlMjBhM2MxOWI0ODg1MTRiMWNhNDZhYWEwN2Y5N2FjYWQxNzQ2
11
- N2VjMWE0OTY2NWI4ZGJjODE0YTIxYWE0OTFjZTRlZGZmMDkzODM=
9
+ Y2RlNzYxZjJiNDdkNjRkOGEyYmE4Yjc3NjA4NWQ1YmMyYzFmZWQ4M2Q4ODRk
10
+ NDQ4Mzk3ZTVmOTZlMzljMjA3ZDJhODAwMmMyNTdlNDJkYjU3NTFkMjI0ZTA4
11
+ ZDQ0NWQ0Nzk5ODVmOWE0NTg1Yzc1MGYwMzRhM2JmNjg5MmE2N2E=
12
12
  data.tar.gz: !binary |-
13
- NDZjZmU3NTRhMzY2MmI2MzlkMDcyNGM4ZWRiOWY3NGJlZTI4NTIzZjVhNzEy
14
- OTVkZGJjNTcwOTEyY2YwNzc4ZjRkNWNhNjk4YmQxNDgyODQ2NjY2MWVjYTQz
15
- MzJlMjhiMTc4MTEzNjYxNmIwMGUzYjc0NjY5MWY0MmEwNzM1Zjg=
13
+ NGFhYzM5ZmE3YjBjYmViMWIzZDhmN2ZiMjFmZjMyYmE3MDRiNjQ5YjlmNDk2
14
+ MmZiZmVmODdiMDljNWUwMzVmYjhmN2RiMWRhYmZlZjRhNDNlODFiOGY0Y2U5
15
+ YTFhMTQ2NDEzMGE0MTFmYmRiZmQwMTYzMjM2YWExZTJiY2RmZmM=
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.0
6
+ - 2.2.0
7
+
8
+ install:
9
+ - bundle install
data/README.md CHANGED
@@ -1,16 +1,17 @@
1
1
  # Application Insights SDK for Ruby #
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/application_insights.svg)](http://badge.fury.io/rb/application_insights)
4
+ [![Build Status](https://travis-ci.org/Microsoft/AppInsights-Ruby.svg)](https://travis-ci.org/Microsoft/ApplicationInsights-Ruby)
4
5
 
5
- >Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.
6
+ >Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.
6
7
  > -- <cite>[Ruby - Official Site](https://www.ruby-lang.org/en/)</cite>
7
8
 
8
- This project extends the Application Insights API surface to support Ruby. [Application Insights](http://azure.microsoft.com/en-us/services/application-insights/) is a service that allows developers to keep their application available, performing and succeeding. This Ruby gem will allow you to send telemetry of various kinds (event, trace, exception, etc.) to the Application Insights service where they can be visualized in the Azure Portal.
9
+ This project extends the Application Insights API surface to support Ruby. [Application Insights](http://azure.microsoft.com/en-us/services/application-insights/) is a service that allows developers to keep their application available, performing and succeeding. This Ruby gem will allow you to send telemetry of various kinds (event, trace, exception, etc.) to the Application Insights service where they can be visualized in the Azure Portal.
9
10
 
10
11
 
11
12
  ## Requirements ##
12
13
 
13
- Ruby 1.9.3 is currently supported by this gem.
14
+ Ruby 1.9.3 is currently supported by this gem.
14
15
 
15
16
  ## Installation ##
16
17
 
@@ -49,7 +50,7 @@ require 'application_insights'
49
50
  tc = ApplicationInsights::TelemetryClient.new '<YOUR INSTRUMENTATION KEY GOES HERE>'
50
51
  tc.track_trace 'My trace statement', :properties => { 'custom property' => 'some value' }
51
52
  tc.flush
52
- ```
53
+ ```
53
54
 
54
55
  ###Sending a metric telemetry item (without and with optional values)###
55
56
  ```ruby
@@ -59,7 +60,7 @@ tc.track_metric 'My metric', 42
59
60
  # with all optional values set
60
61
  tc.track_metric 'My metric', 42, :kind => ApplicationInsights::Channel::Contracts::DataPointType::AGGREGATION, :count => 3, :min => 1, :max => 100, :std_dev => 10, :properties => { 'custom property' => 'some value' }
61
62
  tc.flush
62
- ```
63
+ ```
63
64
 
64
65
  ###Sending an exception telemetry item with custom properties and measurements###
65
66
  ```ruby
@@ -71,7 +72,7 @@ rescue => e
71
72
  tc.track_exception e
72
73
  end
73
74
  tc.flush
74
- ```
75
+ ```
75
76
 
76
77
  ###Configuring context for a telemetry client instance###
77
78
  ```ruby
@@ -86,7 +87,7 @@ tc.context.device.type = "Other"
86
87
  tc.context.user.id = 'santa@northpole.net'
87
88
  tc.track_trace 'My trace with context'
88
89
  tc.flush
89
- ```
90
+ ```
90
91
 
91
92
  ###Configuring synchronous (default) channel properties###
92
93
  ```ruby
@@ -144,4 +145,4 @@ require 'application_insights'
144
145
  use ApplicationInsights::Rack::TrackRequest, '<YOUR INSTRUMENTATION KEY GOES HERE>', <buffer size>
145
146
  # For rails, suggest to set up this middleware in application.rb so that unhandled exceptions from controllers are also collected
146
147
  config.middleware.use 'ApplicationInsights::Rack::TrackRequest', '<YOUR INSTRUMENTATION KEY GOES HERE>', <buffer size>
147
- ```
148
+ ```
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'yard', '~> 0.8.7.6'
26
26
  spec.add_development_dependency 'redcarpet', '~> 3.2.2'
27
27
  spec.add_development_dependency 'rack', '>= 1.0.0'
28
+ spec.add_development_dependency 'test-unit', '~> 3.0.8'
28
29
  end
@@ -8,7 +8,8 @@ module ApplicationInsights
8
8
  # Initializes a new instance of the Application class.
9
9
  def initialize(options={})
10
10
  defaults = {
11
- 'ai.application.ver' => nil
11
+ 'ai.application.ver' => nil,
12
+ 'ai.application.build' => nil
12
13
  }
13
14
  values = {
14
15
  }
@@ -30,6 +31,22 @@ module ApplicationInsights
30
31
  @values['ai.application.ver'] = value
31
32
  end
32
33
  end
34
+
35
+ # Gets the build property.
36
+ def build
37
+ @values.fetch('ai.application.build') {
38
+ @values['ai.application.build'] = nil
39
+ }
40
+ end
41
+
42
+ # Sets the build property.
43
+ def build=(value)
44
+ if value == @defaults['ai.application.build']
45
+ @values.delete 'ai.application.build' if @values.key? 'ai.application.build'
46
+ else
47
+ @values['ai.application.build'] = value
48
+ end
49
+ end
33
50
  end
34
51
  end
35
52
  end
@@ -5,17 +5,14 @@ module ApplicationInsights
5
5
  module Contracts
6
6
  # Data contract class for type DependencyKind.
7
7
  class DependencyKind
8
- # Enumeration value UNDEFINED.
9
- UNDEFINED = 0
10
-
11
- # Enumeration value HTTP_ONLY.
12
- HTTP_ONLY = 1
8
+ # Enumeration value SQL.
9
+ SQL = 0
13
10
 
14
- # Enumeration value HTTP_ANY.
15
- HTTP_ANY = 2
11
+ # Enumeration value HTTP.
12
+ HTTP = 1
16
13
 
17
- # Enumeration value SQL.
18
- SQL = 3
14
+ # Enumeration value OTHER.
15
+ OTHER = 2
19
16
  end
20
17
  end
21
18
  end
@@ -21,7 +21,7 @@ module ApplicationInsights
21
21
  'ai.device.roleName' => nil,
22
22
  'ai.device.screenResolution' => nil,
23
23
  'ai.device.type' => nil,
24
- 'ai.device.vmName' => nil
24
+ 'ai.device.machineName' => nil
25
25
  }
26
26
  values = {
27
27
  }
@@ -236,19 +236,19 @@ module ApplicationInsights
236
236
  end
237
237
  end
238
238
 
239
- # Gets the vm_name property.
240
- def vm_name
241
- @values.fetch('ai.device.vmName') {
242
- @values['ai.device.vmName'] = nil
239
+ # Gets the machine_name property.
240
+ def machine_name
241
+ @values.fetch('ai.device.machineName') {
242
+ @values['ai.device.machineName'] = nil
243
243
  }
244
244
  end
245
245
 
246
- # Sets the vm_name property.
247
- def vm_name=(value)
248
- if value == @defaults['ai.device.vmName']
249
- @values.delete 'ai.device.vmName' if @values.key? 'ai.device.vmName'
246
+ # Sets the machine_name property.
247
+ def machine_name=(value)
248
+ if value == @defaults['ai.device.machineName']
249
+ @values.delete 'ai.device.machineName' if @values.key? 'ai.device.machineName'
250
250
  else
251
- @values['ai.device.vmName'] = value
251
+ @values['ai.device.machineName'] = value
252
252
  end
253
253
  end
254
254
  end
@@ -12,6 +12,8 @@ module ApplicationInsights
12
12
  'handledAt' => nil,
13
13
  'exceptions' => [],
14
14
  'severityLevel' => nil,
15
+ 'problemId' => nil,
16
+ 'crashThreadId' => nil,
15
17
  'properties' => {},
16
18
  'measurements' => {}
17
19
  }
@@ -69,6 +71,38 @@ module ApplicationInsights
69
71
  end
70
72
  end
71
73
 
74
+ # Gets the problem_id property.
75
+ def problem_id
76
+ @values.fetch('problemId') {
77
+ @values['problemId'] = nil
78
+ }
79
+ end
80
+
81
+ # Sets the problem_id property.
82
+ def problem_id=(value)
83
+ if value == @defaults['problemId']
84
+ @values.delete 'problemId' if @values.key? 'problemId'
85
+ else
86
+ @values['problemId'] = value
87
+ end
88
+ end
89
+
90
+ # Gets the crash_thread_id property.
91
+ def crash_thread_id
92
+ @values.fetch('crashThreadId') {
93
+ @values['crashThreadId'] = nil
94
+ }
95
+ end
96
+
97
+ # Sets the crash_thread_id property.
98
+ def crash_thread_id=(value)
99
+ if value == @defaults['crashThreadId']
100
+ @values.delete 'crashThreadId' if @values.key? 'crashThreadId'
101
+ else
102
+ @values['crashThreadId'] = value
103
+ end
104
+ end
105
+
72
106
  # Gets the properties property.
73
107
  def properties
74
108
  @values.fetch('properties') {
@@ -11,7 +11,9 @@ module ApplicationInsights
11
11
  'ai.operation.id' => nil,
12
12
  'ai.operation.name' => nil,
13
13
  'ai.operation.parentId' => nil,
14
- 'ai.operation.rootId' => nil
14
+ 'ai.operation.rootId' => nil,
15
+ 'ai.operation.syntheticSource' => nil,
16
+ 'ai.operation.isSynthetic' => nil
15
17
  }
16
18
  values = {
17
19
  }
@@ -81,6 +83,38 @@ module ApplicationInsights
81
83
  @values['ai.operation.rootId'] = value
82
84
  end
83
85
  end
86
+
87
+ # Gets the synthetic_source property.
88
+ def synthetic_source
89
+ @values.fetch('ai.operation.syntheticSource') {
90
+ @values['ai.operation.syntheticSource'] = nil
91
+ }
92
+ end
93
+
94
+ # Sets the synthetic_source property.
95
+ def synthetic_source=(value)
96
+ if value == @defaults['ai.operation.syntheticSource']
97
+ @values.delete 'ai.operation.syntheticSource' if @values.key? 'ai.operation.syntheticSource'
98
+ else
99
+ @values['ai.operation.syntheticSource'] = value
100
+ end
101
+ end
102
+
103
+ # Gets the is_synthetic property.
104
+ def is_synthetic
105
+ @values.fetch('ai.operation.isSynthetic') {
106
+ @values['ai.operation.isSynthetic'] = nil
107
+ }
108
+ end
109
+
110
+ # Sets the is_synthetic property.
111
+ def is_synthetic=(value)
112
+ if value == @defaults['ai.operation.isSynthetic']
113
+ @values.delete 'ai.operation.isSynthetic' if @values.key? 'ai.operation.isSynthetic'
114
+ else
115
+ @values['ai.operation.isSynthetic'] = value
116
+ end
117
+ end
84
118
  end
85
119
  end
86
120
  end
@@ -19,10 +19,12 @@ module ApplicationInsights
19
19
  'min' => nil,
20
20
  'max' => nil,
21
21
  'stdDev' => nil,
22
- 'dependencyKind' => DependencyKind::UNDEFINED,
22
+ 'dependencyKind' => DependencyKind::OTHER,
23
23
  'success' => true,
24
24
  'async' => nil,
25
25
  'dependencySource' => DependencySourceType::UNDEFINED,
26
+ 'commandName' => nil,
27
+ 'dependencyTypeName' => nil,
26
28
  'properties' => {}
27
29
  }
28
30
  values = {
@@ -30,7 +32,7 @@ module ApplicationInsights
30
32
  'name' => nil,
31
33
  'kind' => DataPointType::MEASUREMENT,
32
34
  'value' => nil,
33
- 'dependencyKind' => DependencyKind::UNDEFINED,
35
+ 'dependencyKind' => DependencyKind::OTHER,
34
36
  'success' => true,
35
37
  'dependencySource' => DependencySourceType::UNDEFINED
36
38
  }
@@ -205,6 +207,38 @@ module ApplicationInsights
205
207
  end
206
208
  end
207
209
 
210
+ # Gets the command_name property.
211
+ def command_name
212
+ @values.fetch('commandName') {
213
+ @values['commandName'] = nil
214
+ }
215
+ end
216
+
217
+ # Sets the command_name property.
218
+ def command_name=(value)
219
+ if value == @defaults['commandName']
220
+ @values.delete 'commandName' if @values.key? 'commandName'
221
+ else
222
+ @values['commandName'] = value
223
+ end
224
+ end
225
+
226
+ # Gets the dependency_type_name property.
227
+ def dependency_type_name
228
+ @values.fetch('dependencyTypeName') {
229
+ @values['dependencyTypeName'] = nil
230
+ }
231
+ end
232
+
233
+ # Sets the dependency_type_name property.
234
+ def dependency_type_name=(value)
235
+ if value == @defaults['dependencyTypeName']
236
+ @values.delete 'dependencyTypeName' if @values.key? 'dependencyTypeName'
237
+ else
238
+ @values['dependencyTypeName'] = value
239
+ end
240
+ end
241
+
208
242
  # Gets the properties property.
209
243
  def properties
210
244
  @values.fetch('properties') {
@@ -11,7 +11,8 @@ module ApplicationInsights
11
11
  'ai.user.accountAcquisitionDate' => nil,
12
12
  'ai.user.accountId' => nil,
13
13
  'ai.user.userAgent' => nil,
14
- 'ai.user.id' => nil
14
+ 'ai.user.id' => nil,
15
+ 'ai.user.storeRegion' => nil
15
16
  }
16
17
  values = {
17
18
  }
@@ -81,6 +82,22 @@ module ApplicationInsights
81
82
  @values['ai.user.id'] = value
82
83
  end
83
84
  end
85
+
86
+ # Gets the store_region property.
87
+ def store_region
88
+ @values.fetch('ai.user.storeRegion') {
89
+ @values['ai.user.storeRegion'] = nil
90
+ }
91
+ end
92
+
93
+ # Sets the store_region property.
94
+ def store_region=(value)
95
+ if value == @defaults['ai.user.storeRegion']
96
+ @values.delete 'ai.user.storeRegion' if @values.key? 'ai.user.storeRegion'
97
+ else
98
+ @values['ai.user.storeRegion'] = value
99
+ end
100
+ end
84
101
  end
85
102
  end
86
103
  end
@@ -1,3 +1,3 @@
1
1
  module ApplicationInsights
2
- VERSION = '0.5.2'
2
+ VERSION = '0.5.3'
3
3
  end
@@ -21,11 +21,24 @@ class TestApplication < Test::Unit::TestCase
21
21
  assert_equal expected, actual
22
22
  end
23
23
 
24
+ def test_build_works_as_expected
25
+ expected = 'Test string'
26
+ item = Contracts::Application.new
27
+ item.build = expected
28
+ actual = item.build
29
+ assert_equal expected, actual
30
+ expected = 'Other string'
31
+ item.build = expected
32
+ actual = item.build
33
+ assert_equal expected, actual
34
+ end
35
+
24
36
  def test_to_json_works_as_expected
25
37
  item = Contracts::Application.new
26
38
  item.ver = 'Test string'
39
+ item.build = 'Test string'
27
40
  actual = item.to_json
28
- expected = '{"ai.application.ver":"Test string"}'
41
+ expected = '{"ai.application.ver":"Test string","ai.application.build":"Test string"}'
29
42
  assert_equal expected, actual
30
43
  end
31
44
  end
@@ -22,12 +22,12 @@ class TestDataPoint < Test::Unit::TestCase
22
22
  end
23
23
 
24
24
  def test_kind_works_as_expected
25
- expected = { 'key' => 'value' }
25
+ expected = 5
26
26
  item = Contracts::DataPoint.new
27
27
  item.kind = expected
28
28
  actual = item.kind
29
29
  assert_equal expected, actual
30
- expected = { 'key' => 'value' }
30
+ expected = 3
31
31
  item.kind = expected
32
32
  actual = item.kind
33
33
  assert_equal expected, actual
@@ -96,14 +96,14 @@ class TestDataPoint < Test::Unit::TestCase
96
96
  def test_to_json_works_as_expected
97
97
  item = Contracts::DataPoint.new
98
98
  item.name = 'Test string'
99
- item.kind = { 'key' => 'value' }
99
+ item.kind = 5
100
100
  item.value = 1.5
101
101
  item.count = 42
102
102
  item.min = 1.5
103
103
  item.max = 1.5
104
104
  item.std_dev = 1.5
105
105
  actual = item.to_json
106
- expected = '{"name":"Test string","kind":{"key":"value"},"value":1.5,"count":42,"min":1.5,"max":1.5,"stdDev":1.5}'
106
+ expected = '{"name":"Test string","kind":5,"value":1.5,"count":42,"min":1.5,"max":1.5,"stdDev":1.5}'
107
107
  assert_equal expected, actual
108
108
  end
109
109
  end
@@ -165,15 +165,15 @@ class TestDevice < Test::Unit::TestCase
165
165
  assert_equal expected, actual
166
166
  end
167
167
 
168
- def test_vm_name_works_as_expected
168
+ def test_machine_name_works_as_expected
169
169
  expected = 'Test string'
170
170
  item = Contracts::Device.new
171
- item.vm_name = expected
172
- actual = item.vm_name
171
+ item.machine_name = expected
172
+ actual = item.machine_name
173
173
  assert_equal expected, actual
174
174
  expected = 'Other string'
175
- item.vm_name = expected
176
- actual = item.vm_name
175
+ item.machine_name = expected
176
+ actual = item.machine_name
177
177
  assert_equal expected, actual
178
178
  end
179
179
 
@@ -192,9 +192,9 @@ class TestDevice < Test::Unit::TestCase
192
192
  item.role_name = 'Test string'
193
193
  item.screen_resolution = 'Test string'
194
194
  item.type = 'Test string'
195
- item.vm_name = 'Test string'
195
+ item.machine_name = 'Test string'
196
196
  actual = item.to_json
197
- expected = '{"ai.device.id":"Test string","ai.device.ip":"Test string","ai.device.language":"Test string","ai.device.locale":"Test string","ai.device.model":"Test string","ai.device.network":"Test string","ai.device.oemName":"Test string","ai.device.os":"Test string","ai.device.osVersion":"Test string","ai.device.roleInstance":"Test string","ai.device.roleName":"Test string","ai.device.screenResolution":"Test string","ai.device.type":"Test string","ai.device.vmName":"Test string"}'
197
+ expected = '{"ai.device.id":"Test string","ai.device.ip":"Test string","ai.device.language":"Test string","ai.device.locale":"Test string","ai.device.model":"Test string","ai.device.network":"Test string","ai.device.oemName":"Test string","ai.device.os":"Test string","ai.device.osVersion":"Test string","ai.device.roleInstance":"Test string","ai.device.roleName":"Test string","ai.device.screenResolution":"Test string","ai.device.type":"Test string","ai.device.machineName":"Test string"}'
198
198
  assert_equal expected, actual
199
199
  end
200
200
  end
@@ -40,17 +40,41 @@ class TestExceptionData < Test::Unit::TestCase
40
40
  end
41
41
 
42
42
  def test_severity_level_works_as_expected
43
- expected = { 'key' => 'value' }
43
+ expected = 5
44
44
  item = Contracts::ExceptionData.new
45
45
  item.severity_level = expected
46
46
  actual = item.severity_level
47
47
  assert_equal expected, actual
48
- expected = { 'key' => 'value' }
48
+ expected = 3
49
49
  item.severity_level = expected
50
50
  actual = item.severity_level
51
51
  assert_equal expected, actual
52
52
  end
53
53
 
54
+ def test_problem_id_works_as_expected
55
+ expected = 'Test string'
56
+ item = Contracts::ExceptionData.new
57
+ item.problem_id = expected
58
+ actual = item.problem_id
59
+ assert_equal expected, actual
60
+ expected = 'Other string'
61
+ item.problem_id = expected
62
+ actual = item.problem_id
63
+ assert_equal expected, actual
64
+ end
65
+
66
+ def test_crash_thread_id_works_as_expected
67
+ expected = 42
68
+ item = Contracts::ExceptionData.new
69
+ item.crash_thread_id = expected
70
+ actual = item.crash_thread_id
71
+ assert_equal expected, actual
72
+ expected = 13
73
+ item.crash_thread_id = expected
74
+ actual = item.crash_thread_id
75
+ assert_equal expected, actual
76
+ end
77
+
54
78
  def test_properties_works_as_expected
55
79
  item = Contracts::ExceptionData.new
56
80
  actual = item.properties
@@ -71,7 +95,9 @@ class TestExceptionData < Test::Unit::TestCase
71
95
  item.exceptions.push value
72
96
  end
73
97
 
74
- item.severity_level = { 'key' => 'value' }
98
+ item.severity_level = 5
99
+ item.problem_id = 'Test string'
100
+ item.crash_thread_id = 42
75
101
  { 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
76
102
  item.properties[key] = value
77
103
  end
@@ -79,7 +105,7 @@ class TestExceptionData < Test::Unit::TestCase
79
105
  item.measurements[key] = value
80
106
  end
81
107
  actual = item.to_json
82
- expected = '{"ver":42,"handledAt":"Test string","exceptions":[{"key":"value"}],"severityLevel":{"key":"value"},"properties":{"key1":"test value 1","key2":"test value 2"},"measurements":{"key1":3.1415,"key2":42.2}}'
108
+ expected = '{"ver":42,"handledAt":"Test string","exceptions":[{"key":"value"}],"severityLevel":5,"problemId":"Test string","crashThreadId":42,"properties":{"key1":"test value 1","key2":"test value 2"},"measurements":{"key1":3.1415,"key2":42.2}}'
83
109
  assert_equal expected, actual
84
110
  end
85
111
  end
@@ -34,12 +34,12 @@ class TestMessageData < Test::Unit::TestCase
34
34
  end
35
35
 
36
36
  def test_severity_level_works_as_expected
37
- expected = { 'key' => 'value' }
37
+ expected = 5
38
38
  item = Contracts::MessageData.new
39
39
  item.severity_level = expected
40
40
  actual = item.severity_level
41
41
  assert_equal expected, actual
42
- expected = { 'key' => 'value' }
42
+ expected = 3
43
43
  item.severity_level = expected
44
44
  actual = item.severity_level
45
45
  assert_equal expected, actual
@@ -55,12 +55,12 @@ class TestMessageData < Test::Unit::TestCase
55
55
  item = Contracts::MessageData.new
56
56
  item.ver = 42
57
57
  item.message = 'Test string'
58
- item.severity_level = { 'key' => 'value' }
58
+ item.severity_level = 5
59
59
  { 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
60
60
  item.properties[key] = value
61
61
  end
62
62
  actual = item.to_json
63
- expected = '{"ver":42,"message":"Test string","severityLevel":{"key":"value"},"properties":{"key1":"test value 1","key2":"test value 2"}}'
63
+ expected = '{"ver":42,"message":"Test string","severityLevel":5,"properties":{"key1":"test value 1","key2":"test value 2"}}'
64
64
  assert_equal expected, actual
65
65
  end
66
66
  end
@@ -57,14 +57,40 @@ class TestOperation < Test::Unit::TestCase
57
57
  assert_equal expected, actual
58
58
  end
59
59
 
60
+ def test_synthetic_source_works_as_expected
61
+ expected = 'Test string'
62
+ item = Contracts::Operation.new
63
+ item.synthetic_source = expected
64
+ actual = item.synthetic_source
65
+ assert_equal expected, actual
66
+ expected = 'Other string'
67
+ item.synthetic_source = expected
68
+ actual = item.synthetic_source
69
+ assert_equal expected, actual
70
+ end
71
+
72
+ def test_is_synthetic_works_as_expected
73
+ expected = 'Test string'
74
+ item = Contracts::Operation.new
75
+ item.is_synthetic = expected
76
+ actual = item.is_synthetic
77
+ assert_equal expected, actual
78
+ expected = 'Other string'
79
+ item.is_synthetic = expected
80
+ actual = item.is_synthetic
81
+ assert_equal expected, actual
82
+ end
83
+
60
84
  def test_to_json_works_as_expected
61
85
  item = Contracts::Operation.new
62
86
  item.id = 'Test string'
63
87
  item.name = 'Test string'
64
88
  item.parent_id = 'Test string'
65
89
  item.root_id = 'Test string'
90
+ item.synthetic_source = 'Test string'
91
+ item.is_synthetic = 'Test string'
66
92
  actual = item.to_json
67
- expected = '{"ai.operation.id":"Test string","ai.operation.name":"Test string","ai.operation.parentId":"Test string","ai.operation.rootId":"Test string"}'
93
+ expected = '{"ai.operation.id":"Test string","ai.operation.name":"Test string","ai.operation.parentId":"Test string","ai.operation.rootId":"Test string","ai.operation.syntheticSource":"Test string","ai.operation.isSynthetic":"Test string"}'
68
94
  assert_equal expected, actual
69
95
  end
70
96
  end
@@ -34,12 +34,12 @@ class TestRemoteDependencyData < Test::Unit::TestCase
34
34
  end
35
35
 
36
36
  def test_kind_works_as_expected
37
- expected = { 'key' => 'value' }
37
+ expected = 5
38
38
  item = Contracts::RemoteDependencyData.new
39
39
  item.kind = expected
40
40
  actual = item.kind
41
41
  assert_equal expected, actual
42
- expected = { 'key' => 'value' }
42
+ expected = 3
43
43
  item.kind = expected
44
44
  actual = item.kind
45
45
  assert_equal expected, actual
@@ -106,12 +106,12 @@ class TestRemoteDependencyData < Test::Unit::TestCase
106
106
  end
107
107
 
108
108
  def test_dependency_kind_works_as_expected
109
- expected = { 'key' => 'value' }
109
+ expected = 5
110
110
  item = Contracts::RemoteDependencyData.new
111
111
  item.dependency_kind = expected
112
112
  actual = item.dependency_kind
113
113
  assert_equal expected, actual
114
- expected = { 'key' => 'value' }
114
+ expected = 3
115
115
  item.dependency_kind = expected
116
116
  actual = item.dependency_kind
117
117
  assert_equal expected, actual
@@ -142,17 +142,41 @@ class TestRemoteDependencyData < Test::Unit::TestCase
142
142
  end
143
143
 
144
144
  def test_dependency_source_works_as_expected
145
- expected = { 'key' => 'value' }
145
+ expected = 5
146
146
  item = Contracts::RemoteDependencyData.new
147
147
  item.dependency_source = expected
148
148
  actual = item.dependency_source
149
149
  assert_equal expected, actual
150
- expected = { 'key' => 'value' }
150
+ expected = 3
151
151
  item.dependency_source = expected
152
152
  actual = item.dependency_source
153
153
  assert_equal expected, actual
154
154
  end
155
155
 
156
+ def test_command_name_works_as_expected
157
+ expected = 'Test string'
158
+ item = Contracts::RemoteDependencyData.new
159
+ item.command_name = expected
160
+ actual = item.command_name
161
+ assert_equal expected, actual
162
+ expected = 'Other string'
163
+ item.command_name = expected
164
+ actual = item.command_name
165
+ assert_equal expected, actual
166
+ end
167
+
168
+ def test_dependency_type_name_works_as_expected
169
+ expected = 'Test string'
170
+ item = Contracts::RemoteDependencyData.new
171
+ item.dependency_type_name = expected
172
+ actual = item.dependency_type_name
173
+ assert_equal expected, actual
174
+ expected = 'Other string'
175
+ item.dependency_type_name = expected
176
+ actual = item.dependency_type_name
177
+ assert_equal expected, actual
178
+ end
179
+
156
180
  def test_properties_works_as_expected
157
181
  item = Contracts::RemoteDependencyData.new
158
182
  actual = item.properties
@@ -163,21 +187,23 @@ class TestRemoteDependencyData < Test::Unit::TestCase
163
187
  item = Contracts::RemoteDependencyData.new
164
188
  item.ver = 42
165
189
  item.name = 'Test string'
166
- item.kind = { 'key' => 'value' }
190
+ item.kind = 5
167
191
  item.value = 1.5
168
192
  item.count = 42
169
193
  item.min = 1.5
170
194
  item.max = 1.5
171
195
  item.std_dev = 1.5
172
- item.dependency_kind = { 'key' => 'value' }
196
+ item.dependency_kind = 5
173
197
  item.success = TRUE
174
198
  item.async = TRUE
175
- item.dependency_source = { 'key' => 'value' }
199
+ item.dependency_source = 5
200
+ item.command_name = 'Test string'
201
+ item.dependency_type_name = 'Test string'
176
202
  { 'key1' => 'test value 1' , 'key2' => 'test value 2' }.each do |key, value|
177
203
  item.properties[key] = value
178
204
  end
179
205
  actual = item.to_json
180
- expected = '{"ver":42,"name":"Test string","kind":{"key":"value"},"value":1.5,"count":42,"min":1.5,"max":1.5,"stdDev":1.5,"dependencyKind":{"key":"value"},"success":true,"async":true,"dependencySource":{"key":"value"},"properties":{"key1":"test value 1","key2":"test value 2"}}'
206
+ expected = '{"ver":42,"name":"Test string","kind":5,"value":1.5,"count":42,"min":1.5,"max":1.5,"stdDev":1.5,"dependencyKind":5,"success":true,"async":true,"dependencySource":5,"commandName":"Test string","dependencyTypeName":"Test string","properties":{"key1":"test value 1","key2":"test value 2"}}'
181
207
  assert_equal expected, actual
182
208
  end
183
209
  end
@@ -57,14 +57,27 @@ class TestUser < Test::Unit::TestCase
57
57
  assert_equal expected, actual
58
58
  end
59
59
 
60
+ def test_store_region_works_as_expected
61
+ expected = 'Test string'
62
+ item = Contracts::User.new
63
+ item.store_region = expected
64
+ actual = item.store_region
65
+ assert_equal expected, actual
66
+ expected = 'Other string'
67
+ item.store_region = expected
68
+ actual = item.store_region
69
+ assert_equal expected, actual
70
+ end
71
+
60
72
  def test_to_json_works_as_expected
61
73
  item = Contracts::User.new
62
74
  item.account_acquisition_date = 'Test string'
63
75
  item.account_id = 'Test string'
64
76
  item.user_agent = 'Test string'
65
77
  item.id = 'Test string'
78
+ item.store_region = 'Test string'
66
79
  actual = item.to_json
67
- expected = '{"ai.user.accountAcquisitionDate":"Test string","ai.user.accountId":"Test string","ai.user.userAgent":"Test string","ai.user.id":"Test string"}'
80
+ expected = '{"ai.user.accountAcquisitionDate":"Test string","ai.user.accountId":"Test string","ai.user.userAgent":"Test string","ai.user.id":"Test string","ai.user.storeRegion":"Test string"}'
68
81
  assert_equal expected, actual
69
82
  end
70
83
  end
@@ -32,7 +32,7 @@ class TestTrackRequest < Test::Unit::TestCase
32
32
  assert_equal http_method, request_data.http_method
33
33
  assert_equal url, request_data.url
34
34
  assert_equal true, request_data.duration.start_with?("0:00:00:02")
35
- assert_in_epsilon Time.parse(request_data.start_time) - start_time, 0, 0.01
35
+ assert Time.parse(request_data.start_time) - start_time < 0.01
36
36
  end
37
37
 
38
38
  def test_call_with_failed_request
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: application_insights
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-27 00:00:00.000000000 Z
11
+ date: 2015-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ! '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.0.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: test-unit
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 3.0.8
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 3.0.8
83
97
  description: This project extends the Application Insights API surface to support
84
98
  Ruby.
85
99
  email:
@@ -89,6 +103,7 @@ extensions: []
89
103
  extra_rdoc_files: []
90
104
  files:
91
105
  - .gitignore
106
+ - .travis.yml
92
107
  - Gemfile
93
108
  - LICENSE.txt
94
109
  - README.md