metrist_ipa 0.5.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.
- checksums.yaml +7 -0
- data/README.md +50 -0
- data/Rakefile +13 -0
- data/lib/metrist_ipa/version.rb +3 -0
- data/lib/metrist_ipa.rb +31 -0
- data/lib/tasks/canary_ipa_tasks.rake +4 -0
- metadata +71 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 96874eca5e5e3fed37906fef4221079ec5fd36c72fc778a6cfb4820ffebc944e
|
|
4
|
+
data.tar.gz: 04a905b98798b4603abb4f3cab7edddd3408de6bee8e08ed4c1f426941cba1d5
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: fdd2a23bc8c01cd5ae52611746290d08d07e850beb41c1a66c44aadc03970c6001a4f3fa055693887fddfff2e7fc0912a7249f5c57fb0e26e7b25c24f2b8d7bf
|
|
7
|
+
data.tar.gz: 896e3bf1639bf0316905935430655fa2cf556d8e4270a884d2a76fdb8a46b80ad08e33a5a621cb5de911c3693ec1049b6a0c1bab982acd54aed146372fc8de36
|
data/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Metrist In-Process Agent
|
|
2
|
+
|
|
3
|
+
This Rails Plugin/Gem contains the Metrist 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 Metrist 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
|
+
* `METRIST_AGENT_HOST` can be set to a hostname/IP to send the telemetry data to, the default
|
|
19
|
+
is to send to localhost.
|
|
20
|
+
* `METRIST_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
|
+
## Rails usage
|
|
24
|
+
|
|
25
|
+
When working with Rails, you probably already have most of your configuration in `config/application.rb`. If so,
|
|
26
|
+
you can simply configure the Gem using:
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
MetristIpa.config do | c |
|
|
30
|
+
c.host = "cma.prod.test.com"
|
|
31
|
+
c.port = 12345
|
|
32
|
+
end
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
Add this line to your application's Gemfile:
|
|
37
|
+
|
|
38
|
+
```ruby
|
|
39
|
+
gem 'metrist_ipa'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
And then execute:
|
|
43
|
+
```bash
|
|
44
|
+
$ bundle
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or install it yourself as:
|
|
48
|
+
```bash
|
|
49
|
+
$ gem install metrist_ipa
|
|
50
|
+
```
|
data/Rakefile
ADDED
data/lib/metrist_ipa.rb
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module MetristIpa
|
|
2
|
+
class << self
|
|
3
|
+
attr_writer :host, :port
|
|
4
|
+
|
|
5
|
+
def host
|
|
6
|
+
@host || ENV["METRIST_AGENT_HOST"] || "127.0.0.1"
|
|
7
|
+
end
|
|
8
|
+
def port
|
|
9
|
+
@port || (ENV["METRIST_AGENT_PORT"] || "51712").to_i
|
|
10
|
+
end
|
|
11
|
+
def config
|
|
12
|
+
yield self
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
module NetHttpExtensions
|
|
17
|
+
@@sock = UDPSocket.new
|
|
18
|
+
def request(req, body = nil, &block)
|
|
19
|
+
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
20
|
+
result = super(req, body, &block)
|
|
21
|
+
delta = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
|
|
22
|
+
delta_ms = delta * 1000
|
|
23
|
+
@@sock.send("0\t#{req.method}\t#{@address}\t#{req.path}\t#{delta_ms}\n", 0, MetristIpa.host, MetristIpa.port)
|
|
24
|
+
result
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class Net::HTTP
|
|
30
|
+
prepend MetristIpa::NetHttpExtensions
|
|
31
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: metrist_ipa
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.5.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Metrist, Inc
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2022-11-03 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.0'
|
|
20
|
+
- - "<"
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: '6.2'
|
|
23
|
+
type: :runtime
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - ">="
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '6.0'
|
|
30
|
+
- - "<"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '6.2'
|
|
33
|
+
description: Plugin to measure outgoing API call performance using Metrist
|
|
34
|
+
email:
|
|
35
|
+
- rubygems@metrist.io
|
|
36
|
+
executables: []
|
|
37
|
+
extensions: []
|
|
38
|
+
extra_rdoc_files: []
|
|
39
|
+
files:
|
|
40
|
+
- README.md
|
|
41
|
+
- Rakefile
|
|
42
|
+
- lib/metrist_ipa.rb
|
|
43
|
+
- lib/metrist_ipa/version.rb
|
|
44
|
+
- lib/tasks/canary_ipa_tasks.rake
|
|
45
|
+
homepage: https://metrist.io
|
|
46
|
+
licenses:
|
|
47
|
+
- CC-BY-NC-ND
|
|
48
|
+
metadata:
|
|
49
|
+
homepage_uri: https://metrist.io
|
|
50
|
+
source_code_uri: https://metrist.io
|
|
51
|
+
changelog_uri: https://metrist.io
|
|
52
|
+
post_install_message:
|
|
53
|
+
rdoc_options: []
|
|
54
|
+
require_paths:
|
|
55
|
+
- lib
|
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
|
+
requirements:
|
|
63
|
+
- - ">="
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: '0'
|
|
66
|
+
requirements: []
|
|
67
|
+
rubygems_version: 3.1.4
|
|
68
|
+
signing_key:
|
|
69
|
+
specification_version: 4
|
|
70
|
+
summary: Plugin to measure outgoing API call performance using Metrist
|
|
71
|
+
test_files: []
|