flare 0.1.1 → 1.0.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.

Potentially problematic release.


This version of flare might be problematic. Click here for more details.

Files changed (56) hide show
  1. data/.document +5 -0
  2. data/.gitignore +22 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +18 -0
  5. data/Rakefile +55 -0
  6. data/VERSION +1 -0
  7. data/flare.gemspec +66 -0
  8. data/lib/flare/active_record.rb +102 -0
  9. data/lib/flare/collection.rb +47 -0
  10. data/lib/flare/configuration.rb +64 -109
  11. data/lib/flare/index_builder.rb +24 -0
  12. data/lib/flare/session.rb +142 -0
  13. data/lib/flare/tasks.rb +18 -0
  14. data/lib/flare.rb +19 -408
  15. data/test/helper.rb +10 -0
  16. data/test/test_flare.rb +7 -0
  17. metadata +89 -228
  18. checksums.yaml +0 -7
  19. data/CHANGELOG.md +0 -5
  20. data/LICENSE.txt +0 -21
  21. data/README.md +0 -148
  22. data/app/controllers/flare/application_controller.rb +0 -22
  23. data/app/controllers/flare/jobs_controller.rb +0 -55
  24. data/app/controllers/flare/requests_controller.rb +0 -73
  25. data/app/controllers/flare/spans_controller.rb +0 -101
  26. data/app/helpers/flare/application_helper.rb +0 -168
  27. data/app/views/flare/jobs/index.html.erb +0 -69
  28. data/app/views/flare/jobs/show.html.erb +0 -323
  29. data/app/views/flare/requests/index.html.erb +0 -120
  30. data/app/views/flare/requests/show.html.erb +0 -498
  31. data/app/views/flare/spans/index.html.erb +0 -112
  32. data/app/views/flare/spans/show.html.erb +0 -184
  33. data/app/views/layouts/flare/application.html.erb +0 -126
  34. data/config/routes.rb +0 -20
  35. data/exe/flare +0 -9
  36. data/lib/flare/backoff_policy.rb +0 -73
  37. data/lib/flare/cli/doctor_command.rb +0 -129
  38. data/lib/flare/cli/output.rb +0 -45
  39. data/lib/flare/cli/setup_command.rb +0 -404
  40. data/lib/flare/cli/status_command.rb +0 -47
  41. data/lib/flare/cli.rb +0 -50
  42. data/lib/flare/engine.rb +0 -43
  43. data/lib/flare/http_metrics_config.rb +0 -101
  44. data/lib/flare/metric_counter.rb +0 -45
  45. data/lib/flare/metric_flusher.rb +0 -124
  46. data/lib/flare/metric_key.rb +0 -42
  47. data/lib/flare/metric_span_processor.rb +0 -470
  48. data/lib/flare/metric_storage.rb +0 -42
  49. data/lib/flare/metric_submitter.rb +0 -221
  50. data/lib/flare/source_location.rb +0 -113
  51. data/lib/flare/sqlite_exporter.rb +0 -279
  52. data/lib/flare/storage/sqlite.rb +0 -789
  53. data/lib/flare/storage.rb +0 -54
  54. data/lib/flare/version.rb +0 -5
  55. data/public/flare-assets/flare.css +0 -1245
  56. data/public/flare-assets/images/flipper.png +0 -0
metadata CHANGED
@@ -1,240 +1,101 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: flare
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
5
  platform: ruby
6
- authors:
7
- - John Nunemaker
8
- bindir: exe
6
+ authors:
7
+ - Michael Dwan
8
+ autorequire:
9
+ bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
- dependencies:
12
- - !ruby/object:Gem::Dependency
13
- name: railties
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - ">="
17
- - !ruby/object:Gem::Version
18
- version: '7.0'
19
- type: :runtime
20
- prerelease: false
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - ">="
24
- - !ruby/object:Gem::Version
25
- version: '7.0'
26
- - !ruby/object:Gem::Dependency
27
- name: activesupport
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: '7.0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '7.0'
40
- - !ruby/object:Gem::Dependency
41
- name: actionpack
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: '7.0'
47
- type: :runtime
48
- prerelease: false
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '7.0'
54
- - !ruby/object:Gem::Dependency
55
- name: concurrent-ruby
56
- requirement: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: '1.1'
61
- type: :runtime
62
- prerelease: false
63
- version_requirements: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: '1.1'
68
- - !ruby/object:Gem::Dependency
69
- name: opentelemetry-sdk
70
- requirement: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: '0'
11
+
12
+ date: 2009-12-29 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rsolr
75
17
  type: :runtime
