Documentation
¶
Index ¶
- func CPUParamsMatcher(expectedResource string, expectedResolution *float32, ...) interface{}
- func HTTPLatencyParamsMatcher(expectedResource string, expectedQuantile *metricstypes.Quantile, ...) interface{}
- func HTTPRequestsParamsMatcher(expectedResource string, expectedAggregation *metricstypes.HttpAggregateBy, ...) interface{}
- func NewMockActiveConnectionsResponse(value float32) *client.GetActiveConnectionsResponse
- func NewMockCPULimitResponse(value float32) *client.GetCpuLimitResponse
- func NewMockCPUResponse(value float32) *client.GetCpuResponse
- func NewMockCPUTargetResponse(value float32) *client.GetCpuTargetResponse
- func NewMockErrorResponse(statusCode int) *http.Response
- func NewMockHTTPLatencyResponse(value float32, path string) *client.GetHttpLatencyResponse
- func NewMockHTTPRequestsResponse(value float32, statusCode string) *client.GetHttpRequestsResponse
- func NewMockInstanceCountResponse(value float32) *client.GetInstanceCountResponse
- func NewMockMemoryLimitResponse(value float32) *client.GetMemoryLimitResponse
- func NewMockMemoryResponse(value float32) *client.GetMemoryResponse
- func NewMockMemoryTargetResponse(value float32) *client.GetMemoryTargetResponse
- func Tools(c *client.ClientWithResponses) []server.ServerTool
- type MetricData
- type MetricType
- type MetricsClient
- type MetricsRequest
- type MetricsResponse
- type MetricsTestSuite
- type MockClientWithResponses
- func (m *MockClientWithResponses) GetActiveConnectionsWithResponse(ctx context.Context, params *client.GetActiveConnectionsParams, ...) (*client.GetActiveConnectionsResponse, error)
- func (m *MockClientWithResponses) GetCpuLimitWithResponse(ctx context.Context, params *client.GetCpuLimitParams, ...) (*client.GetCpuLimitResponse, error)
- func (m *MockClientWithResponses) GetCpuTargetWithResponse(ctx context.Context, params *client.GetCpuTargetParams, ...) (*client.GetCpuTargetResponse, error)
- func (m *MockClientWithResponses) GetCpuWithResponse(ctx context.Context, params *client.GetCpuParams, ...) (*client.GetCpuResponse, error)
- func (m *MockClientWithResponses) GetHttpLatencyWithResponse(ctx context.Context, params *client.GetHttpLatencyParams, ...) (*client.GetHttpLatencyResponse, error)
- func (m *MockClientWithResponses) GetHttpRequestsWithResponse(ctx context.Context, params *client.GetHttpRequestsParams, ...) (*client.GetHttpRequestsResponse, error)
- func (m *MockClientWithResponses) GetInstanceCountWithResponse(ctx context.Context, params *client.GetInstanceCountParams, ...) (*client.GetInstanceCountResponse, error)
- func (m *MockClientWithResponses) GetMemoryLimitWithResponse(ctx context.Context, params *client.GetMemoryLimitParams, ...) (*client.GetMemoryLimitResponse, error)
- func (m *MockClientWithResponses) GetMemoryTargetWithResponse(ctx context.Context, params *client.GetMemoryTargetParams, ...) (*client.GetMemoryTargetResponse, error)
- func (m *MockClientWithResponses) GetMemoryWithResponse(ctx context.Context, params *client.GetMemoryParams, ...) (*client.GetMemoryResponse, error)
- type Repo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CPUParamsMatcher ¶ added in v0.2.1
func CPUParamsMatcher(expectedResource string, expectedResolution *float32, expectedAggregation *metricstypes.ApplicationMetricAggregationMethod) interface{}
func HTTPLatencyParamsMatcher ¶ added in v0.2.1
func HTTPLatencyParamsMatcher(expectedResource string, expectedQuantile *metricstypes.Quantile, expectedHost *metricstypes.HostQueryParam, expectedPath *metricstypes.PathQueryParam) interface{}
func HTTPRequestsParamsMatcher ¶ added in v0.2.1
func HTTPRequestsParamsMatcher(expectedResource string, expectedAggregation *metricstypes.HttpAggregateBy, expectedResolution *float32, expectedHost *metricstypes.HostQueryParam, expectedPath *metricstypes.PathQueryParam) interface{}
func NewMockActiveConnectionsResponse ¶ added in v0.2.1
func NewMockActiveConnectionsResponse(value float32) *client.GetActiveConnectionsResponse
func NewMockCPULimitResponse ¶ added in v0.2.1
func NewMockCPULimitResponse(value float32) *client.GetCpuLimitResponse
func NewMockCPUResponse ¶ added in v0.2.1
func NewMockCPUResponse(value float32) *client.GetCpuResponse
func NewMockCPUTargetResponse ¶ added in v0.2.1
func NewMockCPUTargetResponse(value float32) *client.GetCpuTargetResponse
func NewMockErrorResponse ¶ added in v0.2.1
func NewMockHTTPLatencyResponse ¶ added in v0.2.1
func NewMockHTTPLatencyResponse(value float32, path string) *client.GetHttpLatencyResponse
func NewMockHTTPRequestsResponse ¶ added in v0.2.1
func NewMockHTTPRequestsResponse(value float32, statusCode string) *client.GetHttpRequestsResponse
func NewMockInstanceCountResponse ¶ added in v0.2.1
func NewMockInstanceCountResponse(value float32) *client.GetInstanceCountResponse
func NewMockMemoryLimitResponse ¶ added in v0.2.1
func NewMockMemoryLimitResponse(value float32) *client.GetMemoryLimitResponse
func NewMockMemoryResponse ¶ added in v0.2.1
func NewMockMemoryResponse(value float32) *client.GetMemoryResponse
func NewMockMemoryTargetResponse ¶ added in v0.2.1
func NewMockMemoryTargetResponse(value float32) *client.GetMemoryTargetResponse
func Tools ¶
func Tools(c *client.ClientWithResponses) []server.ServerTool
Types ¶
type MetricData ¶
type MetricData struct {
Type MetricType `json:"type"`
Data metricstypes.TimeSeriesCollection `json:"data"`
}
type MetricType ¶
type MetricType string
const ( MetricTypeCPUUsage MetricType = "cpu_usage" MetricTypeMemoryUsage MetricType = "memory_usage" MetricTypeHTTPRequestCount MetricType = "http_request_count" MetricTypeActiveConnections MetricType = "active_connections" MetricTypeInstanceCount MetricType = "instance_count" MetricTypeHTTPLatency MetricType = "http_latency" MetricTypeCPULimit MetricType = "cpu_limit" MetricTypeCPUTarget MetricType = "cpu_target" MetricTypeMemoryLimit MetricType = "memory_limit" MetricTypeMemoryTarget MetricType = "memory_target" )
type MetricsClient ¶ added in v0.2.1
type MetricsClient interface {
GetCpuWithResponse(ctx context.Context, params *client.GetCpuParams, reqEditors ...client.RequestEditorFn) (*client.GetCpuResponse, error)
GetMemoryWithResponse(ctx context.Context, params *client.GetMemoryParams, reqEditors ...client.RequestEditorFn) (*client.GetMemoryResponse, error)
GetHttpRequestsWithResponse(ctx context.Context, params *client.GetHttpRequestsParams, reqEditors ...client.RequestEditorFn) (*client.GetHttpRequestsResponse, error)
GetHttpLatencyWithResponse(ctx context.Context, params *client.GetHttpLatencyParams, reqEditors ...client.RequestEditorFn) (*client.GetHttpLatencyResponse, error)
GetActiveConnectionsWithResponse(ctx context.Context, params *client.GetActiveConnectionsParams, reqEditors ...client.RequestEditorFn) (*client.GetActiveConnectionsResponse, error)
GetInstanceCountWithResponse(ctx context.Context, params *client.GetInstanceCountParams, reqEditors ...client.RequestEditorFn) (*client.GetInstanceCountResponse, error)
GetCpuLimitWithResponse(ctx context.Context, params *client.GetCpuLimitParams, reqEditors ...client.RequestEditorFn) (*client.GetCpuLimitResponse, error)
GetCpuTargetWithResponse(ctx context.Context, params *client.GetCpuTargetParams, reqEditors ...client.RequestEditorFn) (*client.GetCpuTargetResponse, error)
GetMemoryLimitWithResponse(ctx context.Context, params *client.GetMemoryLimitParams, reqEditors ...client.RequestEditorFn) (*client.GetMemoryLimitResponse, error)
GetMemoryTargetWithResponse(ctx context.Context, params *client.GetMemoryTargetParams, reqEditors ...client.RequestEditorFn) (*client.GetMemoryTargetResponse, error)
}
MetricsClient interface for dependency injection in testing
type MetricsRequest ¶
type MetricsRequest struct {
ResourceID string
MetricTypes []MetricType
StartTime *client.StartTimeParam
EndTime *client.EndTimeParam
Resolution *float32
CpuUsageAggregationMethod *metricstypes.ApplicationMetricAggregationMethod
AggregateHttpRequestCountBy *metricstypes.HttpAggregateBy
HttpLatencyQuantile *metricstypes.Quantile
HttpPath *metricstypes.PathQueryParam
HttpHost *metricstypes.HostQueryParam
}
type MetricsResponse ¶
type MetricsResponse struct {
ResourceID string `json:"resourceId"`
TimeRange struct {
Start *client.StartTimeParam `json:"start,omitempty"`
End *client.EndTimeParam `json:"end,omitempty"`
} `json:"timeRange"`
Metrics []MetricData `json:"metrics"`
}
type MetricsTestSuite ¶ added in v0.2.1
MetricsTestSuite provides shared setup and utilities for metrics tests
func (*MetricsTestSuite) SetupTest ¶ added in v0.2.1
func (s *MetricsTestSuite) SetupTest()
func (*MetricsTestSuite) TearDownTest ¶ added in v0.2.1
func (s *MetricsTestSuite) TearDownTest()
type MockClientWithResponses ¶ added in v0.2.1
MockClientWithResponses implements MetricsClient interface for testing
func (*MockClientWithResponses) GetActiveConnectionsWithResponse ¶ added in v0.2.1
func (m *MockClientWithResponses) GetActiveConnectionsWithResponse(ctx context.Context, params *client.GetActiveConnectionsParams, reqEditors ...client.RequestEditorFn) (*client.GetActiveConnectionsResponse, error)
func (*MockClientWithResponses) GetCpuLimitWithResponse ¶ added in v0.2.1
func (m *MockClientWithResponses) GetCpuLimitWithResponse(ctx context.Context, params *client.GetCpuLimitParams, reqEditors ...client.RequestEditorFn) (*client.GetCpuLimitResponse, error)
func (*MockClientWithResponses) GetCpuTargetWithResponse ¶ added in v0.2.1
func (m *MockClientWithResponses) GetCpuTargetWithResponse(ctx context.Context, params *client.GetCpuTargetParams, reqEditors ...client.RequestEditorFn) (*client.GetCpuTargetResponse, error)
func (*MockClientWithResponses) GetCpuWithResponse ¶ added in v0.2.1
func (m *MockClientWithResponses) GetCpuWithResponse(ctx context.Context, params *client.GetCpuParams, reqEditors ...client.RequestEditorFn) (*client.GetCpuResponse, error)
func (*MockClientWithResponses) GetHttpLatencyWithResponse ¶ added in v0.2.1
func (m *MockClientWithResponses) GetHttpLatencyWithResponse(ctx context.Context, params *client.GetHttpLatencyParams, reqEditors ...client.RequestEditorFn) (*client.GetHttpLatencyResponse, error)
func (*MockClientWithResponses) GetHttpRequestsWithResponse ¶ added in v0.2.1
func (m *MockClientWithResponses) GetHttpRequestsWithResponse(ctx context.Context, params *client.GetHttpRequestsParams, reqEditors ...client.RequestEditorFn) (*client.GetHttpRequestsResponse, error)
func (*MockClientWithResponses) GetInstanceCountWithResponse ¶ added in v0.2.1
func (m *MockClientWithResponses) GetInstanceCountWithResponse(ctx context.Context, params *client.GetInstanceCountParams, reqEditors ...client.RequestEditorFn) (*client.GetInstanceCountResponse, error)
func (*MockClientWithResponses) GetMemoryLimitWithResponse ¶ added in v0.2.1
func (m *MockClientWithResponses) GetMemoryLimitWithResponse(ctx context.Context, params *client.GetMemoryLimitParams, reqEditors ...client.RequestEditorFn) (*client.GetMemoryLimitResponse, error)
func (*MockClientWithResponses) GetMemoryTargetWithResponse ¶ added in v0.2.1
func (m *MockClientWithResponses) GetMemoryTargetWithResponse(ctx context.Context, params *client.GetMemoryTargetParams, reqEditors ...client.RequestEditorFn) (*client.GetMemoryTargetResponse, error)
func (*MockClientWithResponses) GetMemoryWithResponse ¶ added in v0.2.1
func (m *MockClientWithResponses) GetMemoryWithResponse(ctx context.Context, params *client.GetMemoryParams, reqEditors ...client.RequestEditorFn) (*client.GetMemoryResponse, error)
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
func NewRepo ¶
func NewRepo(c MetricsClient) *Repo
func (*Repo) GetMetrics ¶
func (r *Repo) GetMetrics(ctx context.Context, req MetricsRequest) (*MetricsResponse, error)
Click to show internal directories.
Click to hide internal directories.