pinqloq 1.1.2 → 1.2.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 +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +15 -12
- data/lib/pinqloq/client.rb +8 -0
- data/lib/pinqloq/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b13614cfc46b42b8434593f4fa92cb7f0a105097dd70732d04c3e14569396550
|
|
4
|
+
data.tar.gz: c56ed2b52ae2a4f0e24d7b9ee6b858d232cdb513d22b16941fe7abf50564d97d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3d1ac680ab8af895cac427d09b88218f530e698923078f44265857bc9af053fbf5555759626cf4109d0a91872785033c1fa8a7230ec1b483fd2b533be8bddbe2
|
|
7
|
+
data.tar.gz: 2518b0bc7825265daada5f06984d4451ed17ed84d4d6db298457dc0a7153e23cdd19a79731410c801ad2b452e9eb0721623eb6fb57bd8191e8eb490669760723
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to the `pinqloq` gem are documented here. This gem follows
|
|
|
5
5
|
`pinqloq` NuGet package and the `pinqloq` npm package — all three ship on separate cadences for
|
|
6
6
|
the same platform, and mirror each other's feature set rather than their version numbers.
|
|
7
7
|
|
|
8
|
+
## 1.2.0 — 2026-09-12
|
|
9
|
+
|
|
10
|
+
**Added:**
|
|
11
|
+
|
|
12
|
+
- `Client#enqueue` / `Client#enqueue_many` — shortcuts for `Client#logger.enqueue` /
|
|
13
|
+
`Client#logger.enqueue_many`, so manual logging no longer needs the extra `.logger` hop.
|
|
14
|
+
`Client#logger` is unchanged and still useful when a method should only receive the logging
|
|
15
|
+
capability, not the whole client. Matches the Go SDK's `Client#Enqueue`/`Client#EnqueueMany`
|
|
16
|
+
shortcuts.
|
|
17
|
+
|
|
8
18
|
## 1.1.2 — 2026-09-08
|
|
9
19
|
|
|
10
20
|
**Fixed:**
|
data/README.md
CHANGED
|
@@ -47,7 +47,7 @@ credentials.
|
|
|
47
47
|
```ruby
|
|
48
48
|
require "pinqloq"
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
pinqloq_client = Pinqloq.create(
|
|
51
51
|
secret_key: ENV.fetch("PINQLOQ_SECRET_KEY"),
|
|
52
52
|
api_logs_collection_name: "myapp_api_logs",
|
|
53
53
|
device_identifier: "myapp-instance-1"
|
|
@@ -55,11 +55,11 @@ pinqloq = Pinqloq.create(
|
|
|
55
55
|
|
|
56
56
|
# Rack app / Rails config/application.rb / config.ru
|
|
57
57
|
use Pinqloq::Rack::RequestLogging,
|
|
58
|
-
logger:
|
|
59
|
-
pinqloq_options:
|
|
58
|
+
logger: pinqloq_client.logger,
|
|
59
|
+
pinqloq_options: pinqloq_client.options,
|
|
60
60
|
exclude_paths: ["/health"]
|
|
61
61
|
|
|
62
|
-
at_exit {
|
|
62
|
+
at_exit { pinqloq_client.shutdown }
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
The middleware captures the HTTP method, path, and status code as searchable metadata. The
|
|
@@ -68,10 +68,10 @@ request body, response body, request headers, and response headers go to the log
|
|
|
68
68
|
|
|
69
69
|
## Manual Logging
|
|
70
70
|
|
|
71
|
-
Use `
|
|
71
|
+
Use `pinqloq_client.enqueue` to send structured application events:
|
|
72
72
|
|
|
73
73
|
```ruby
|
|
74
|
-
|
|
74
|
+
pinqloq_client.enqueue(
|
|
75
75
|
Pinqloq::LogEntry.new(
|
|
76
76
|
event: "order.created",
|
|
77
77
|
device_identifier: order.customer_id,
|
|
@@ -87,6 +87,9 @@ an entry to inherit the global `device_identifier` option. `enqueue` raises if a
|
|
|
87
87
|
`device_identifier` and no global fallback is set — a missing required field fails loudly rather
|
|
88
88
|
than being silently dropped.
|
|
89
89
|
|
|
90
|
+
`pinqloq_client.logger` still returns the same `Logger` — useful when you want to pass just the
|
|
91
|
+
logging capability into a function without handing it the whole client.
|
|
92
|
+
|
|
90
93
|
## Add Request Metadata
|
|
91
94
|
|
|
92
95
|
By default the middleware reads the required `device_identifier` from the `device-identifier`
|
|
@@ -97,8 +100,8 @@ middleware rejects the request with **HTTP 400** before it runs.
|
|
|
97
100
|
|
|
98
101
|
```ruby
|
|
99
102
|
use Pinqloq::Rack::RequestLogging,
|
|
100
|
-
logger:
|
|
101
|
-
pinqloq_options:
|
|
103
|
+
logger: pinqloq_client.logger,
|
|
104
|
+
pinqloq_options: pinqloq_client.options,
|
|
102
105
|
exclude_paths: ["/health"],
|
|
103
106
|
resolve_device_identifier: ->(request) { request.session[:user_id] },
|
|
104
107
|
resolve_app_version_name: ->(request) { request.get_header("HTTP_X_APP_VERSION") },
|
|
@@ -118,7 +121,7 @@ The request-logging middleware fills it with no configuration: the caller's `cor
|
|
|
118
121
|
request header when present, otherwise a generated UUID.
|
|
119
122
|
|
|
120
123
|
```ruby
|
|
121
|
-
|
|
124
|
+
pinqloq_client.enqueue(
|
|
122
125
|
Pinqloq::LogEntry.new(
|
|
123
126
|
event: "order.created",
|
|
124
127
|
device_identifier: order.customer_id,
|
|
@@ -142,8 +145,8 @@ redacts by **name**, exactly like the Node.js SDK:
|
|
|
142
145
|
|
|
143
146
|
```ruby
|
|
144
147
|
use Pinqloq::Rack::RequestLogging,
|
|
145
|
-
logger:
|
|
146
|
-
pinqloq_options:
|
|
148
|
+
logger: pinqloq_client.logger,
|
|
149
|
+
pinqloq_options: pinqloq_client.options,
|
|
147
150
|
redact_fields: ["ssn_last_four"],
|
|
148
151
|
redact_paths: ["/payment"]
|
|
149
152
|
```
|
|
@@ -156,7 +159,7 @@ list.
|
|
|
156
159
|
## Security and Reliability
|
|
157
160
|
|
|
158
161
|
Logs are buffered in memory and sent in batches by a single background thread. Buffered logs may
|
|
159
|
-
be lost if the process is terminated without a graceful shutdown — call `
|
|
162
|
+
be lost if the process is terminated without a graceful shutdown — call `pinqloq_client.shutdown` on
|
|
160
163
|
exit (`at_exit`, a `Rails.application.config.after_initialize` shutdown hook, or your process
|
|
161
164
|
manager's stop signal handler).
|
|
162
165
|
|
data/lib/pinqloq/client.rb
CHANGED
|
@@ -21,6 +21,14 @@ module Pinqloq
|
|
|
21
21
|
@dispatcher.start
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
def enqueue(entry, on_sent: nil, on_failed: nil)
|
|
25
|
+
@logger.enqueue(entry, on_sent: on_sent, on_failed: on_failed)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def enqueue_many(entries, on_sent: nil, on_failed: nil)
|
|
29
|
+
@logger.enqueue_many(entries, on_sent: on_sent, on_failed: on_failed)
|
|
30
|
+
end
|
|
31
|
+
|
|
24
32
|
def shutdown
|
|
25
33
|
@dispatcher.shutdown
|
|
26
34
|
end
|
data/lib/pinqloq/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pinqloq
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- pinqponq
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|