canary_ipa 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +38 -0
- data/Rakefile +13 -0
- data/lib/canary_ipa.rb +24 -0
- data/lib/canary_ipa/railtie.rb +4 -0
- data/lib/canary_ipa/version.rb +3 -0
- data/lib/tasks/canary_ipa_tasks.rake +4 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a8c0b039fc3f9703bc1fcfb811b639faf990d6f853f09456790c74e33512b4fd
|
4
|
+
data.tar.gz: 855f9d7efdcb7f13a80a081848274067628a837602602bc8f8b44205c67f8e90
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '062291508bede280a514ea8b685f786f0bcaedc7d80f5196974c3245963a9d56927fc54cd988089fda3c92f7976a3bd4a7aecb74dacd8dee37cce1547f528af7'
|
7
|
+
data.tar.gz: 75ffd7186d7c31a9ecf6ba964584fee83cceded341ba9e957b82e506f965cbda2b7e8408b7d2ee3643353bb98b0750a3856865e5646cc146dad0764cc60e8d11
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Canary In-Process Agent
|
2
|
+
|
3
|
+
This Rails Plugin/Gem contains the Canary Monitoring In-Process Agent.
|
4
|
+
|
5
|
+
The goal of this agent is simple: all outgoing HTTP traffic gets intercepted and is sent off
|
6
|
+
to the local Canary Monitoring Agent, which sifts through the data and decides what to do with it.
|
7
|
+
|
8
|
+
It is kept very simple on purpose: it will time the call, and then send some elementary
|
9
|
+
data to the host's agent per UDP. The overhead of this is in the order of microseconds,
|
10
|
+
and an UDP `send()` will not block; this way, we can be sure that your application will
|
11
|
+
not be impacted. All the heavy lifting is done in the Monitoring Agent, where it is fine
|
12
|
+
if stuff gets delayed, dropped, or whatever.
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
Just installing the Gem is enough. There is some optional configuration through the environment:
|
17
|
+
|
18
|
+
* `CANARY_MONITORING_AGENT_HOST` can be set to a hostname/IP to send the telemetry data to, the default
|
19
|
+
is to send to localhost.
|
20
|
+
* `CANARY_MONITORING_AGENT_PORT` can be set to a port to send the telemetry data to, the default is to
|
21
|
+
sent to port 51712.
|
22
|
+
|
23
|
+
## Installation
|
24
|
+
Add this line to your application's Gemfile:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
gem 'canary_ipa'
|
28
|
+
```
|
29
|
+
|
30
|
+
And then execute:
|
31
|
+
```bash
|
32
|
+
$ bundle
|
33
|
+
```
|
34
|
+
|
35
|
+
Or install it yourself as:
|
36
|
+
```bash
|
37
|
+
$ gem install canary_ipa
|
38
|
+
```
|
data/Rakefile
ADDED
data/lib/canary_ipa.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require "canary_ipa/version"
|
2
|
+
require "canary_ipa/railtie"
|
3
|
+
|
4
|
+
module CanaryIpa
|
5
|
+
module NetHttpExtensions
|
6
|
+
@@sock = UDPSocket.new
|
7
|
+
@@host = ENV["CANARY_MONITORING_AGENT_HOST"] || "127.0.0.1"
|
8
|
+
@@port = (ENV["CANARY_MONITORING_AGENT_PORT"] || "51712").to_i
|
9
|
+
def request(req, body = nil, &block)
|
10
|
+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
11
|
+
result = super(req, body, &block)
|
12
|
+
delta = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
|
13
|
+
delta_ms = delta * 1000
|
14
|
+
@@sock.send("0\t#{req.method}\t#{@address}\t#{req.path}\t#{delta_ms}\n", 0, @@host, @@port)
|
15
|
+
#overhead = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start - delta
|
16
|
+
#puts "Measuring and UDP overhead: around #{overhead}s"
|
17
|
+
result
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Net::HTTP
|
23
|
+
prepend CanaryIpa::NetHttpExtensions
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: canary_ipa
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Canary Monitoring, Inc
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 6.1.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 6.1.1
|
27
|
+
description: Plugin to measure outgoing API call performance using Canary Monitoring
|
28
|
+
email:
|
29
|
+
- rubygems@canarymonitor.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- README.md
|
35
|
+
- Rakefile
|
36
|
+
- lib/canary_ipa.rb
|
37
|
+
- lib/canary_ipa/railtie.rb
|
38
|
+
- lib/canary_ipa/version.rb
|
39
|
+
- lib/tasks/canary_ipa_tasks.rake
|
40
|
+
homepage: https://canarymonitor.com
|
41
|
+
licenses:
|
42
|
+
- CC-BY-NC-ND
|
43
|
+
metadata:
|
44
|
+
homepage_uri: https://canarymonitor.com
|
45
|
+
source_code_uri: https://canarymonitor.com
|
46
|
+
changelog_uri: https://canarymonitor.com
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubygems_version: 3.1.4
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: Plugin to measure outgoing API call performance using Canary Monitoring
|
66
|
+
test_files: []
|