logister-ruby 0.2.2 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ffb0ff308c1a54f984e8c68088561c76a044e90766bee92a4ef23a51e0c5a78
4
- data.tar.gz: fd0a658239131bec7061a722ed45044c0a2c7aba2125242b766837d0fd8d5dc8
3
+ metadata.gz: fd9ec67090820ac7b825afcbfd87a6a75f26033b0153daf8ee60b44a6d6fbbf3
4
+ data.tar.gz: 2175055728eb9dcc9bc9ed0acf4b3640f52900bcd35933fdd92db6ebbc1dfc3a
5
5
  SHA512:
6
- metadata.gz: c89ea19d2cd68d4e7de0d85ff4b8c727fa0378d9a9e3b86e9a631fbb3e1a0df05d8cf7c9620636c9d7581011e53800cd57c9dffd7dabb9f83e52494c04d32c49
7
- data.tar.gz: 42e48cd2049ab3adf2c496209dd71734891db9134f621920c988c138fb31bd3af99d1a72f39cc2b85f624f8f61ae586b873a036302fe0d29ca767d725cac4e9c
6
+ metadata.gz: cc1412c538be57e39a12e3f7c6939d1e710aa387490575ddf9af7df8ccda96cae3faafd9256348e18208ce63ebc0922f1696ae6b6d22aaeaf279c2b555960eee
7
+ data.tar.gz: 92276f407d774dc3010447cba8b5f0aea0c878ad8d30ba428b46585da3afbdf1dd9f0eb11b6cc62e89afa72e6433292eab19898551c5749a378d11a66aa9e646
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Logister
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  `logister-ruby` sends application errors and custom metrics to `logister.org`.
4
4
 
5
+ ## Self-hosted backend
6
+
7
+ Use the open source Logister app repository to self-host the ingestion UI/API backend:
8
+
9
+ - App source: https://github.com/taimoorq/logister
10
+
5
11
  ## Install
6
12
 
7
13
  ```ruby
@@ -128,6 +134,25 @@ Logister.report_metric(
128
134
  context: { duration_ms: 123 },
129
135
  tags: { region: "us-east-1" }
130
136
  )
137
+
138
+ Logister.report_transaction(
139
+ name: "POST /checkout",
140
+ duration_ms: 184.7,
141
+ status: 200,
142
+ context: { trace_id: "trace-123", request_id: "req-123" }
143
+ )
144
+
145
+ Logister.report_log(
146
+ message: "payment provider timeout",
147
+ level: "warn",
148
+ context: { trace_id: "trace-123", request_id: "req-123", user_id: 42 }
149
+ )
150
+
151
+ Logister.report_check_in(
152
+ slug: "nightly-reconcile",
153
+ status: "ok",
154
+ expected_interval_seconds: 900
155
+ )
131
156
  ```
132
157
 
133
158
  ## Release
@@ -84,6 +84,69 @@ module Logister
84
84
  @client.publish(payload)
85
85
  end
86
86
 
