atlas_rb 1.27.2 → 1.27.4
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 +4 -4
- data/.version +1 -1
- data/CHANGELOG.md +21 -0
- data/Gemfile.lock +6 -6
- data/README.md +5 -3
- data/lib/atlas_rb/metrics.rb +8 -5
- data/lib/atlas_rb/work.rb +42 -0
- metadata +3 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 98ed27c0812607ce56681c0dd9b3ab4c17fc1224c7e3c36bf0aa5b4deb7527e9
|
|
4
|
+
data.tar.gz: 401ebcc7d93621d999c2b6441f0e470ee6b68c2081e0eb104e5f059330310004
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 604f5e4183097244b9759cbf0caf188abf45ca936a7f9a07f3a476a4cb05dee0aa23f65357114bbdd9525e85d2c6ae746f0dba330f05cc4f3b978ae077778900
|
|
7
|
+
data.tar.gz: e9d53ba6883acc6decc743d4e480a682918c7f6db19e550e97d5455836a31250a29430ba846df03fab075cd410cff11b6c01ffe257522898c47c9f27d708b723
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.27.
|
|
1
|
+
1.27.4
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.27.4
|
|
4
|
+
|
|
5
|
+
Requires an Atlas that serves `GET /works/:id/health_check` (0.6.232 or later).
|
|
6
|
+
|
|
7
|
+
### Added — `AtlasRb::Work.health_check`
|
|
8
|
+
|
|
9
|
+
Reads a Work's green/yellow/red health grade and the findings behind it, each
|
|
10
|
+
with a severity, a machine-readable code, the NOID it is about and a message.
|
|
11
|
+
Atlas never re-hashes the bytes for this call, so `fixity_checked` is always
|
|
12
|
+
false. Admin and devolved-admin tiers only; anyone else gets a
|
|
13
|
+
`ResourceError` with status 403. `nil` on a 404.
|
|
14
|
+
|
|
15
|
+
## 1.27.3
|
|
16
|
+
|
|
17
|
+
### Changed — `Metrics.latency` documentation
|
|
18
|
+
|
|
19
|
+
Atlas 0.6.227 times each request from the top of its Rack stack, the same span
|
|
20
|
+
as `x-runtime`, rather than the controller action alone. The YARD and README
|
|
21
|
+
now say so. No code changed; against an older Atlas the figures are still
|
|
22
|
+
action-only.
|
|
23
|
+
|
|
3
24
|
## 1.27.2
|
|
4
25
|
|
|
5
26
|
Requires an Atlas that serves `GET /metrics/latency`.
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
atlas_rb (1.27.
|
|
4
|
+
atlas_rb (1.27.4)
|
|
5
5
|
faraday (~> 2.7)
|
|
6
6
|
faraday-follow_redirects (~> 0.3.0)
|
|
7
7
|
faraday-multipart (~> 1)
|
|
@@ -16,24 +16,24 @@ GEM
|
|
|
16
16
|
base64 (0.3.0)
|
|
17
17
|
connection_pool (2.5.5)
|
|
18
18
|
diff-lcs (1.6.1)
|
|
19
|
-
faraday (2.
|
|
20
|
-
faraday-net_http (>= 2.0, < 3.
|
|
19
|
+
faraday (2.15.0)
|
|
20
|
+
faraday-net_http (>= 2.0, < 3.6)
|
|
21
21
|
json
|
|
22
22
|
logger
|
|
23
23
|
faraday-follow_redirects (0.3.0)
|
|
24
24
|
faraday (>= 1, < 3)
|
|
25
25
|
faraday-multipart (1.2.0)
|
|
26
26
|
multipart-post (~> 2.0)
|
|
27
|
-
faraday-net_http (3.
|
|
27
|
+
faraday-net_http (3.5.0)
|
|
28
28
|
net-http (~> 0.5)
|
|
29
29
|
faraday-net_http_persistent (2.3.1)
|
|
30
30
|
faraday (~> 2.5)
|
|
31
31
|
net-http-persistent (>= 4.0.4, < 5)
|
|
32
32
|
faraday-retry (2.4.0)
|
|
33
33
|
faraday (~> 2.0)
|
|
34
|
-
hashie (5.
|
|
34
|
+
hashie (5.2.0)
|
|
35
35
|
logger
|
|
36
|
-
json (3.0
|
|
36
|
+
json (3.1.0)
|
|
37
37
|
jwt (2.10.3)
|
|
38
38
|
base64
|
|
39
39
|
logger (1.7.0)
|
data/README.md
CHANGED
|
@@ -871,9 +871,11 @@ latency["p95_ms"] # => 98
|
|
|
871
871
|
latency["slowest_actions"].first # => { "action" => "works#mods", "calls" => 912, "p95_ms" => 188 }
|
|
872
872
|
```
|
|
873
873
|
|
|
874
|
-
Atlas times each request from when
|
|
875
|
-
the
|
|
876
|
-
|
|
874
|
+
Atlas times each request from when it enters Atlas's Rack stack until the app
|
|
875
|
+
returns the response, the same span as the `x-runtime` header. The figures
|
|
876
|
+
include time a request waited inside Atlas behind concurrent ones. They leave
|
|
877
|
+
out time queued for a Puma thread, the network, and your own waiting. If you
|
|
878
|
+
also time your Atlas calls, the difference is time spent on your side. The percentiles are
|
|
877
879
|
interpolated from histogram buckets, so they are approximate.
|
|
878
880
|
|
|
879
881
|
Like `Health.read`, it has a 5-second deadline and no retry. It raises
|
data/lib/atlas_rb/metrics.rb
CHANGED
|
@@ -15,11 +15,14 @@ module AtlasRb
|
|
|
15
15
|
|
|
16
16
|
# How long Atlas took to serve its own requests (`GET /metrics/latency`).
|
|
17
17
|
#
|
|
18
|
-
# Measured inside Atlas, from when
|
|
19
|
-
# returns
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
18
|
+
# Measured inside Atlas, from when a request enters its Rack stack until
|
|
19
|
+
# the app returns the response — the same span as the `x-runtime` header.
|
|
20
|
+
# So it includes time a request spent waiting inside Atlas behind
|
|
21
|
+
# concurrent ones, and leaves out time queued for a Puma thread, the
|
|
22
|
+
# network, and the caller's own waiting. A caller that also times its
|
|
23
|
+
# Atlas calls can subtract to see how much of its wait was its own. The
|
|
24
|
+
# percentiles are interpolated from histogram buckets, so they are
|
|
25
|
+
# approximate.
|
|
23
26
|
#
|
|
24
27
|
# No retry, and a fresh socket per call: like {AtlasRb::Health.read}, it is
|
|
25
28
|
# polled rarely and should fail fast rather than hide a struggling Atlas.
|
data/lib/atlas_rb/work.rb
CHANGED
|
@@ -512,6 +512,48 @@ module AtlasRb
|
|
|
512
512
|
end
|
|
513
513
|
end
|
|
514
514
|
|
|
515
|
+
# Grade a Work's health green, yellow or red.
|
|
516
|
+
#
|
|
517
|
+
# Wraps `GET /works/<id>/health_check` (Atlas 0.6.232 or later). `grade` is
|
|
518
|
+
# `"green"` (viable), `"yellow"` (broken or degraded, nothing lost, so
|
|
519
|
+
# repairable in place) or `"red"` (bytes missing or corrupt, so it needs a
|
|
520
|
+
# restore or a re-deposit). Each of `findings` carries `severity`
|
|
521
|
+
# (`"advisory"`, `"repairable"` or `"fatal"`), a machine-readable `code`,
|
|
522
|
+
# the `subject` NOID it is about and a `message`. The codes are an open
|
|
523
|
+
# vocabulary: show one you do not recognise rather than failing on it.
|
|
524
|
+
#
|
|
525
|
+
# Atlas never re-hashes the bytes for this call, so `fixity_checked` is
|
|
526
|
+
# always `false`: a green means nothing is missing, not that the bytes
|
|
527
|
+
# were verified. Atlas allows it for the admin and devolved-admin tiers
|
|
528
|
+
# only; edit rights on the Work do not reach it.
|
|
529
|
+
#
|
|
530
|
+
# @param id [String] the Work ID.
|
|
531
|
+
# @param nuid [String, nil] optional acting user's NUID. On the relay-signing
|
|
532
|
+
# path it is signed into the assertion `sub`; on the BYO-JWT (`ATLAS_JWT`)
|
|
533
|
+
# path it is ignored (identity lives in the token).
|
|
534
|
+
# @param on_behalf_of [String, nil] optional NUID for the `On-Behalf-Of`
|
|
535
|
+
# header. Falls through to {AtlasRb.config}.default_on_behalf_of when
|
|
536
|
+
# omitted.
|
|
537
|
+
# @return [AtlasRb::Mash, nil] the report: `noid`, `grade`,
|
|
538
|
+
# `fixity_checked` and `findings`.
|
|
539
|
+
#
|
|
540
|
+
# `nil` when Atlas answers `404` — no such Work, or, with a misconfigured
|
|
541
|
+
# `ATLAS_URL`, the route is not Atlas's at all.
|
|
542
|
+
# @raise [AtlasRb::ResourceError] on any non-2xx other than `404` / `410`
|
|
543
|
+
# (a `403` for a caller below the delegate tier, a `5xx`, a proxy's
|
|
544
|
+
# `503`), carrying Atlas's status and body so the failure is attributable
|
|
545
|
+
# at the boundary.
|
|
546
|
+
# @example Show what needs repair
|
|
547
|
+
# report = AtlasRb::Work.health_check("w-789", nuid: admin_nuid)
|
|
548
|
+
# report.findings.reject { |f| f.severity == "advisory" }.each do |f|
|
|
549
|
+
# puts "#{f.severity} #{f.code}: #{f.message}"
|
|
550
|
+
# end
|
|
551
|
+
def self.health_check(id, nuid: nil, on_behalf_of: nil)
|
|
552
|
+
read_body(connection({}, nuid, on_behalf_of: on_behalf_of).get("#{ROUTE}#{id}/health_check")) do |body|
|
|
553
|
+
AtlasRb::Mash.new(body)
|
|
554
|
+
end
|
|
555
|
+
end
|
|
556
|
+
|
|
515
557
|
# List a Work's page FileSets in order, each with its assets.
|
|
516
558
|
#
|
|
517
559
|
# Wraps `GET /works/<id>/file_sets` — the ordered, grouped sibling of
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: atlas_rb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.27.
|
|
4
|
+
version: 1.27.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Cliff
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: faraday
|
|
@@ -136,7 +135,6 @@ dependencies:
|
|
|
136
135
|
- - "~>"
|
|
137
136
|
- !ruby/object:Gem::Version
|
|
138
137
|
version: '0.9'
|
|
139
|
-
description:
|
|
140
138
|
email:
|
|
141
139
|
- david.g.cliff@gmail.com
|
|
142
140
|
executables: []
|
|
@@ -191,12 +189,10 @@ files:
|
|
|
191
189
|
- lib/atlas_rb/version.rb
|
|
192
190
|
- lib/atlas_rb/work.rb
|
|
193
191
|
- sig/atlas_rb.rbs
|
|
194
|
-
homepage:
|
|
195
192
|
licenses:
|
|
196
193
|
- MIT
|
|
197
194
|
metadata:
|
|
198
195
|
rubygems_mfa_required: 'false'
|
|
199
|
-
post_install_message:
|
|
200
196
|
rdoc_options: []
|
|
201
197
|
require_paths:
|
|
202
198
|
- lib
|
|
@@ -211,8 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
211
207
|
- !ruby/object:Gem::Version
|
|
212
208
|
version: '0'
|
|
213
209
|
requirements: []
|
|
214
|
-
rubygems_version: 3.
|
|
215
|
-
signing_key:
|
|
210
|
+
rubygems_version: 3.6.9
|
|
216
211
|
specification_version: 4
|
|
217
212
|
summary: Ruby gem for Atlas API.
|
|
218
213
|
test_files: []
|