Documentation
¶
Index ¶
- type AggregatedMetric
- type AssetBreakdown
- type AssetCount
- type Collector
- func (c *Collector) RecordAssetView(assetID, assetType, assetName, assetProvider string) error
- func (c *Collector) RecordDBQuery(operation string, duration time.Duration, success bool)
- func (c *Collector) RecordHTTPDuration(method, path string, duration time.Duration)
- func (c *Collector) RecordHTTPRequest(method, path, status string) error
- func (c *Collector) RecordSearchQuery(queryType, query string) error
- func (c *Collector) SetDBConnections(count int)
- func (c *Collector) UpdateAssetMetrics(breakdown []AssetBreakdown)
- type Metric
- type MetricType
- type PostgresStore
- func (s *PostgresStore) AggregateMetrics(ctx context.Context, timeRange TimeRange, bucketSize time.Duration) error
- func (s *PostgresStore) CreatePartition(ctx context.Context, date time.Time) error
- func (s *PostgresStore) DeleteOldMetrics(ctx context.Context, olderThan time.Time) error
- func (s *PostgresStore) GetAggregatedMetrics(ctx context.Context, opts QueryOptions) ([]AggregatedMetric, error)
- func (s *PostgresStore) GetAssetBreakdown(ctx context.Context) ([]AssetBreakdown, error)
- func (s *PostgresStore) GetAssetsByOwner(ctx context.Context, ownerFields []string) (map[string]int64, error)
- func (s *PostgresStore) GetAssetsByProvider(ctx context.Context) (map[string]int64, error)
- func (s *PostgresStore) GetAssetsByType(ctx context.Context) (map[string]int64, error)
- func (s *PostgresStore) GetAssetsWithSchemas(ctx context.Context) (int64, error)
- func (s *PostgresStore) GetMetrics(ctx context.Context, opts QueryOptions) ([]Metric, error)
- func (s *PostgresStore) GetTopAssets(ctx context.Context, timeRange TimeRange, limit int) ([]AssetCount, error)
- func (s *PostgresStore) GetTopQueries(ctx context.Context, timeRange TimeRange, limit int) ([]QueryCount, error)
- func (s *PostgresStore) GetTotalAssets(ctx context.Context) (int64, error)
- func (s *PostgresStore) GetTotalAssetsFiltered(ctx context.Context, excludedTypes []string, excludedProviders []string) (int64, error)
- func (s *PostgresStore) RecordMetric(ctx context.Context, metric Metric) error
- func (s *PostgresStore) RecordMetrics(ctx context.Context, metrics []Metric) error
- type QueryCount
- type QueryOptions
- type Recorder
- type Service
- func (s *Service) Collector() *Collector
- func (s *Service) GetAssetsByOwner(ctx context.Context, ownerFields []string) (map[string]int64, error)
- func (s *Service) GetAssetsByProvider(ctx context.Context) (map[string]int64, error)
- func (s *Service) GetAssetsByType(ctx context.Context) (map[string]int64, error)
- func (s *Service) GetAssetsWithSchemas(ctx context.Context) (int64, error)
- func (s *Service) GetMetrics(ctx context.Context, opts QueryOptions) ([]AggregatedMetric, error)
- func (s *Service) GetRecorder() Recorder
- func (s *Service) GetTopAssets(ctx context.Context, timeRange TimeRange, limit int) ([]AssetCount, error)
- func (s *Service) GetTopQueries(ctx context.Context, timeRange TimeRange, limit int) ([]QueryCount, error)
- func (s *Service) GetTotalAssets(ctx context.Context) (int64, error)
- func (s *Service) GetTotalAssetsFiltered(ctx context.Context, excludedTypes []string, excludedProviders []string) (int64, error)
- func (s *Service) Start(ctx context.Context)
- func (s *Service) Stop()
- type Store
- type TimeRange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregatedMetric ¶
type AggregatedMetric struct {
Name string `json:"name"`
AggregationType string `json:"aggregation_type"`
Value float64 `json:"value"`
Labels map[string]string `json:"labels"`
BucketStart time.Time `json:"bucket_start"`
BucketEnd time.Time `json:"bucket_end"`
BucketSize time.Duration `json:"bucket_size"`
}
type AssetBreakdown ¶
type AssetCount ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
func NewCollector ¶
func (*Collector) RecordAssetView ¶
func (*Collector) RecordDBQuery ¶
func (*Collector) RecordHTTPDuration ¶
func (*Collector) RecordHTTPRequest ¶
func (*Collector) RecordSearchQuery ¶
func (*Collector) SetDBConnections ¶
func (*Collector) UpdateAssetMetrics ¶
func (c *Collector) UpdateAssetMetrics(breakdown []AssetBreakdown)
type MetricType ¶
type MetricType string
const ( Counter MetricType = "counter" Gauge MetricType = "gauge" Histogram MetricType = "histogram" )
type PostgresStore ¶
type PostgresStore struct {
// contains filtered or unexported fields
}
func (*PostgresStore) AggregateMetrics ¶
func (*PostgresStore) CreatePartition ¶
func (*PostgresStore) DeleteOldMetrics ¶
func (*PostgresStore) GetAggregatedMetrics ¶
func (s *PostgresStore) GetAggregatedMetrics(ctx context.Context, opts QueryOptions) ([]AggregatedMetric, error)
func (*PostgresStore) GetAssetBreakdown ¶
func (s *PostgresStore) GetAssetBreakdown(ctx context.Context) ([]AssetBreakdown, error)
func (*PostgresStore) GetAssetsByOwner ¶
func (*PostgresStore) GetAssetsByProvider ¶
func (*PostgresStore) GetAssetsByType ¶
func (*PostgresStore) GetAssetsWithSchemas ¶
func (s *PostgresStore) GetAssetsWithSchemas(ctx context.Context) (int64, error)
func (*PostgresStore) GetMetrics ¶
func (s *PostgresStore) GetMetrics(ctx context.Context, opts QueryOptions) ([]Metric, error)
func (*PostgresStore) GetTopAssets ¶
func (s *PostgresStore) GetTopAssets(ctx context.Context, timeRange TimeRange, limit int) ([]AssetCount, error)
func (*PostgresStore) GetTopQueries ¶
func (s *PostgresStore) GetTopQueries(ctx context.Context, timeRange TimeRange, limit int) ([]QueryCount, error)
func (*PostgresStore) GetTotalAssets ¶
func (s *PostgresStore) GetTotalAssets(ctx context.Context) (int64, error)
func (*PostgresStore) GetTotalAssetsFiltered ¶
func (*PostgresStore) RecordMetric ¶
func (s *PostgresStore) RecordMetric(ctx context.Context, metric Metric) error
func (*PostgresStore) RecordMetrics ¶
func (s *PostgresStore) RecordMetrics(ctx context.Context, metrics []Metric) error
type QueryCount ¶
type QueryOptions ¶
type Recorder ¶
type Recorder interface {
RecordSearchQuery(ctx context.Context, queryType, query string) error
RecordAssetView(ctx context.Context, assetID, assetType, assetName, assetProvider string) error
RecordDBQuery(ctx context.Context, operation string, duration time.Duration, success bool)
WrapDBQuery(ctx context.Context, operation string, fn func() error) error
}
func NewRecorder ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) GetAssetsByOwner ¶
func (*Service) GetAssetsByProvider ¶
func (*Service) GetAssetsByType ¶
func (*Service) GetAssetsWithSchemas ¶
func (*Service) GetMetrics ¶
func (s *Service) GetMetrics(ctx context.Context, opts QueryOptions) ([]AggregatedMetric, error)
func (*Service) GetRecorder ¶
func (*Service) GetTopAssets ¶
func (*Service) GetTopQueries ¶
func (*Service) GetTotalAssets ¶
func (*Service) GetTotalAssetsFiltered ¶
type Store ¶
type Store interface {
RecordMetric(ctx context.Context, metric Metric) error
RecordMetrics(ctx context.Context, metrics []Metric) error
GetMetrics(ctx context.Context, opts QueryOptions) ([]Metric, error)
GetAggregatedMetrics(ctx context.Context, opts QueryOptions) ([]AggregatedMetric, error)
GetTopQueries(ctx context.Context, timeRange TimeRange, limit int) ([]QueryCount, error)
GetTopAssets(ctx context.Context, timeRange TimeRange, limit int) ([]AssetCount, error)
GetTotalAssets(ctx context.Context) (int64, error)
GetTotalAssetsFiltered(ctx context.Context, excludedTypes []string, excludedProviders []string) (int64, error)
GetAssetsByType(ctx context.Context) (map[string]int64, error)
GetAssetsByProvider(ctx context.Context) (map[string]int64, error)
GetAssetsWithSchemas(ctx context.Context) (int64, error)
GetAssetsByOwner(ctx context.Context, ownerFields []string) (map[string]int64, error)
GetAssetBreakdown(ctx context.Context) ([]AssetBreakdown, error)
AggregateMetrics(ctx context.Context, timeRange TimeRange, bucketSize time.Duration) error
DeleteOldMetrics(ctx context.Context, olderThan time.Time) error
CreatePartition(ctx context.Context, date time.Time) error
}
func NewPostgresStore ¶
Click to show internal directories.
Click to hide internal directories.