Class: ScoutApmMcp::Client
- Inherits:
-
Object
- Object
- ScoutApmMcp::Client
show all
- Includes:
- Api::AnomalyEvents, Api::Apps, Api::Endpoints, Api::ErrorGroups, Api::Insights, Api::Jobs, Api::Metrics, Api::OpenApi, Api::Traces, HttpTransport, QueryParams, Validation
- Defined in:
- lib/scout_apm_mcp/client.rb,
lib/scout_apm_mcp/client/api.rb,
lib/scout_apm_mcp/client/validation.rb,
lib/scout_apm_mcp/client/query_params.rb,
lib/scout_apm_mcp/client/http_transport.rb,
sig/scout_apm_mcp.rbs
Overview
ScoutAPM API client for making authenticated requests to the ScoutAPM API
Defined Under Namespace
Modules: Api, HttpTransport, QueryParams, Validation
Constant Summary
collapse
- API_BASE =
"https://scoutapm.com/api/v0"
- VALID_METRICS =
%w[apdex response_time response_time_95th errors throughput queue_time].freeze
- VALID_INSIGHTS =
%w[n_plus_one memory_bloat slow_query].freeze
- VALID_JOB_METRICS =
%w[throughput execution_time latency errors allocations].freeze
- VALID_ENDPOINT_SORT_BY =
%w[time_consumed response_time throughput error_rate].freeze
- VALID_ANOMALY_STATES =
%w[open closed all].freeze
- MAX_REQUEST_ATTEMPTS =
3
- RETRY_BASE_DELAY_SECONDS =
0.5
- RETRYABLE_HTTP_STATUS_CODES =
(500..599)
Instance Method Summary
collapse
-
#build_http_client ⇒ Net::HTTP
-
#fetch_openapi_schema ⇒ Hash[Symbol, untyped]
-
#fetch_trace ⇒ Hash[String, untyped]
-
#get_all_insights ⇒ Hash[String, untyped]
-
#get_anomaly_event ⇒ Hash[String, untyped]
-
#get_app ⇒ Hash[String, untyped]
-
#get_endpoint_metrics ⇒ Hash[String, untyped]
-
#get_error_group ⇒ Hash[String, untyped]
-
#get_error_group_errors ⇒ Hash[String, untyped]
-
#get_insight_by_type ⇒ Hash[String, untyped]
-
#get_insights_history ⇒ Hash[String, untyped]
-
#get_insights_history_by_type ⇒ Hash[String, untyped]
-
#get_job_metrics ⇒ Object
-
#get_metric ⇒ Hash[String, untyped]
-
#initialize(api_key:, api_base: API_BASE) ⇒ Client
constructor
A new instance of Client.
-
#list_anomaly_events ⇒ Array[untyped]
-
#list_apps ⇒ Array[untyped]
-
#list_endpoint_traces ⇒ Array[untyped]
-
#list_endpoints ⇒ Array[untyped], Hash[String, untyped]
-
#list_error_groups ⇒ Hash[String, untyped]
-
#list_job_metrics ⇒ Object
-
#list_job_traces ⇒ Object
-
#list_jobs ⇒ Object
-
#list_metrics ⇒ Hash[String, untyped]
Constructor Details
#initialize(api_key:, api_base: API_BASE) ⇒ Client
Returns a new instance of Client.
52
53
54
55
56
57
58
59
|
# File 'lib/scout_apm_mcp/client.rb', line 52
def initialize(api_key:, api_base: API_BASE)
if api_key.nil? || api_key.to_s.strip.empty?
raise ArgumentError, "API key is required and cannot be nil or empty"
end
@api_key = api_key.to_s
@api_base = api_base
@user_agent = "scout-apm-mcp-rb/#{VERSION}"
end
|
Instance Method Details
#build_http_client ⇒ Net::HTTP
13
|
# File 'sig/scout_apm_mcp.rbs', line 13
def build_http_client: (URI uri) -> Net::HTTP
|
#fetch_openapi_schema ⇒ Hash[Symbol, untyped]
36
|
# File 'sig/scout_apm_mcp.rbs', line 36
def fetch_openapi_schema: () -> Hash[Symbol, untyped]
|
#fetch_trace ⇒ Hash[String, untyped]
26
|
# File 'sig/scout_apm_mcp.rbs', line 26
def fetch_trace: (Integer app_id, Integer trace_id) -> Hash[String, untyped]
|
#get_all_insights ⇒ Hash[String, untyped]
32
|
# File 'sig/scout_apm_mcp.rbs', line 32
def get_all_insights: (Integer app_id, ?limit: Integer?) -> Hash[String, untyped]
|
#get_anomaly_event ⇒ Hash[String, untyped]
31
|
# File 'sig/scout_apm_mcp.rbs', line 31
def get_anomaly_event: (Integer app_id, Integer anomaly_event_id) -> Hash[String, untyped]
|
#get_app ⇒ Hash[String, untyped]
16
|
# File 'sig/scout_apm_mcp.rbs', line 16
def get_app: (Integer app_id) -> Hash[String, untyped]
|
#get_endpoint_metrics ⇒ Hash[String, untyped]
20
|
# File 'sig/scout_apm_mcp.rbs', line 20
def get_endpoint_metrics: (Integer app_id, String endpoint_id, String metric_type, ?from: String?, ?to: String?) -> Hash[String, untyped]
|
#get_error_group ⇒ Hash[String, untyped]
28
|
# File 'sig/scout_apm_mcp.rbs', line 28
def get_error_group: (Integer app_id, Integer error_id) -> Hash[String, untyped]
|
#get_error_group_errors ⇒ Hash[String, untyped]
29
|
# File 'sig/scout_apm_mcp.rbs', line 29
def get_error_group_errors: (Integer app_id, Integer error_id) -> Hash[String, untyped]
|
#get_insight_by_type ⇒ Hash[String, untyped]
33
|
# File 'sig/scout_apm_mcp.rbs', line 33
def get_insight_by_type: (Integer app_id, String insight_type, ?limit: Integer?) -> Hash[String, untyped]
|
#get_insights_history ⇒ Hash[String, untyped]
34
|
# File 'sig/scout_apm_mcp.rbs', line 34
def get_insights_history: (Integer app_id, ?from: String?, ?to: String?, ?limit: Integer?, ?pagination_cursor: Integer?, ?pagination_direction: String?, ?pagination_page: Integer?) -> Hash[String, untyped]
|
#get_insights_history_by_type ⇒ Hash[String, untyped]
35
|
# File 'sig/scout_apm_mcp.rbs', line 35
def get_insights_history_by_type: (Integer app_id, String insight_type, ?from: String?, ?to: String?, ?limit: Integer?, ?pagination_cursor: Integer?, ?pagination_direction: String?, ?pagination_page: Integer?) -> Hash[String, untyped]
|
#get_job_metrics ⇒ Object
24
|
# File 'sig/scout_apm_mcp.rbs', line 24
def get_job_metrics: (Integer app_id, String job_id, String metric_type, ?from: String?, ?to: String?, ?range: String?) -> untyped
|
#get_metric ⇒ Hash[String, untyped]
18
|
# File 'sig/scout_apm_mcp.rbs', line 18
def get_metric: (Integer app_id, String metric_type, ?from: String?, ?to: String?) -> Hash[String, untyped]
|
#list_anomaly_events ⇒ Array[untyped]
30
|
# File 'sig/scout_apm_mcp.rbs', line 30
def list_anomaly_events: (Integer app_id, ?from: String?, ?to: String?, ?range: String?, ?state: String?, ?metric: String?, ?endpoint: String?) -> Array[untyped]
|
#list_apps ⇒ Array[untyped]
15
|
# File 'sig/scout_apm_mcp.rbs', line 15
def list_apps: (?active_since: String?) -> Array[untyped]
|
#list_endpoint_traces ⇒ Array[untyped]
21
|
# File 'sig/scout_apm_mcp.rbs', line 21
def list_endpoint_traces: (Integer app_id, String endpoint_id, ?from: String?, ?to: String?, ?range: String?) -> Array[untyped]
|
#list_endpoints ⇒ Array[untyped], Hash[String, untyped]
19
|
# File 'sig/scout_apm_mcp.rbs', line 19
def list_endpoints: (Integer app_id, ?from: String?, ?to: String?, ?range: String?, ?sort_by: String?, ?limit: Integer?, ?offset: Integer?) -> (Array[untyped] | Hash[String, untyped])
|
#list_error_groups ⇒ Hash[String, untyped]
27
|
# File 'sig/scout_apm_mcp.rbs', line 27
def list_error_groups: (Integer app_id, ?from: String?, ?to: String?, ?endpoint: String?) -> Hash[String, untyped]
|
#list_job_metrics ⇒ Object
23
|
# File 'sig/scout_apm_mcp.rbs', line 23
def list_job_metrics: (Integer app_id, String job_id) -> untyped
|
#list_job_traces ⇒ Object
25
|
# File 'sig/scout_apm_mcp.rbs', line 25
def list_job_traces: (Integer app_id, String job_id, ?from: String?, ?to: String?, ?range: String?) -> untyped
|
#list_jobs ⇒ Object
22
|
# File 'sig/scout_apm_mcp.rbs', line 22
def list_jobs: (Integer app_id, ?from: String?, ?to: String?, ?range: String?) -> untyped
|
#list_metrics ⇒ Hash[String, untyped]
17
|
# File 'sig/scout_apm_mcp.rbs', line 17
def list_metrics: (Integer app_id) -> Hash[String, untyped]
|