76
- prerelease: false
77
- version_requirements: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: '0'
82
- - !ruby/object:Gem::Dependency
83
- name: opentelemetry-instrumentation-rack
84
- requirement: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: '0'
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.6
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: escape
89
27
  type: :runtime
90
- prerelease: false
91
- version_requirements: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- version: '0'
96
- - !ruby/object:Gem::Dependency
97
- name: opentelemetry-instrumentation-net_http
98
- requirement: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: '0'
103
- type: :runtime
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- - !ruby/object:Gem::Dependency
111
- name: opentelemetry-instrumentation-active_support
112
- requirement: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: '0'
117
- type: :runtime
118
- prerelease: false
119
- version_requirements: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- version: '0'
124
- - !ruby/object:Gem::Dependency
125
- name: opentelemetry-instrumentation-action_pack
126
- requirement: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: '0'
131
- type: :runtime
132
- prerelease: false
133
- version_requirements: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - ">="
136
- - !ruby/object:Gem::Version
137
- version: '0'
138
- - !ruby/object:Gem::Dependency
139
- name: opentelemetry-instrumentation-action_view
140
- requirement: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - ">="
143
- - !ruby/object:Gem::Version
144
- version: '0'
145
- type: :runtime
146
- prerelease: false
147
- version_requirements: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - ">="
150
- - !ruby/object:Gem::Version
151
- version: '0'
152
- - !ruby/object:Gem::Dependency
153
- name: opentelemetry-instrumentation-active_job
154
- requirement: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- version: '0'
159
- type: :runtime
160
- prerelease: false
161
- version_requirements: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - ">="
164
- - !ruby/object:Gem::Version
165
- version: '0'
166
- description: App monitoring for Rails. Captures requests, queries, jobs, cache, views,
167
- HTTP calls, mail, and exceptions with a waterfall visualization dashboard.
168
- email:
169
- - nunemaker@gmail.com
170
- executables:
171
- - flare
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.0.4
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: thoughtbot-shoulda
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ description: This needs to get updated
46
+ email: mpdwan@gmail.com
47
+ executables: []
48
+
172
49
  extensions: []
173
- extra_rdoc_files: []
174
- files:
175
- - CHANGELOG.md
176
- - LICENSE.txt
177
- - README.md
178
- - app/controllers/flare/application_controller.rb
179
- - app/controllers/flare/jobs_controller.rb
180
- - app/controllers/flare/requests_controller.rb
181
- - app/controllers/flare/spans_controller.rb
182
- - app/helpers/flare/application_helper.rb
183
- - app/views/flare/jobs/index.html.erb
184
- - app/views/flare/jobs/show.html.erb
185
- - app/views/flare/requests/index.html.erb
186
- - app/views/flare/requests/show.html.erb
187
- - app/views/flare/spans/index.html.erb
188
- - app/views/flare/spans/show.html.erb
189
- - app/views/layouts/flare/application.html.erb
190
- - config/routes.rb
191
- - exe/flare
50
+
51
+ extra_rdoc_files:
52
+ - LICENSE
53
+ - README.rdoc
54
+ files:
55
+ - .document
56
+ - .gitignore
57
+ - LICENSE
58
+ - README.rdoc
59
+ - Rakefile
60
+ - VERSION
61
+ - flare.gemspec
192
62
  - lib/flare.rb
193
- - lib/flare/backoff_policy.rb
194
- - lib/flare/cli.rb
195
- - lib/flare/cli/doctor_command.rb
196
- - lib/flare/cli/output.rb
197
- - lib/flare/cli/setup_command.rb
198
- - lib/flare/cli/status_command.rb
63
+ - lib/flare/active_record.rb
64
+ - lib/flare/collection.rb
199
65
  - lib/flare/configuration.rb
