Documentation ¶
Overview ¶
Copyright 2024 The Prometheus Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func UpdateMetrics(ctx context.Context, logger logging.Logger, jobsCfg model.JobsConfig, ...) error
- type OptionsFunc
- func CloudWatchAPIConcurrency(maxConcurrency int) OptionsFunc
- func CloudWatchPerAPILimitConcurrency(listMetrics, getMetricData, getMetricStatistics int) OptionsFunc
- func EnableFeatureFlag(flags ...string) OptionsFunc
- func LabelsSnakeCase(labelsSnakeCase bool) OptionsFunc
- func MetricsPerQuery(metricsPerQuery int) OptionsFunc
- func TaggingAPIConcurrency(maxConcurrency int) OptionsFunc
Constants ¶
const ( DefaultMetricsPerQuery = 500 DefaultLabelsSnakeCase = false DefaultTaggingAPIConcurrency = 5 )
Variables ¶
var DefaultCloudwatchConcurrency = cloudwatch.ConcurrencyConfig{ SingleLimit: 5, PerAPILimitEnabled: false, ListMetrics: 5, GetMetricData: 5, GetMetricStatistics: 5, }
var Metrics = []prometheus.Collector{ promutil.CloudwatchAPIErrorCounter, promutil.CloudwatchAPICounter, promutil.CloudwatchGetMetricDataAPICounter, promutil.CloudwatchGetMetricDataAPIMetricsCounter, promutil.CloudwatchGetMetricStatisticsAPICounter, promutil.ResourceGroupTaggingAPICounter, promutil.AutoScalingAPICounter, promutil.TargetGroupsAPICounter, promutil.APIGatewayAPICounter, promutil.Ec2APICounter, promutil.DmsAPICounter, promutil.StoragegatewayAPICounter, promutil.DuplicateMetricsFilteredCounter, }
Metrics is a slice of prometheus metrics specific to the scraping process such API call counters
Functions ¶
func UpdateMetrics ¶
func UpdateMetrics( ctx context.Context, logger logging.Logger, jobsCfg model.JobsConfig, registry *prometheus.Registry, factory clients.Factory, optFuncs ...OptionsFunc, ) error
UpdateMetrics is the entrypoint to scrape metrics from AWS on demand.
Parameters are: - `ctx`: a context for the request - `config`: this is the struct representation of the configuration defined in top-level configuration - `logger`: any implementation of the `logging.Logger` interface - `registry`: any prometheus compatible registry where scraped AWS metrics will be written - `factory`: any implementation of the `clients.Factory` interface - `optFuncs`: (optional) any number of options funcs
You can pre-register any of the default metrics from `Metrics` with the provided `registry` if you want them included in the AWS scrape results. If you are using multiple instances of `registry` it might make more sense to register these metrics in the application using YACE as a library to better track them over the lifetime of the application.
Types ¶
type OptionsFunc ¶
type OptionsFunc func(*options) error
func CloudWatchAPIConcurrency ¶
func CloudWatchAPIConcurrency(maxConcurrency int) OptionsFunc
func CloudWatchPerAPILimitConcurrency ¶
func CloudWatchPerAPILimitConcurrency(listMetrics, getMetricData, getMetricStatistics int) OptionsFunc
func EnableFeatureFlag ¶
func EnableFeatureFlag(flags ...string) OptionsFunc
EnableFeatureFlag is an option that enables a feature flag on the YACE's entrypoint.
func LabelsSnakeCase ¶
func LabelsSnakeCase(labelsSnakeCase bool) OptionsFunc
func MetricsPerQuery ¶
func MetricsPerQuery(metricsPerQuery int) OptionsFunc
func TaggingAPIConcurrency ¶
func TaggingAPIConcurrency(maxConcurrency int) OptionsFunc