87
+ def report_transaction(name:, duration_ms:, level: 'info', context: {}, tags: {}, fingerprint: nil, status: nil)
88
+ return false if ignored_environment?
89
+ return false if ignored_path?(context)
90
+
91
+ payload = build_payload(
92
+ event_type: 'transaction',
93
+ level: level,
94
+ message: name,
95
+ fingerprint: fingerprint || metric_fingerprint("tx:#{name}"),
96
+ context: context.merge(
97
+ transaction_name: name,
98
+ duration_ms: duration_ms,
99
+ status: status,
100
+ tags: tags
101
+ ).compact
102
+ )
103
+
104
+ payload = apply_before_notify(payload)
105
+ return false unless payload
106
+
107
+ @client.publish(payload)
108
+ end
109
+
110
+ def report_log(message:, level: 'info', context: {}, tags: {}, fingerprint: nil)
111
+ return false if ignored_environment?
112
+ return false if ignored_path?(context)
113
+
114
+ payload = build_payload(
115
+ event_type: 'log',
116
+ level: level,
117
+ message: message,
118
+ fingerprint: fingerprint || metric_fingerprint("log:#{message.to_s.lines.first}"),
119
+ context: context.merge(tags: tags)
120
+ )
121
+
122
+ payload = apply_before_notify(payload)
123
+ return false unless payload
124
+
125
+ @client.publish(payload)
126
+ end
127
+
128
+ def report_check_in(slug:, status: 'ok', expected_interval_seconds: 300, duration_ms: nil, context: {}, level: nil)
129
+ return false if ignored_environment?
130
+
131
+ payload = build_payload(
132
+ event_type: 'check_in',
133
+ level: level || (status.to_s == 'error' ? 'error' : 'info'),
134
+ message: slug,
135
+ fingerprint: metric_fingerprint("checkin:#{slug}"),
136
+ context: context.merge(
137
+ check_in_slug: slug,
138
+ check_in_status: status,
139
+ expected_interval_seconds: expected_interval_seconds,
140
+ duration_ms: duration_ms
141
+ ).compact
142
+ )
143
+
144
+ payload = apply_before_notify(payload)
145
+ return false unless payload
146
+
147
+ @client.publish(payload)
148
+ end
149
+
87
150
  # Store user info for the current thread so it is automatically attached to
88
151
  # every error reported during this request.
89
152
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Logister
4
- VERSION = '0.2.2'
4
+ VERSION = '0.2.3'
5
5
  end
data/lib/logister.rb CHANGED
@@ -31,6 +31,18 @@ module Logister
31
31
  reporter.report_metric(**kwargs)
32
32
  end
33
33
 
34
+ def report_transaction(**kwargs)
35
+ reporter.report_transaction(**kwargs)
36
+ end
37
+
38
+ def report_log(**kwargs)
39
+ reporter.report_log(**kwargs)
40
+ end
41
+
42
+ def report_check_in(**kwargs)
43
+ reporter.report_check_in(**kwargs)
44
+ end
45
+
34
46
  def flush(timeout: 2)
35
47
  reporter.flush(timeout: timeout)
36
48
  end
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
 
9
9
  spec.summary = 'Send Rails errors and metrics to logister.org'
10
10
  spec.description = 'Client gem for reporting errors and custom metrics from Ruby and Rails apps to logister.org'
11
- spec.homepage = 'https://logister.org'
11
+ spec.homepage = 'https://github.com/taimoorq/logister-ruby'
12
12
  spec.license = 'MIT'
13
13
  spec.required_ruby_version = '>= 3.1.0'
14
14
 
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.metadata['source_code_uri'] = 'https://github.com/taimoorq/logister-ruby'
17
17
 
18
18
  spec.files = Dir.chdir(__dir__) do
19
- Dir.glob('lib/**/*') + ['README.md', 'logister-ruby.gemspec']
19
+ Dir.glob('lib/**/*') + ['README.md', 'LICENSE', 'logister-ruby.gemspec']
20
20
  end
21
21
 
22
22
  spec.require_paths = ['lib']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logister-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logister
@@ -45,6 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - LICENSE
48
49
  - README.md
49
50
  - lib/generators/logister/install_generator.rb
50
51
  - lib/generators/logister/templates/logister.rb
@@ -62,11 +63,11 @@ files:
62
63
  - lib/logister/sql_subscriber.rb
63
64
  - lib/logister/version.rb
64
65
  - logister-ruby.gemspec
65
- homepage: https://logister.org
66
+ homepage: https://github.com/taimoorq/logister-ruby
66
67
  licenses:
67
68
  - MIT
68
69
  metadata:
69
- homepage_uri: https://logister.org
70
+ homepage_uri: https://github.com/taimoorq/logister-ruby
70
71
  source_code_uri: https://github.com/taimoorq/logister-ruby
71
72
  rdoc_options: []
72
73
  require_paths: