azure_application_insights 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -2
- data/CONTRIBUTING.md +10 -10
- data/Gemfile +1 -1
- data/README.md +37 -37
- data/Rakefile +1 -1
- data/application_insights.gemspec +3 -3
- data/lib/{application_insights → azure_application_insights}/channel/asynchronous_queue.rb +4 -4
- data/lib/{application_insights → azure_application_insights}/channel/asynchronous_sender.rb +2 -2
- data/lib/{application_insights → azure_application_insights}/channel/contracts/application.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/cloud.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/data.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/data_point.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/data_point_type.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/dependency_kind.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/dependency_source_type.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/device.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/envelope.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/event_data.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/exception_data.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/exception_details.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/internal.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/json_serializable.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/location.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/message_data.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/metric_data.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/operation.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/page_view_data.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/remote_dependency_data.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/request_data.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/session.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/severity_level.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/stack_frame.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/contracts/user.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/event.rb +3 -3
- data/lib/{application_insights → azure_application_insights}/channel/queue_base.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/sender_base.rb +2 -2
- data/lib/{application_insights → azure_application_insights}/channel/synchronous_queue.rb +3 -3
- data/lib/{application_insights → azure_application_insights}/channel/synchronous_sender.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/channel/telemetry_channel.rb +7 -7
- data/lib/{application_insights → azure_application_insights}/channel/telemetry_context.rb +3 -3
- data/lib/{application_insights → azure_application_insights}/rack/track_request.rb +2 -2
- data/lib/{application_insights → azure_application_insights}/telemetry_client.rb +1 -1
- data/lib/{application_insights → azure_application_insights}/unhandled_exception.rb +4 -4
- data/lib/azure_application_insights/version.rb +3 -0
- data/lib/azure_application_insights.rb +9 -0
- data/test/application_insights/channel/contracts/test_application.rb +2 -2
- data/test/application_insights/channel/contracts/test_cloud.rb +2 -2
- data/test/application_insights/channel/contracts/test_data.rb +2 -2
- data/test/application_insights/channel/contracts/test_data_point.rb +2 -2
- data/test/application_insights/channel/contracts/test_device.rb +2 -2
- data/test/application_insights/channel/contracts/test_envelope.rb +2 -2
- data/test/application_insights/channel/contracts/test_event_data.rb +2 -2
- data/test/application_insights/channel/contracts/test_exception_data.rb +2 -2
- data/test/application_insights/channel/contracts/test_exception_details.rb +2 -2
- data/test/application_insights/channel/contracts/test_internal.rb +2 -2
- data/test/application_insights/channel/contracts/test_location.rb +2 -2
- data/test/application_insights/channel/contracts/test_message_data.rb +2 -2
- data/test/application_insights/channel/contracts/test_metric_data.rb +2 -2
- data/test/application_insights/channel/contracts/test_operation.rb +2 -2
- data/test/application_insights/channel/contracts/test_page_view_data.rb +2 -2
- data/test/application_insights/channel/contracts/test_remote_dependency_data.rb +2 -2
- data/test/application_insights/channel/contracts/test_request_data.rb +2 -2
- data/test/application_insights/channel/contracts/test_session.rb +2 -2
- data/test/application_insights/channel/contracts/test_stack_frame.rb +2 -2
- data/test/application_insights/channel/contracts/test_user.rb +2 -2
- data/test/application_insights/channel/test_asynchronous_queue.rb +3 -3
- data/test/application_insights/channel/test_asynchronous_sender.rb +4 -4
- data/test/application_insights/channel/test_event.rb +3 -3
- data/test/application_insights/channel/test_queue_base.rb +3 -3
- data/test/application_insights/channel/test_sender_base.rb +3 -3
- data/test/application_insights/channel/test_synchronous_queue.rb +3 -3
- data/test/application_insights/channel/test_synchronous_sender.rb +2 -2
- data/test/application_insights/channel/test_telemetry_channel.rb +8 -8
- data/test/application_insights/channel/test_telemetry_context.rb +2 -2
- data/test/application_insights/mock_sender.rb +3 -3
- data/test/application_insights/rack/test_track_request.rb +8 -8
- data/test/application_insights/test_telemetry_client.rb +14 -14
- data/test/application_insights/test_unhandled_exception.rb +2 -2
- data/test/application_insights.rb +1 -1
- metadata +41 -41
- data/lib/application_insights/version.rb +0 -3
- data/lib/application_insights.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6eba144cbee63217828c46782dbcdec502623717c7aa3d32641a6a621501e22
|
4
|
+
data.tar.gz: 9116f96c46790b82636958dbc86a6a206b682a2dce05ff2375ec63469738e0a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fdf40dbf35b296ce7e2752d1ff7a20fc213f7716983f5ed9f9966a6ed534856418f2e5dc19918fc180c3a8e57838cbf39d09672ad092d1bdf8125a0de19b8e0
|
7
|
+
data.tar.gz: 8def216324b877c8af1a346f80f710645d1485bcfdda2c76297a9d1f4ca7f51a012b709e1d1195b5eb5ba6520a17eb12a770d6a40087dda94e81574b7615e9dd
|
data/CHANGELOG.md
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
This file needs to be updated with every significant pull request. It is used to write down release notes.
|
4
4
|
|
5
5
|
## Version 0.5.6
|
6
|
-
* Expose request id to parent Rack application when using `
|
7
|
-
* Implement operation context functionality for `
|
6
|
+
* Expose request id to parent Rack application when using `AzureApplicationInsights::Rack::TrackRequest` middleware through `env['AzureApplicationInsights.request.id']`.
|
7
|
+
* Implement operation context functionality for `AzureApplicationInsights::Rack::TrackRequest`.
|
8
8
|
* Add functionality to accept a Request-Id header for telemetry correlation.
|
9
9
|
* Add operation context to request tracking middleware.
|
10
10
|
|
data/CONTRIBUTING.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# How to Contribute
|
2
2
|
|
3
|
-
If you're interested in contributing, take a look at the general [contributer's guide](https://github.com/Microsoft/
|
3
|
+
If you're interested in contributing, take a look at the general [contributer's guide](https://github.com/Microsoft/AzureApplicationInsights-Home/blob/master/CONTRIBUTING.md) first.
|
4
4
|
|
5
5
|
## Build Gem
|
6
6
|
|
7
|
-
Run ```gem build
|
7
|
+
Run ```gem build azure_application_insights.gemspec``` to generate the gem file.
|
8
8
|
|
9
|
-
And you can install the gem to test it locally by running ```gem install
|
9
|
+
And you can install the gem to test it locally by running ```gem install azure_application_insights-[version].gem```.
|
10
10
|
|
11
11
|
## Run Test
|
12
12
|
|
@@ -18,7 +18,7 @@ Run ```rake test```.
|
|
18
18
|
|
19
19
|
This is for repository maintainers only:
|
20
20
|
|
21
|
-
1. Create and merge develop->master PR https://github.com/Microsoft/
|
21
|
+
1. Create and merge develop->master PR https://github.com/Microsoft/AzureApplicationInsights-Ruby/compare/master...develop?expand=1
|
22
22
|
2. Checkout latest `master`
|
23
23
|
```
|
24
24
|
git checkout master
|
@@ -26,15 +26,15 @@ This is for repository maintainers only:
|
|
26
26
|
```
|
27
27
|
|
28
28
|
3. Remove old gem: `rm *.gem`
|
29
|
-
4. [Build gem](https://github.com/Microsoft/
|
30
|
-
5. Push gem: `gem push
|
31
|
-
6. Check gem on [rubygems](https://rubygems.org/gems/
|
29
|
+
4. [Build gem](https://github.com/Microsoft/AzureApplicationInsights-Ruby/blob/develop/CONTRIBUTING.md#build-gem)
|
30
|
+
5. Push gem: `gem push azure_application_insights-0.5.5.gem`
|
31
|
+
6. Check gem on [rubygems](https://rubygems.org/gems/azure_application_insights)
|
32
32
|
7. Tag code:
|
33
33
|
```
|
34
34
|
git tag -a v0.5.5
|
35
35
|
git push origin v0.5.5
|
36
36
|
```
|
37
|
-
8. Update description of [release](https://github.com/Microsoft/
|
37
|
+
8. Update description of [release](https://github.com/Microsoft/AzureApplicationInsights-Ruby/releases/edit/v0.5.5) from [CHANGELOG.md](https://github.com/Microsoft/AzureApplicationInsights-Ruby/blob/master/CHANGELOG.md)
|
38
38
|
9. Create a branch off `develop` branch
|
39
39
|
```
|
40
40
|
git checkout develop
|
@@ -42,7 +42,7 @@ This is for repository maintainers only:
|
|
42
42
|
git checkout -b releaseUpdates
|
43
43
|
git push --set-upstream origin releaseUpdates
|
44
44
|
```
|
45
|
-
10. Update version in `/lib/
|
45
|
+
10. Update version in `/lib/azure_application_insights/version.rb`
|
46
46
|
11. Create new entry for the next release in `/CHANGELOG.md`
|
47
47
|
12. Push changes
|
48
48
|
```
|
@@ -50,7 +50,7 @@ This is for repository maintainers only:
|
|
50
50
|
git commit -m "post release updates"
|
51
51
|
git push
|
52
52
|
```
|
53
|
-
13. Submit releaseUpdates->develop PR: https://github.com/Microsoft/
|
53
|
+
13. Submit releaseUpdates->develop PR: https://github.com/Microsoft/AzureApplicationInsights-Ruby/compare/develop...releaseUpdates?expand=1
|
54
54
|
|
55
55
|
## Contributing
|
56
56
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Application Insights SDK for Ruby #
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/
|
4
|
-
[![Build Status](https://travis-ci.org/Microsoft/
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/azure_application_insights.svg)](http://badge.fury.io/rb/azure_application_insights)
|
4
|
+
[![Build Status](https://travis-ci.org/Microsoft/AzureApplicationInsights-Ruby.svg)](https://travis-ci.org/Microsoft/AzureApplicationInsights-Ruby)
|
5
5
|
|
6
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.
|
7
7
|
> -- <cite>[Ruby - Official Site](https://www.ruby-lang.org/en/)</cite>
|
@@ -18,7 +18,7 @@ Ruby 1.9.3 is currently supported by this gem.
|
|
18
18
|
To install the latest release you can use *gem*.
|
19
19
|
|
20
20
|
```
|
21
|
-
$ gem install
|
21
|
+
$ gem install azure_application_insights
|
22
22
|
```
|
23
23
|
|
24
24
|
## Usage ##
|
@@ -30,42 +30,42 @@ Once installed, you can send telemetry to Application Insights. Here are a few s
|
|
30
30
|
|
31
31
|
### Sending a simple event telemetry item ###
|
32
32
|
```ruby
|
33
|
-
require '
|
34
|
-
tc =
|
33
|
+
require 'azure_application_insights'
|
34
|
+
tc = AzureApplicationInsights::TelemetryClient.new '<YOUR INSTRUMENTATION KEY GOES HERE>'
|
35
35
|
tc.track_event 'My event'
|
36
36
|
tc.flush
|
37
37
|
```
|
38
38
|
|
39
39
|
### Sending an event telemetry item with custom properties and measurements ###
|
40
40
|
```ruby
|
41
|
-
require '
|
42
|
-
tc =
|
41
|
+
require 'azure_application_insights'
|
42
|
+
tc = AzureApplicationInsights::TelemetryClient.new '<YOUR INSTRUMENTATION KEY GOES HERE>'
|
43
43
|
tc.track_event 'My event', :properties => { 'custom property' => 'some value' }, :measurements => { 'custom metric' => 13 }
|
44
44
|
tc.flush
|
45
45
|
```
|
46
46
|
|
47
47
|
### Sending a trace telemetry item with custom properties ###
|
48
48
|
```ruby
|
49
|
-
require '
|
50
|
-
tc =
|
51
|
-
tc.track_trace 'My trace statement',
|
49
|
+
require 'azure_application_insights'
|
50
|
+
tc = AzureApplicationInsights::TelemetryClient.new '<YOUR INSTRUMENTATION KEY GOES HERE>'
|
51
|
+
tc.track_trace 'My trace statement', AzureApplicationInsights::Channel::Contracts::SeverityLevel::INFORMATION, :properties => { 'custom property' => 'some value' }
|
52
52
|
tc.flush
|
53
53
|
```
|
54
54
|
|
55
55
|
### Sending a metric telemetry item (without and with optional values) ###
|
56
56
|
```ruby
|
57
|
-
require '
|
58
|
-
tc =
|
57
|
+
require 'azure_application_insights'
|
58
|
+
tc = AzureApplicationInsights::TelemetryClient.new '<YOUR INSTRUMENTATION KEY GOES HERE>'
|
59
59
|
tc.track_metric 'My metric', 42
|
60
60
|
# with all optional values set
|
61
|
-
tc.track_metric 'My metric', 42, :kind =>
|
61
|
+
tc.track_metric 'My metric', 42, :kind => AzureApplicationInsights::Channel::Contracts::DataPointType::AGGREGATION, :count => 3, :min => 1, :max => 100, :std_dev => 10, :properties => { 'custom property' => 'some value' }
|
62
62
|
tc.flush
|
63
63
|
```
|
64
64
|
|
65
65
|
### Sending an exception telemetry item with custom properties and measurements ###
|
66
66
|
```ruby
|
67
|
-
require '
|
68
|
-
tc =
|
67
|
+
require 'azure_application_insights'
|
68
|
+
tc = AzureApplicationInsights::TelemetryClient.new '<YOUR INSTRUMENTATION KEY GOES HERE>'
|
69
69
|
begin
|
70
70
|
raise ArgumentError, 'Something has gone wrong!'
|
71
71
|
rescue => e
|
@@ -76,8 +76,8 @@ tc.flush
|
|
76
76
|
|
77
77
|
### Configuring context for a telemetry client instance ###
|
78
78
|
```ruby
|
79
|
-
require '
|
80
|
-
tc =
|
79
|
+
require 'azure_application_insights'
|
80
|
+
tc = AzureApplicationInsights::TelemetryClient.new '<YOUR INSTRUMENTATION KEY GOES HERE>'
|
81
81
|
tc.context.application.ver = '1.2.3'
|
82
82
|
tc.context.device.id = 'My current device'
|
83
83
|
tc.context.device.oem_name = 'Asus'
|
@@ -90,8 +90,8 @@ tc.flush
|
|
90
90
|
|
91
91
|
### Configuring synchronous (default) channel properties ###
|
92
92
|
```ruby
|
93
|
-
require '
|
94
|
-
tc =
|
93
|
+
require 'azure_application_insights'
|
94
|
+
tc = AzureApplicationInsights::TelemetryClient.new
|
95
95
|
# flush telemetry if we have 10 or more telemetry items in our queue
|
96
96
|
tc.channel.queue.max_queue_length = 10
|
97
97
|
# send telemetry to the service in batches of 5
|
@@ -100,11 +100,11 @@ tc.channel.sender.send_buffer_size = 5
|
|
100
100
|
|
101
101
|
### Configuring an asynchronous channel instead of the synchronous default ###
|
102
102
|
```ruby
|
103
|
-
require '
|
104
|
-
sender =
|
105
|
-
queue =
|
106
|
-
channel =
|
107
|
-
tc =
|
103
|
+
require 'azure_application_insights'
|
104
|
+
sender = AzureApplicationInsights::Channel::AsynchronousSender.new
|
105
|
+
queue = AzureApplicationInsights::Channel::AsynchronousQueue.new sender
|
106
|
+
channel = AzureApplicationInsights::Channel::TelemetryChannel.new nil, queue
|
107
|
+
tc = AzureApplicationInsights::TelemetryClient.new '<YOUR INSTRUMENTATION KEY GOES HERE>', channel
|
108
108
|
# Note: the event will be sent on a separate thread; if the app finishes before
|
109
109
|
# the thread finishes, the data is lost
|
110
110
|
tc.track_event 'My event'
|
@@ -112,11 +112,11 @@ tc.track_event 'My event'
|
|
112
112
|
|
113
113
|
### Configuring asynchronous channel properties ###
|
114
114
|
```ruby
|
115
|
-
require '
|
116
|
-
sender =
|
117
|
-
queue =
|
118
|
-
channel =
|
119
|
-
tc =
|
115
|
+
require 'azure_application_insights'
|
116
|
+
sender = AzureApplicationInsights::Channel::AsynchronousSender.new
|
117
|
+
queue = AzureApplicationInsights::Channel::AsynchronousQueue.new sender
|
118
|
+
channel = AzureApplicationInsights::Channel::TelemetryChannel.new nil, queue
|
119
|
+
tc = AzureApplicationInsights::TelemetryClient.new '<YOUR INSTRUMENTATION KEY GOES HERE>', channel
|
120
120
|
# flush telemetry if we have 10 or more telemetry items in our queue
|
121
121
|
tc.channel.queue.max_queue_length = 10
|
122
122
|
# send telemetry to the service in batches of 5
|
@@ -130,9 +130,9 @@ tc.channel.sender.send_interval = 0.5
|
|
130
130
|
|
131
131
|
### Collecting unhandled exceptions ###
|
132
132
|
```ruby
|
133
|
-
require '
|
133
|
+
require 'azure_application_insights'
|
134
134
|
# setup unhandled exception handler
|
135
|
-
|
135
|
+
AzureApplicationInsights::UnhandledException.collect('<YOUR INSTRUMENTATION KEY GOES HERE>')
|
136
136
|
# raise an exception and this would be send to Application Insights Service
|
137
137
|
raise Exception, 'Boom!'
|
138
138
|
```
|
@@ -140,22 +140,22 @@ raise Exception, 'Boom!'
|
|
140
140
|
### Collecting requests for rack applications ###
|
141
141
|
```ruby
|
142
142
|
# set up the TrackRequest middleware in the rackup (config.ru) file
|
143
|
-
require '
|
144
|
-
use
|
143
|
+
require 'azure_application_insights'
|
144
|
+
use AzureApplicationInsights::Rack::TrackRequest, '<YOUR INSTRUMENTATION KEY GOES HERE>', <buffer size>
|
145
145
|
# For rails, suggest to set up this middleware in application.rb so that unhandled exceptions from controllers are also collected
|
146
|
-
config.middleware.use '
|
146
|
+
config.middleware.use 'AzureApplicationInsights::Rack::TrackRequest', '<YOUR INSTRUMENTATION KEY GOES HERE>', <buffer size>
|
147
147
|
```
|
148
148
|
|
149
|
-
#### Rerieving the Request-Id value from
|
149
|
+
#### Rerieving the Request-Id value from AzureApplicationInsights ####
|
150
150
|
```ruby
|
151
151
|
# from time to time you may need to access a request's id from within your app
|
152
|
-
|
152
|
+
azure_application_insights_request_id = env['AzureApplicationInsights.request.id']
|
153
153
|
|
154
154
|
# this can be used for a number of different purposes, including telemetry correlation
|
155
155
|
uri = URI('http://api.example.com/search/?q=test')
|
156
156
|
|
157
157
|
req = Net::HTTP::Get.new(uri)
|
158
|
-
req['Request-Id'] = "#{
|
158
|
+
req['Request-Id'] = "#{azure_application_insights_request_id}1" if azure_application_insights_request_id
|
159
159
|
|
160
160
|
Net::HTTP.start(uri.hostname, uri.port) { |http| http.request(req) }
|
161
161
|
```
|
data/Rakefile
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require '
|
4
|
+
require 'azure_application_insights/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'azure_application_insights'
|
8
|
-
spec.version =
|
8
|
+
spec.version = AzureApplicationInsights::VERSION
|
9
9
|
spec.authors = ['Daniel Blasina']
|
10
10
|
spec.email = ['blzk100@gmail.com']
|
11
11
|
spec.summary = %q{Forked Application Insights SDK for Ruby}
|
12
12
|
spec.description = %q{This project extends the Application Insights API surface to support Ruby.}
|
13
|
-
spec.homepage = 'https://github.com/blasko03/
|
13
|
+
spec.homepage = 'https://github.com/blasko03/AzureApplicationInsights-Ruby/'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative 'event'
|
2
2
|
require_relative 'queue_base'
|
3
3
|
|
4
|
-
module
|
4
|
+
module AzureApplicationInsights
|
5
5
|
module Channel
|
6
6
|
# An asynchronous queue for use in conjunction with the {AsynchronousSender}.
|
7
7
|
# The queue will notify the sender that it needs to pick up items when it
|
@@ -9,9 +9,9 @@ module ApplicationInsights
|
|
9
9
|
# {#flush_notification} event.
|
10
10
|
#
|
11
11
|
# @example
|
12
|
-
# require '
|
12
|
+
# require 'azure_application_insights'
|
13
13
|
# require 'thread'
|
14
|
-
# queue =
|
14
|
+
# queue = AzureApplicationInsights::Channel::AsynchronousQueue.new nil
|
15
15
|
# Thread.new do
|
16
16
|
# sleep 1
|
17
17
|
# queue.push 1
|
@@ -32,7 +32,7 @@ module ApplicationInsights
|
|
32
32
|
super sender
|
33
33
|
end
|
34
34
|
|
35
|
-
# The flush notification {
|
35
|
+
# The flush notification {AzureApplicationInsights::Channel::Event} that the {#sender}
|
36
36
|
# will use to get notified that a flush is needed.
|
37
37
|
# @return [Event] object that the {#sender} can wait on.
|
38
38
|
attr_reader :flush_notification
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative 'sender_base'
|
2
2
|
require 'thread'
|
3
3
|
|
4
|
-
module
|
4
|
+
module AzureApplicationInsights
|
5
5
|
module Channel
|
6
6
|
# An asynchronous sender that works in conjunction with the {AsynchronousQueue}.
|
7
7
|
# The sender object will start a worker thread that will pull items from the
|
@@ -125,7 +125,7 @@ module ApplicationInsights
|
|
125
125
|
rescue Exception => e
|
126
126
|
# Make sure work_thread sets to nil when it terminates abnormally
|
127
127
|
@work_thread = nil
|
128
|
-
@logger.error('
|
128
|
+
@logger.error('azure_application_insights') { "Asynchronous sender work thread terminated abnormally: #{e.to_s}" }
|
129
129
|
end
|
130
130
|
end
|
131
131
|
end
|
@@ -3,7 +3,7 @@ require_relative 'data_point_type'
|
|
3
3
|
require_relative 'dependency_kind'
|
4
4
|
require_relative 'dependency_source_type'
|
5
5
|
|
6
|
-
module
|
6
|
+
module AzureApplicationInsights::Channel::Contracts
|
7
7
|
class RemoteDependencyData
|
8
8
|
include JsonSerializable
|
9
9
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative 'queue_base'
|
2
2
|
require 'thread'
|
3
3
|
|
4
|
-
module
|
4
|
+
module AzureApplicationInsights
|
5
5
|
module Channel
|
6
6
|
# An event class that allows simple cross-thread signalling.
|
7
7
|
#
|
@@ -10,9 +10,9 @@ module ApplicationInsights
|
|
10
10
|
# {#wait} method will block until the flag is set to true.
|
11
11
|
#
|
12
12
|
# @example
|
13
|
-
# require '
|
13
|
+
# require 'azure_application_insights'
|
14
14
|
# require 'thread'
|
15
|
-
# event =
|
15
|
+
# event = AzureApplicationInsights::Channel::Event.new
|
16
16
|
# Thread.new do
|
17
17
|
# sleep 1
|
18
18
|
# event.set
|
@@ -5,7 +5,7 @@ require 'stringio'
|
|
5
5
|
require 'zlib'
|
6
6
|
require 'logger'
|
7
7
|
|
8
|
-
module
|
8
|
+
module AzureApplicationInsights
|
9
9
|
module Channel
|
10
10
|
# The base class for all types of senders for use in conjunction with an
|
11
11
|
# implementation of {QueueBase}. The queue will notify the sender that it
|
@@ -70,7 +70,7 @@ module ApplicationInsights
|
|
70
70
|
http.finish if http.started?
|
71
71
|
|
72
72
|
if !response.kind_of? Net::HTTPSuccess
|
73
|
-
@logger.warn('
|
73
|
+
@logger.warn('azure_application_insights') { "Failed to send data: #{response.message}" }
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
require_relative 'queue_base'
|
2
2
|
|
3
|
-
module
|
3
|
+
module AzureApplicationInsights
|
4
4
|
module Channel
|
5
5
|
# A synchronous queue for use in conjunction with the {SynchronousSender}.
|
6
6
|
# The queue will call {SenderBase#send} when it reaches {#max_queue_length},
|
7
7
|
# or when the consumer calls {#flush}.
|
8
8
|
#
|
9
9
|
# @example
|
10
|
-
# require '
|
10
|
+
# require 'azure_application_insights'
|
11
11
|
# require 'thread'
|
12
|
-
# queue =
|
12
|
+
# queue = AzureApplicationInsights::Channel::SynchronousQueue.new nil
|
13
13
|
# queue.max_queue_length = 1
|
14
14
|
# queue.push 1
|
15
15
|
class SynchronousQueue < QueueBase
|