200
- - lib/flare/engine.rb
201
- - lib/flare/http_metrics_config.rb
202
- - lib/flare/metric_counter.rb
203
- - lib/flare/metric_flusher.rb
204
- - lib/flare/metric_key.rb
205
- - lib/flare/metric_span_processor.rb
206
- - lib/flare/metric_storage.rb
207
- - lib/flare/metric_submitter.rb
208
- - lib/flare/source_location.rb
209
- - lib/flare/sqlite_exporter.rb
210
- - lib/flare/storage.rb
211
- - lib/flare/storage/sqlite.rb
212
- - lib/flare/version.rb
213
- - public/flare-assets/flare.css
214
- - public/flare-assets/images/flipper.png
215
- homepage: https://github.com/jnunemaker/flare
216
- licenses:
217
- - MIT
218
- metadata:
219
- allowed_push_host: https://rubygems.org
220
- homepage_uri: https://flare.am
221
- source_code_uri: https://github.com/jnunemaker/flare
222
- changelog_uri: https://github.com/jnunemaker/flare/blob/master/CHANGELOG.md
223
- rdoc_options: []
224
- require_paths:
66
+ - lib/flare/index_builder.rb
67
+ - lib/flare/session.rb
68
+ - lib/flare/tasks.rb
69
+ - test/helper.rb
70
+ - test/test_flare.rb
71
+ has_rdoc: true
72
+ homepage: http://github.com/michaeldwan/flare
73
+ licenses: []
74
+
75
+ post_install_message:
76
+ rdoc_options:
77
+ - --charset=UTF-8
78
+ require_paths:
225
79
  - lib
226
- required_ruby_version: !ruby/object:Gem::Requirement
227
- requirements:
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
228
82
  - - ">="
229
- - !ruby/object:Gem::Version
230
- version: 3.0.0
231
- required_rubygems_version: !ruby/object:Gem::Requirement
232
- requirements:
83
+ - !ruby/object:Gem::Version
84
+ version: "0"
85
+ version:
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
233
88
  - - ">="
234
- - !ruby/object:Gem::Version
235
- version: '0'
89
+ - !ruby/object:Gem::Version
90
+ version: "0"
91
+ version:
236
92
  requirements: []
