Module: ScoutApmMcp::Client::Api::AnomalyEvents
- Included in:
- ScoutApmMcp::Client
- Defined in:
- lib/scout_apm_mcp/client/api.rb
Instance Method Summary collapse
- #get_anomaly_event(app_id, anomaly_event_id) ⇒ Object
- #list_anomaly_events(app_id, from: nil, to: nil, range: nil, state: nil, metric: nil, endpoint: nil) ⇒ Object
Instance Method Details
#get_anomaly_event(app_id, anomaly_event_id) ⇒ Object
158 159 160 161 162 |
# File 'lib/scout_apm_mcp/client/api.rb', line 158 def get_anomaly_event(app_id, anomaly_event_id) uri = URI("#{@api_base}/apps/#{app_id}/anomaly_events/#{anomaly_event_id}") response = make_request(uri) response.dig("results", "anomaly_event") || {} end |
#list_anomaly_events(app_id, from: nil, to: nil, range: nil, state: nil, metric: nil, endpoint: nil) ⇒ Object
147 148 149 150 151 152 153 154 155 156 |
# File 'lib/scout_apm_mcp/client/api.rb', line 147 def list_anomaly_events(app_id, from: nil, to: nil, range: nil, state: nil, metric: nil, endpoint: nil) times = resolve_range_times(from: from, to: to, range: range) validate_time_range(times[:from], times[:to]) if times[:from] && times[:to] validate_anomaly_state!(state) uri = URI("#{@api_base}/apps/#{app_id}/anomaly_events") assign_query(uri, from: times[:from], to: times[:to], state: state, metric: metric, endpoint: endpoint) response = make_request(uri) response.dig("results", "anomaly_events") || [] end |