harbor run -t openthoughts/tasktrove-exp-rpt-stack-ruby-v2-stack-ruby-0889harbor download openthoughts/tasktrove-exp-rpt-stack-ruby-v2-stack-ruby-0889Implement Ruby sources under /app/ so that the test file at /tests/test_solution.rb requires and runs cleanly under rspec (or plain ruby if the file uses Test::Unit / minitest).
tests/test_solution.rb)Below is a deterministic summary of what the test file expects. Use this as the source of truth for require-paths and public API. If the original task description below conflicts with this section, prefer this section.
Language: Ruby
Test framework hint: RSpec / minitest (test.sh runs rspec if RSpec/describe is detected, otherwise plain ruby)
Top-level types under test (from describe/RSpec.describe):
MetricsAdapter::Trackers::SlowRequestSymbols the test references that you likely need to define (class/module names not from Ruby/RSpec/Rails stdlib; place under /app/):
MetricsAdapter::Trackers::SlowRequestruby:3.2-slim with build-essential, ruby-dev, libffi-dev for native extensions.rspec, minitest. Other 3rd-party gems (see list above) are best-effort gem install-ed by tests/test.sh before running the test.tests/test.sh) runs bundle install if /app/Gemfile exists, then auto-requires every *.rb file under /app/ (recursively) via $LOAD_PATH.unshift('/app'). So you can place sources at any depth under /app/ as long as relative-require paths resolve.require 'foo/bar' in the test, ensure either the foo gem provides it OR you create /app/foo/bar.rb with the required constants.Task: Implement the SlowRequest metrics tracker and a minimal Mixpanel adapter under /app so the tests can exercise threshold, conditional, and publishing behavior.
What to implement
Add a core MetricsAdapter module (if not present) with safe default methods:
Create the SlowRequest tracker:
Create a minimal Mixpanel adapter:
Wire up a tiny default MetricsAdapter module (to keep things self-contained for the project):
Acceptance criteria
SlowRequest#call publishes when:
SlowRequest#call does not publish when:
The adapter used for publishing is instantiated according to MetricsAdapter.adapter (support at least :mixpanel), using MetricsAdapter.adapter_options for initialization, and is cached so slow_request.adapter returns the same object instance used to publish.
The tests can stub MetricsAdapter.thresholds, MetricsAdapter.adapter, MetricsAdapter.adapter_options, and MetricsAdapter.conditionals to drive behavior, and the implementation should respect these stubs.
The solution is located under /app/ with the following files:
Notes