237
- rubygems_version: 4.0.7
238
- specification_version: 4
239
- summary: Light up what's slowing you down
240
- test_files: []
93
+
94
+ rubyforge_project:
95
+ rubygems_version: 1.3.5
96
+ signing_key:
97
+ specification_version: 3
98
+ summary: This needs to get updated
99
+ test_files:
100
+ - test/helper.rb
101
+ - test/test_flare.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA256:
3
- metadata.gz: 0fb9866f1a34be35ebd27efe1cd0b1eb6c9ea7109e21b18a6aa34d003ac32220
4
- data.tar.gz: 772b2542a8d1a35026dd11db71116b9f7a7d492cc2b36ece8920ceea5f30cac6
5
- SHA512:
6
- metadata.gz: 6f990ff07a6013e217574d08b0af5a7deb519bfb18b0104cbeac5c9e765b40e053b62bd3fe018854c8741e123acf885a07584ee21a410da4754d88e6ba052e6a
7
- data.tar.gz: c6903cc313cbb726cdc373a2307a53e8ef7cde7180e5b4c38fee9eac0667924ce1c3089ddabffac7e373da94f92b3bfbabbb9f996ff862f4bd1475f096bd18df
data/CHANGELOG.md DELETED
@@ -1,5 +0,0 @@
1
- ## [Unreleased]
2
-
3
- ## [0.1.0] - 2025-12-17
4
-
5
- - Initial release
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2025 John Nunemaker
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
13
- all 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
21
- THE SOFTWARE.
data/README.md DELETED
@@ -1,148 +0,0 @@
1
- # Flare — App Monitoring
2
-
3
- Light up what's slowing you down. [flare.am](https://flare.am)
4
-
5
- App monitoring for Rails. Captures requests, queries, jobs, cache, views, HTTP calls, mail, and exceptions in development with a waterfall visualization dashboard. Sends lightweight aggregated metrics in production.
6
-
7
- ## Features
8
-
9
- - **HTTP Requests** - Track all incoming requests with status codes, durations, and controller actions
10
- - **Background Jobs** - Monitor ActiveJob processing with queue names and execution times
11
- - **Database Queries** - See all SQL queries with the source location that triggered them
12
- - **Cache Operations** - Track cache reads, writes, hits, and misses
13
- - **View Rendering** - Monitor template and partial rendering times
14
- - **HTTP Client Calls** - See outgoing HTTP requests to external services
15
- - **Email Delivery** - Track ActionMailer sends with recipients and subjects
16
- - **Exceptions** - View errors with full stacktraces
17
-
18
- Each span shows a waterfall visualization of child operations, making it easy to understand request timing and identify bottlenecks.
19
-
20
- ## Installation
21
-
22
- Add Flare to your Gemfile:
23
-
24
- ```ruby
25
- gem "flare"
26
- ```
27
-
28
- The local development dashboard uses SQLite to store spans. If your app doesn't already have `sqlite3` in its Gemfile, add it to the development group:
29
-
30
- ```ruby
31
- group :development do
32
- gem "sqlite3"
33
- end
34
- ```
35
-
36
- Then run:
37
-
38
- ```bash
39
- bundle install
40
- flare setup
41
- ```
42
-
43
- The setup command will:
44
-
45
- 1. Authenticate with flare.am to configure metrics
46
- 2. Create a config initializer with sensible defaults
47
- 3. Update .gitignore
48
-
49
- Start your Rails server and visit `/flare` to see the dashboard.
50
-
51
- ### Manual Configuration
52
-
53
- If you prefer to skip the setup wizard, just add the gem and visit `/flare` in development. The dashboard works out of the box with no configuration needed.
54
-
55
- To enable metrics, set `FLARE_KEY` in your environment (get one at [flare.am](https://flare.am)).
56
-
57
- ### CLI Commands
58
-
59
- ```bash
60
- flare setup # Authenticate and configure Flare
61
- flare doctor # Check your setup for issues
62
- flare status # Show current configuration
63
- ```
64
-
65
- ## Configuration
66
-
67
- All configuration is optional. Flare works out of the box with sensible defaults.
68
-
69
- ```ruby
70
- Flare.configure do |config|
71
- # Enable or disable Flare (default: true)
72
- config.enabled = true
73
-
74
- # How long to keep spans in hours (default: 24)
75
- config.retention_hours = 24
76
-
77
- # Maximum number of spans to store (default: 10000)
78
- config.max_spans = 10_000
79
-
80
- # Path to the SQLite database (default: db/flare.sqlite3)
81
- config.database_path = Rails.root.join("db", "flare.sqlite3").to_s
82
-
83
- # Ignore specific requests (receives a Rack::Request, return true to ignore)
84
- config.ignore_request = ->(request) {
85
- request.path.start_with?("/health")
86
- }
87
-
88
- # Subscribe to custom notification prefixes (default: ["app."])
89
- config.subscribe_patterns << "mycompany."
90
- end
91
- ```
92
-
93
- ## Custom Instrumentation
94
-
95
- Flare automatically captures Rails internals, but you can also instrument your own code. Use `ActiveSupport::Notifications.instrument` with an `app.` prefix:
96
-
97
- ```ruby
98
- # In your application code
99
- ActiveSupport::Notifications.instrument("app.geocoding", address: address) do
100
- geocoder.lookup(address)
101
- end
102
-
103
- ActiveSupport::Notifications.instrument("app.stripe.charge", amount: 1000) do
104
- Stripe::Charge.create(amount: 1000, currency: "usd")
105
- end
106
-
107
- ActiveSupport::Notifications.instrument("app.send_sms", to: phone) do
108
- twilio.messages.create(to: phone, body: message)
109
- end
110
- ```
111
-
112
- This works in all environments - in production it's essentially a no-op, in development Flare automatically captures and displays it.
113
-
114
- ### Custom Notification Prefixes
115
-
116
- By default, Flare subscribes to notifications starting with `app.`. You can add additional prefixes:
117
-
118
- ```ruby
119
- Flare.configure do |config|
120
- config.subscribe_patterns << "mycompany."
121
- config.subscribe_patterns << "external_service."
122
- end
123
- ```
124
-
125
- ## How It Works
126
-
127
- Flare uses [OpenTelemetry](https://opentelemetry.io/) for instrumentation. It automatically configures:
128
-
129
- - `OpenTelemetry::Instrumentation::Rack` - HTTP requests
130
- - `OpenTelemetry::Instrumentation::ActiveSupport` - Notifications (SQL, cache, mail)
131
- - `OpenTelemetry::Instrumentation::ActionPack` - Controller actions
132
- - `OpenTelemetry::Instrumentation::ActionView` - View rendering
133
- - `OpenTelemetry::Instrumentation::ActiveJob` - Background jobs
134
- - `OpenTelemetry::Instrumentation::Net::HTTP` - Outgoing HTTP calls
135
-
136
- Spans are stored in a local SQLite database (`db/flare.sqlite3` by default) and automatically pruned based on retention settings.
137
-
138
- ## Development
139
-
140
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
141
-
142
- ## Contributing
143
-
144
- Bug reports and pull requests are welcome on GitHub at https://github.com/jnunemaker/flare.
145
-
146
- ## License
147
-
148
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Flare
4
- class ApplicationController < ActionController::Base
5
- protect_from_forgery with: :exception
6
-
7
- layout "flare/application"
8
-
9
- helper_method :show_redis_tab?
10
-
11
- private
12
-
13
- # Only show the Redis tab if:
14
- # 1. The Redis client library is loaded
15
- # 2. There are Redis spans in the database
16
- def show_redis_tab?
17
- return false unless defined?(::Redis)
18
-
19
- Flare.storage.count_spans_by_category("redis") > 0
20
- end
21
- end
22
- end
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Flare
4
- class JobsController < ApplicationController
5
- around_action :untrace_request
6
-
7
- helper_method :current_section, :page_title
8
-
9
- PER_PAGE = 50
10
-
11
- def index
12
- @offset = params[:offset].to_i
13
- filter_params = {
14
- name: params[:name].presence
15
- }
16
- # Fetch one extra to know if there's a next page
17
- jobs = Flare.storage.list_jobs(**filter_params, limit: PER_PAGE + 1, offset: @offset)
18
- @total_count = Flare.storage.count_jobs(**filter_params)
19
- @has_next = jobs.size > PER_PAGE
20
- @jobs = jobs.first(PER_PAGE)
21
- @has_prev = @offset > 0
22
- end
23
-
24
- def show
25
- @job = Flare.storage.find_job(params[:id])
26
-
27
- if @job.blank?
28
- redirect_to jobs_path, alert: "Job not found"
29
- return
30
- end
31
-
32
- @spans = Flare.storage.spans_for_trace(params[:id])
33
-
34
- # Find the root span (the job itself) with full properties
35
- @root_span = @spans.find { |s| s[:parent_span_id] == Flare::MISSING_PARENT_ID }
36
-
37
- # Child spans (everything except the root)
38
- @child_spans = @spans.reject { |s| s[:parent_span_id] == Flare::MISSING_PARENT_ID }
39
- end
40
-
41
- private
42
-
43
- def untrace_request
44
- Flare.untraced { yield }
45
- end
46
-
47
- def current_section
48
- "jobs"
49
- end
50
-
51
- def page_title
52
- "Jobs"
53
- end
54
- end
55
- end
@@ -1,73 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Flare
4
- class RequestsController < ApplicationController
5
- around_action :untrace_request
6
-
7
- helper_method :current_section, :page_title, :current_origin
8
-
9
- PER_PAGE = 50
10
-
11
- def index
12
- @offset = params[:offset].to_i
13
- filter_params = {
14
- status: params[:status].presence,
15
- method: params[:method].presence,
16
- name: params[:name].presence,
17
- origin: current_origin
18
- }
19
- # Fetch one extra to know if there's a next page
20
- requests = Flare.storage.list_requests(**filter_params, limit: PER_PAGE + 1, offset: @offset)
21
- @total_count = Flare.storage.count_requests(**filter_params)
22
- @has_next = requests.size > PER_PAGE
23
- @requests = requests.first(PER_PAGE)
24
- @has_prev = @offset > 0
25
- end
26
-
27
- def show
28
- @request = Flare.storage.find_request(params[:id])
29
-
30
- if @request.blank?
31
- redirect_to requests_path, alert: "Request not found"
32
- return
33
- end
34
-
35
- @spans = Flare.storage.spans_for_trace(params[:id])
36
-
37
- # Find the root span (the request itself) with full properties
38
- @root_span = @spans.find { |s| s[:parent_span_id] == Flare::MISSING_PARENT_ID }
39
-
40
- # Child spans (everything except the root)
41
- @child_spans = @spans.reject { |s| s[:parent_span_id] == Flare::MISSING_PARENT_ID }
42
- end
43
-
44
- def clear
45
- Flare.storage.clear_all
46
- redirect_to root_path
47
- end
48
-
49
- private
50
-
51
- def untrace_request
52
- Flare.untraced { yield }
53
- end
54
-
55
- def current_section
56
- "requests"
57
- end
58
-
59
- def page_title
60
- "Requests"
61
- end
62
-
63
- def current_origin
64
- # If origin was explicitly set (even to empty for "All"), use that
65
- if params.key?(:origin)
66
- return params[:origin].presence # nil for "All Origins", "app" or "rails" otherwise
67
- end
68
-
69
- # Default to "app" to hide Rails framework noise
70
- "app"
71
- end
72
- end
73
- end