diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8778ce4154e2..9c9b0acc638c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,4 +23,4 @@ jobs: go-version: "1.22" cache: true - name: Test - run: make GO_TAGS="nodocker" test + run: CGO_LDFLAGS="-ld_classic $CGO_LDFLAGS" make GO_TAGS="nodocker" test diff --git a/CHANGELOG.md b/CHANGELOG.md index 272b0fbdfda2..b243153df543 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,8 @@ v0.41.0 (2024-05-31) - The default sync interval for `mimir.rules.kubernetes` has changed from `30s` to `5m` to reduce load on Mimir. (@56quarters) +- Cloudwatch exporter is not allowing aliases for the namespaces as `type` value. For example: "s3" is not allowed, "AWS/S3" should be used. (@kgeckhart, @andriikushch) + ### Enhancements - Add support for importing folders as single module to `import.file`. (@wildum) @@ -68,6 +70,8 @@ v0.41.0 (2024-05-31) - Propagate request metadata for `faro.receiver` to downstream components. (@hainenber) +- A new parameter `aws_sdk_version_v2` is added for the cloudwatch exporters configuration. It enables the use of aws sdk v2 which has shown to have significant performance benefits. (@kgeckhart, @andriikushch) + ### Features - A new `loki.rules.kubernetes` component that discovers `PrometheusRule` Kubernetes resources and loads them into a Loki Ruler instance. (@EStork09) diff --git a/docs/sources/flow/reference/components/prometheus.exporter.cloudwatch.md b/docs/sources/flow/reference/components/prometheus.exporter.cloudwatch.md index 4caae767f321..1a18bab725c5 100644 --- a/docs/sources/flow/reference/components/prometheus.exporter.cloudwatch.md +++ b/docs/sources/flow/reference/components/prometheus.exporter.cloudwatch.md @@ -97,6 +97,8 @@ To use all of the integration features, use the following AWS IAM Policy: prometheus.exporter.cloudwatch "queues" { sts_region = "us-east-2" + aws_sdk_version_v2 = true + discovery { type = "sqs" regions = ["us-east-2"] @@ -124,11 +126,12 @@ prometheus.exporter.cloudwatch "queues" { You can use the following arguments to configure the exporter's behavior. Omitted fields take their default values. -| Name | Type | Description | Default | Required | -| ------------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -------- | -| `sts_region` | `string` | AWS region to use when calling [STS][] for retrieving account information. | | yes | -| `fips_disabled` | `bool` | Disable use of FIPS endpoints. Set 'true' when running outside of USA regions. | `true` | no | -| `debug` | `bool` | Enable debug logging on CloudWatch exporter internals. | `false` | no | +| Name | Type | Description | Default | Required | +|---------------------------|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|----------| +| `sts_region` | `string` | AWS region to use when calling [STS][] for retrieving account information. | | yes | +| `aws_sdk_version_v2` | `bool` | Use AWS SDK version 2. | `false` | no | +| `fips_disabled` | `bool` | Disable use of FIPS endpoints. Set 'true' when running outside of USA regions. | `true` | no | +| `debug` | `bool` | Enable debug logging on CloudWatch exporter internals. | `false` | no | | `discovery_exported_tags` | `map(list(string))` | List of tags (value) per service (key) to export in all metrics. For example, defining the `["name", "type"]` under `"AWS/EC2"` will export the name and type tags and its values as labels in all metrics. Affects all discovery jobs. | `{}` | no | [STS]: https://docs.aws.amazon.com/STS/latest/APIReference/welcome.html @@ -369,91 +372,91 @@ See the examples described under each [discovery][] and [static] sections. ## Supported services in discovery jobs The following is a list of AWS services that are supported in `cloudwatch_exporter` discovery jobs. When configuring a -discovery job, the `type` field of each `discovery_job` must match either the desired job namespace or alias. - -- Namespace: `CWAgent` or Alias: `cwagent` -- Namespace: `AWS/Usage` or Alias: `usage` -- Namespace: `AWS/CertificateManager` or Alias: `acm` -- Namespace: `AWS/ACMPrivateCA` or Alias: `acm-pca` -- Namespace: `AmazonMWAA` or Alias: `airflow` -- Namespace: `AWS/MWAA` or Alias: `mwaa` -- Namespace: `AWS/ApplicationELB` or Alias: `alb` -- Namespace: `AWS/AppStream` or Alias: `appstream` -- Namespace: `AWS/Backup` or Alias: `backup` -- Namespace: `AWS/ApiGateway` or Alias: `apigateway` -- Namespace: `AWS/AmazonMQ` or Alias: `mq` -- Namespace: `AWS/AppSync` or Alias: `appsync` -- Namespace: `AWS/Athena` or Alias: `athena` -- Namespace: `AWS/AutoScaling` or Alias: `asg` -- Namespace: `AWS/ElasticBeanstalk` or Alias: `beanstalk` -- Namespace: `AWS/Billing` or Alias: `billing` -- Namespace: `AWS/Cassandra` or Alias: `cassandra` -- Namespace: `AWS/CloudFront` or Alias: `cloudfront` -- Namespace: `AWS/Cognito` or Alias: `cognito-idp` -- Namespace: `AWS/DMS` or Alias: `dms` -- Namespace: `AWS/DDoSProtection` or Alias: `shield` -- Namespace: `AWS/DocDB` or Alias: `docdb` -- Namespace: `AWS/DX` or Alias: `dx` -- Namespace: `AWS/DynamoDB` or Alias: `dynamodb` -- Namespace: `AWS/EBS` or Alias: `ebs` -- Namespace: `AWS/ElastiCache` or Alias: `ec` -- Namespace: `AWS/MemoryDB` or Alias: `memorydb` -- Namespace: `AWS/EC2` or Alias: `ec2` -- Namespace: `AWS/EC2Spot` or Alias: `ec2Spot` -- Namespace: `AWS/ECS` or Alias: `ecs-svc` -- Namespace: `ECS/ContainerInsights` or Alias: `ecs-containerinsights` -- Namespace: `AWS/EFS` or Alias: `efs` -- Namespace: `AWS/ELB` or Alias: `elb` -- Namespace: `AWS/ElasticMapReduce` or Alias: `emr` -- Namespace: `AWS/EMRServerless` or Alias: `emr-serverless` -- Namespace: `AWS/ES` or Alias: `es` -- Namespace: `AWS/Firehose` or Alias: `firehose` -- Namespace: `AWS/FSx` or Alias: `fsx` -- Namespace: `AWS/GameLift` or Alias: `gamelift` -- Namespace: `AWS/GlobalAccelerator` or Alias: `ga` -- Namespace: `Glue` or Alias: `glue` -- Namespace: `AWS/IoT` or Alias: `iot` -- Namespace: `AWS/Kafka` or Alias: `kafka` -- Namespace: `AWS/KafkaConnect` or Alias: `kafkaconnect` -- Namespace: `AWS/Kinesis` or Alias: `kinesis` -- Namespace: `AWS/KinesisAnalytics` or Alias: `kinesis-analytics` -- Namespace: `AWS/Lambda` or Alias: `lambda` -- Namespace: `AWS/MediaConnect` or Alias: `mediaconnect` -- Namespace: `AWS/MediaConvert` or Alias: `mediaconvert` -- Namespace: `AWS/MediaLive` or Alias: `medialive` -- Namespace: `AWS/MediaTailor` or Alias: `mediatailor` -- Namespace: `AWS/Neptune` or Alias: `neptune` -- Namespace: `AWS/NetworkFirewall` or Alias: `nfw` -- Namespace: `AWS/NATGateway` or Alias: `ngw` -- Namespace: `AWS/NetworkELB` or Alias: `nlb` -- Namespace: `AWS/PrivateLinkEndpoints` or Alias: `vpc-endpoint` -- Namespace: `AWS/PrivateLinkServices` or Alias: `vpc-endpoint-service` -- Namespace: `AWS/Prometheus` or Alias: `amp` -- Namespace: `AWS/QLDB` or Alias: `qldb` -- Namespace: `AWS/RDS` or Alias: `rds` -- Namespace: `AWS/Redshift` or Alias: `redshift` -- Namespace: `AWS/Route53Resolver` or Alias: `route53-resolver` -- Namespace: `AWS/Route53` or Alias: `route53` -- Namespace: `AWS/S3` or Alias: `s3` -- Namespace: `AWS/SES` or Alias: `ses` -- Namespace: `AWS/States` or Alias: `sfn` -- Namespace: `AWS/SNS` or Alias: `sns` -- Namespace: `AWS/SQS` or Alias: `sqs` -- Namespace: `AWS/StorageGateway` or Alias: `storagegateway` -- Namespace: `AWS/TransitGateway` or Alias: `tgw` -- Namespace: `AWS/TrustedAdvisor` or Alias: `trustedadvisor` -- Namespace: `AWS/VPN` or Alias: `vpn` -- Namespace: `AWS/ClientVPN` or Alias: `clientvpn` -- Namespace: `AWS/WAFV2` or Alias: `wafv2` -- Namespace: `AWS/WorkSpaces` or Alias: `workspaces` -- Namespace: `AWS/AOSS` or Alias: `aoss` -- Namespace: `AWS/SageMaker` or Alias: `sagemaker` -- Namespace: `/aws/sagemaker/Endpoints` or Alias: `sagemaker-endpoints` -- Namespace: `/aws/sagemaker/TrainingJobs` or Alias: `sagemaker-training` -- Namespace: `/aws/sagemaker/ProcessingJobs` or Alias: `sagemaker-processing` -- Namespace: `/aws/sagemaker/TransformJobs` or Alias: `sagemaker-transform` -- Namespace: `/aws/sagemaker/InferenceRecommendationsJobs` or Alias: `sagemaker-inf-rec` -- Namespace: `AWS/Sagemaker/ModelBuildingPipeline` or Alias: `sagemaker-model-building-pipeline` +discovery job, the `type` field of each `discovery_job` must match the desired job namespace. + +- Namespace: `CWAgent` +- Namespace: `AWS/Usage` +- Namespace: `AWS/CertificateManager` +- Namespace: `AWS/ACMPrivateCA` +- Namespace: `AmazonMWAA` +- Namespace: `AWS/MWAA` +- Namespace: `AWS/ApplicationELB` +- Namespace: `AWS/AppStream` +- Namespace: `AWS/Backup` +- Namespace: `AWS/ApiGateway` +- Namespace: `AWS/AmazonMQ` +- Namespace: `AWS/AppSync` +- Namespace: `AWS/Athena` +- Namespace: `AWS/AutoScaling` +- Namespace: `AWS/ElasticBeanstalk` +- Namespace: `AWS/Billing` +- Namespace: `AWS/Cassandra` +- Namespace: `AWS/CloudFront` +- Namespace: `AWS/Cognito` +- Namespace: `AWS/DMS` +- Namespace: `AWS/DDoSProtection` +- Namespace: `AWS/DocDB` +- Namespace: `AWS/DX` +- Namespace: `AWS/DynamoDB` +- Namespace: `AWS/EBS` +- Namespace: `AWS/ElastiCache` +- Namespace: `AWS/MemoryDB` +- Namespace: `AWS/EC2` +- Namespace: `AWS/EC2Spot` +- Namespace: `AWS/ECS` +- Namespace: `ECS/ContainerInsights` +- Namespace: `AWS/EFS` +- Namespace: `AWS/ELB` +- Namespace: `AWS/ElasticMapReduce` +- Namespace: `AWS/EMRServerless` +- Namespace: `AWS/ES` +- Namespace: `AWS/Firehose` +- Namespace: `AWS/FSx` +- Namespace: `AWS/GameLift` +- Namespace: `AWS/GlobalAccelerator` +- Namespace: `Glue` +- Namespace: `AWS/IoT` +- Namespace: `AWS/Kafka` +- Namespace: `AWS/KafkaConnect` +- Namespace: `AWS/Kinesis` +- Namespace: `AWS/KinesisAnalytics` +- Namespace: `AWS/Lambda` +- Namespace: `AWS/MediaConnect` +- Namespace: `AWS/MediaConvert` +- Namespace: `AWS/MediaLive` +- Namespace: `AWS/MediaTailor` +- Namespace: `AWS/Neptune` +- Namespace: `AWS/NetworkFirewall` +- Namespace: `AWS/NATGateway` +- Namespace: `AWS/NetworkELB` +- Namespace: `AWS/PrivateLinkEndpoints` +- Namespace: `AWS/PrivateLinkServices` +- Namespace: `AWS/Prometheus` +- Namespace: `AWS/QLDB` +- Namespace: `AWS/RDS` +- Namespace: `AWS/Redshift` +- Namespace: `AWS/Route53Resolver` +- Namespace: `AWS/Route53` +- Namespace: `AWS/S3` +- Namespace: `AWS/SES` +- Namespace: `AWS/States` +- Namespace: `AWS/SNS` +- Namespace: `AWS/SQS` +- Namespace: `AWS/StorageGateway` +- Namespace: `AWS/TransitGateway` +- Namespace: `AWS/TrustedAdvisor` +- Namespace: `AWS/VPN` +- Namespace: `AWS/ClientVPN` +- Namespace: `AWS/WAFV2` +- Namespace: `AWS/WorkSpaces` +- Namespace: `AWS/AOSS` +- Namespace: `AWS/SageMaker` +- Namespace: `/aws/sagemaker/Endpoints` +- Namespace: `/aws/sagemaker/TrainingJobs` +- Namespace: `/aws/sagemaker/ProcessingJobs` +- Namespace: `/aws/sagemaker/TransformJobs` +- Namespace: `/aws/sagemaker/InferenceRecommendationsJobs` +- Namespace: `AWS/Sagemaker/ModelBuildingPipeline` diff --git a/docs/sources/static/configuration/integrations/cloudwatch-exporter-config.md b/docs/sources/static/configuration/integrations/cloudwatch-exporter-config.md index 7379895146cd..11a92320bdcc 100644 --- a/docs/sources/static/configuration/integrations/cloudwatch-exporter-config.md +++ b/docs/sources/static/configuration/integrations/cloudwatch-exporter-config.md @@ -132,6 +132,9 @@ Configuration reference: # Ex: us-east-2 sts_region: + # Optional: Use AWS SDK version 2. + [aws_sdk_version_v2: | default = false] + # Optional: Disable use of FIPS endpoints. Set 'true' when running outside of USA regions. [fips_disabled: | default = false] @@ -203,7 +206,7 @@ Configuration reference: # Optional: List of IAM roles to assume. Defaults to the role on the environment configured AWS role. roles: [ ] - # Required: Cloudwatch service alias ("alb", "ec2", etc) or namespace name ("AWS/EC2", "AWS/S3", etc). See section below for all + # Required: Cloudwatch service namespace name ("AWS/EC2", "AWS/S3", etc). See section below for all # supported. type: @@ -380,89 +383,89 @@ is exported to CloudWatch. ## Supported services in discovery jobs The following is a list of AWS services that are supported in `cloudwatch_exporter` discovery jobs. When configuring a -discovery job, the `type` field of each `discovery_job` must match either the desired job namespace or alias. - -- Namespace: `CWAgent` or Alias: `cwagent` -- Namespace: `AWS/Usage` or Alias: `usage` -- Namespace: `AWS/CertificateManager` or Alias: `acm` -- Namespace: `AWS/ACMPrivateCA` or Alias: `acm-pca` -- Namespace: `AmazonMWAA` or Alias: `airflow` -- Namespace: `AWS/MWAA` or Alias: `mwaa` -- Namespace: `AWS/ApplicationELB` or Alias: `alb` -- Namespace: `AWS/AppStream` or Alias: `appstream` -- Namespace: `AWS/Backup` or Alias: `backup` -- Namespace: `AWS/ApiGateway` or Alias: `apigateway` -- Namespace: `AWS/AmazonMQ` or Alias: `mq` -- Namespace: `AWS/AppSync` or Alias: `appsync` -- Namespace: `AWS/Athena` or Alias: `athena` -- Namespace: `AWS/AutoScaling` or Alias: `asg` -- Namespace: `AWS/ElasticBeanstalk` or Alias: `beanstalk` -- Namespace: `AWS/Billing` or Alias: `billing` -- Namespace: `AWS/Cassandra` or Alias: `cassandra` -- Namespace: `AWS/CloudFront` or Alias: `cloudfront` -- Namespace: `AWS/Cognito` or Alias: `cognito-idp` -- Namespace: `AWS/DMS` or Alias: `dms` -- Namespace: `AWS/DDoSProtection` or Alias: `shield` -- Namespace: `AWS/DocDB` or Alias: `docdb` -- Namespace: `AWS/DX` or Alias: `dx` -- Namespace: `AWS/DynamoDB` or Alias: `dynamodb` -- Namespace: `AWS/EBS` or Alias: `ebs` -- Namespace: `AWS/ElastiCache` or Alias: `ec` -- Namespace: `AWS/MemoryDB` or Alias: `memorydb` -- Namespace: `AWS/EC2` or Alias: `ec2` -- Namespace: `AWS/EC2Spot` or Alias: `ec2Spot` -- Namespace: `AWS/ECS` or Alias: `ecs-svc` -- Namespace: `ECS/ContainerInsights` or Alias: `ecs-containerinsights` -- Namespace: `AWS/EFS` or Alias: `efs` -- Namespace: `AWS/ELB` or Alias: `elb` -- Namespace: `AWS/ElasticMapReduce` or Alias: `emr` -- Namespace: `AWS/EMRServerless` or Alias: `emr-serverless` -- Namespace: `AWS/ES` or Alias: `es` -- Namespace: `AWS/Firehose` or Alias: `firehose` -- Namespace: `AWS/FSx` or Alias: `fsx` -- Namespace: `AWS/GameLift` or Alias: `gamelift` -- Namespace: `AWS/GlobalAccelerator` or Alias: `ga` -- Namespace: `Glue` or Alias: `glue` -- Namespace: `AWS/IoT` or Alias: `iot` -- Namespace: `AWS/Kafka` or Alias: `kafka` -- Namespace: `AWS/KafkaConnect` or Alias: `kafkaconnect` -- Namespace: `AWS/Kinesis` or Alias: `kinesis` -- Namespace: `AWS/KinesisAnalytics` or Alias: `kinesis-analytics` -- Namespace: `AWS/Lambda` or Alias: `lambda` -- Namespace: `AWS/MediaConnect` or Alias: `mediaconnect` -- Namespace: `AWS/MediaConvert` or Alias: `mediaconvert` -- Namespace: `AWS/MediaLive` or Alias: `medialive` -- Namespace: `AWS/MediaTailor` or Alias: `mediatailor` -- Namespace: `AWS/Neptune` or Alias: `neptune` -- Namespace: `AWS/NetworkFirewall` or Alias: `nfw` -- Namespace: `AWS/NATGateway` or Alias: `ngw` -- Namespace: `AWS/NetworkELB` or Alias: `nlb` -- Namespace: `AWS/PrivateLinkEndpoints` or Alias: `vpc-endpoint` -- Namespace: `AWS/PrivateLinkServices` or Alias: `vpc-endpoint-service` -- Namespace: `AWS/Prometheus` or Alias: `amp` -- Namespace: `AWS/QLDB` or Alias: `qldb` -- Namespace: `AWS/RDS` or Alias: `rds` -- Namespace: `AWS/Redshift` or Alias: `redshift` -- Namespace: `AWS/Route53Resolver` or Alias: `route53-resolver` -- Namespace: `AWS/Route53` or Alias: `route53` -- Namespace: `AWS/S3` or Alias: `s3` -- Namespace: `AWS/SES` or Alias: `ses` -- Namespace: `AWS/States` or Alias: `sfn` -- Namespace: `AWS/SNS` or Alias: `sns` -- Namespace: `AWS/SQS` or Alias: `sqs` -- Namespace: `AWS/StorageGateway` or Alias: `storagegateway` -- Namespace: `AWS/TransitGateway` or Alias: `tgw` -- Namespace: `AWS/TrustedAdvisor` or Alias: `trustedadvisor` -- Namespace: `AWS/VPN` or Alias: `vpn` -- Namespace: `AWS/ClientVPN` or Alias: `clientvpn` -- Namespace: `AWS/WAFV2` or Alias: `wafv2` -- Namespace: `AWS/WorkSpaces` or Alias: `workspaces` -- Namespace: `AWS/AOSS` or Alias: `aoss` -- Namespace: `AWS/SageMaker` or Alias: `sagemaker` -- Namespace: `/aws/sagemaker/Endpoints` or Alias: `sagemaker-endpoints` -- Namespace: `/aws/sagemaker/TrainingJobs` or Alias: `sagemaker-training` -- Namespace: `/aws/sagemaker/ProcessingJobs` or Alias: `sagemaker-processing` -- Namespace: `/aws/sagemaker/TransformJobs` or Alias: `sagemaker-transform` -- Namespace: `/aws/sagemaker/InferenceRecommendationsJobs` or Alias: `sagemaker-inf-rec` -- Namespace: `AWS/Sagemaker/ModelBuildingPipeline` or Alias: `sagemaker-model-building-pipeline` +discovery job, the `type` field of each `discovery_job` must match the desired job namespace. + +- Namespace: `CWAgent` +- Namespace: `AWS/Usage` +- Namespace: `AWS/CertificateManager` +- Namespace: `AWS/ACMPrivateCA` +- Namespace: `AmazonMWAA` +- Namespace: `AWS/MWAA` +- Namespace: `AWS/ApplicationELB` +- Namespace: `AWS/AppStream` +- Namespace: `AWS/Backup` +- Namespace: `AWS/ApiGateway` +- Namespace: `AWS/AmazonMQ` +- Namespace: `AWS/AppSync` +- Namespace: `AWS/Athena` +- Namespace: `AWS/AutoScaling` +- Namespace: `AWS/ElasticBeanstalk` +- Namespace: `AWS/Billing` +- Namespace: `AWS/Cassandra` +- Namespace: `AWS/CloudFront` +- Namespace: `AWS/Cognito` +- Namespace: `AWS/DMS` +- Namespace: `AWS/DDoSProtection` +- Namespace: `AWS/DocDB` +- Namespace: `AWS/DX` +- Namespace: `AWS/DynamoDB` +- Namespace: `AWS/EBS` +- Namespace: `AWS/ElastiCache` +- Namespace: `AWS/MemoryDB` +- Namespace: `AWS/EC2` +- Namespace: `AWS/EC2Spot` +- Namespace: `AWS/ECS` +- Namespace: `ECS/ContainerInsights` +- Namespace: `AWS/EFS` +- Namespace: `AWS/ELB` +- Namespace: `AWS/ElasticMapReduce` +- Namespace: `AWS/EMRServerless` +- Namespace: `AWS/ES` +- Namespace: `AWS/Firehose` +- Namespace: `AWS/FSx` +- Namespace: `AWS/GameLift` +- Namespace: `AWS/GlobalAccelerator` +- Namespace: `Glue` +- Namespace: `AWS/IoT` +- Namespace: `AWS/Kafka` +- Namespace: `AWS/KafkaConnect` +- Namespace: `AWS/Kinesis` +- Namespace: `AWS/KinesisAnalytics` +- Namespace: `AWS/Lambda` +- Namespace: `AWS/MediaConnect` +- Namespace: `AWS/MediaConvert` +- Namespace: `AWS/MediaLive` +- Namespace: `AWS/MediaTailor` +- Namespace: `AWS/Neptune` +- Namespace: `AWS/NetworkFirewall` +- Namespace: `AWS/NATGateway` +- Namespace: `AWS/NetworkELB` +- Namespace: `AWS/PrivateLinkEndpoints` +- Namespace: `AWS/PrivateLinkServices` +- Namespace: `AWS/Prometheus` +- Namespace: `AWS/QLDB` +- Namespace: `AWS/RDS` +- Namespace: `AWS/Redshift` +- Namespace: `AWS/Route53Resolver` +- Namespace: `AWS/Route53` +- Namespace: `AWS/S3` +- Namespace: `AWS/SES` +- Namespace: `AWS/States` +- Namespace: `AWS/SNS` +- Namespace: `AWS/SQS` +- Namespace: `AWS/StorageGateway` +- Namespace: `AWS/TransitGateway` +- Namespace: `AWS/TrustedAdvisor` +- Namespace: `AWS/VPN` +- Namespace: `AWS/ClientVPN` +- Namespace: `AWS/WAFV2` +- Namespace: `AWS/WorkSpaces` +- Namespace: `AWS/AOSS` +- Namespace: `AWS/SageMaker` +- Namespace: `/aws/sagemaker/Endpoints` +- Namespace: `/aws/sagemaker/TrainingJobs` +- Namespace: `/aws/sagemaker/ProcessingJobs` +- Namespace: `/aws/sagemaker/TransformJobs` +- Namespace: `/aws/sagemaker/InferenceRecommendationsJobs` +- Namespace: `AWS/Sagemaker/ModelBuildingPipeline` diff --git a/go.mod b/go.mod index aa4750d6fb0c..8b739d178782 100644 --- a/go.mod +++ b/go.mod @@ -19,9 +19,9 @@ require ( github.com/PuerkitoBio/rehttp v1.3.0 github.com/alecthomas/kingpin/v2 v2.4.0 github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 - github.com/aws/aws-sdk-go v1.50.27 // indirect - github.com/aws/aws-sdk-go-v2 v1.25.2 - github.com/aws/aws-sdk-go-v2/config v1.27.4 + github.com/aws/aws-sdk-go v1.53.1 // indirect + github.com/aws/aws-sdk-go-v2 v1.26.1 + github.com/aws/aws-sdk-go-v2/config v1.27.13 github.com/aws/aws-sdk-go-v2/service/s3 v1.49.0 github.com/bmatcuk/doublestar v1.3.4 github.com/burningalchemist/sql_exporter v0.0.0-20240103092044-466b38b6abc4 @@ -96,7 +96,7 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f github.com/ncabatoff/process-exporter v0.7.10 - github.com/nerdswords/yet-another-cloudwatch-exporter v0.55.0 + github.com/nerdswords/yet-another-cloudwatch-exporter v0.60.0 github.com/ohler55/ojg v1.20.1 // indirect github.com/oklog/run v1.1.0 github.com/olekukonko/tablewriter v0.0.5 @@ -145,7 +145,7 @@ require ( github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.66.0 github.com/prometheus-operator/prometheus-operator/pkg/client v0.66.0 github.com/prometheus/blackbox_exporter v0.24.1-0.20230623125439-bd22efa1c900 - github.com/prometheus/client_golang v1.19.0 + github.com/prometheus/client_golang v1.19.1 github.com/prometheus/client_model v0.6.1 github.com/prometheus/common v0.53.0 github.com/prometheus/consul_exporter v0.8.0 @@ -283,21 +283,21 @@ require ( github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/avvmoto/buf-readerat v0.0.0-20171115124131-a17c8cb89270 // indirect github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.0 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.17.4 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.2 + github.com/aws/aws-sdk-go-v2/credentials v1.17.13 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.0 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.2 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.2 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 // indirect github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.0 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.20.1 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.28.1 // indirect - github.com/aws/smithy-go v1.20.1 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.20.6 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.0 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.28.7 // indirect + github.com/aws/smithy-go v1.20.2 // indirect github.com/beevik/ntp v1.3.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 @@ -573,7 +573,7 @@ require ( go.opentelemetry.io/otel/bridge/opencensus v1.24.0 // indirect go4.org/netipx v0.0.0-20230125063823-8449b0a6169f // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/sync v0.6.0 // indirect + golang.org/x/sync v0.7.0 // indirect golang.org/x/term v0.19.0 // indirect golang.org/x/tools v0.17.0 golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect @@ -629,16 +629,17 @@ require ( github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.21.0 // indirect github.com/Showmax/go-fqdn v1.0.0 // indirect github.com/Workiva/go-datastructures v1.1.0 // indirect - github.com/aws/aws-sdk-go-v2/service/amp v1.23.0 // indirect - github.com/aws/aws-sdk-go-v2/service/apigateway v1.22.0 // indirect - github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.19.0 // indirect - github.com/aws/aws-sdk-go-v2/service/autoscaling v1.38.0 // indirect - github.com/aws/aws-sdk-go-v2/service/databasemigrationservice v1.36.0 // indirect - github.com/aws/aws-sdk-go-v2/service/ec2 v1.147.0 // indirect - github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.20.0 // indirect + github.com/aws/aws-sdk-go-v2/service/amp v1.25.5 // indirect + github.com/aws/aws-sdk-go-v2/service/apigateway v1.23.7 // indirect + github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.20.5 // indirect + github.com/aws/aws-sdk-go-v2/service/autoscaling v1.40.6 // indirect + github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.38.1 // indirect + github.com/aws/aws-sdk-go-v2/service/databasemigrationservice v1.38.5 // indirect + github.com/aws/aws-sdk-go-v2/service/ec2 v1.161.1 // indirect + github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.21.5 // indirect github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.27.0 // indirect - github.com/aws/aws-sdk-go-v2/service/shield v1.24.0 // indirect - github.com/aws/aws-sdk-go-v2/service/storagegateway v1.26.0 // indirect + github.com/aws/aws-sdk-go-v2/service/shield v1.25.5 // indirect + github.com/aws/aws-sdk-go-v2/service/storagegateway v1.27.5 // indirect github.com/axiomhq/hyperloglog v0.0.0-20240124082744-24bca3a5b39b // indirect github.com/channelmeter/iso8601duration v0.0.0-20150204201828-8da3af7a2a61 // indirect github.com/cloudflare/circl v1.3.7 // indirect diff --git a/go.sum b/go.sum index 16547bbd5f45..84392aafa97d 100644 --- a/go.sum +++ b/go.sum @@ -308,77 +308,79 @@ github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/aws/aws-sdk-go v1.30.27/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go v1.34.34/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= -github.com/aws/aws-sdk-go v1.50.27 h1:96ifhrSuja+AzdP3W/T2337igqVQ2FcSIJYkk+0rCeA= -github.com/aws/aws-sdk-go v1.50.27/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.53.1 h1:15/i0m9rE8r1q3P4ooHCfZTJtkxwG2Dwqp9JhPaVbs0= +github.com/aws/aws-sdk-go v1.53.1/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/aws/aws-sdk-go-v2 v1.9.2/go.mod h1:cK/D0BBs0b/oWPIcX/Z/obahJK1TT7IPVjy53i/mX/4= -github.com/aws/aws-sdk-go-v2 v1.25.2 h1:/uiG1avJRgLGiQM9X3qJM8+Qa6KRGK5rRPuXE0HUM+w= -github.com/aws/aws-sdk-go-v2 v1.25.2/go.mod h1:Evoc5AsmtveRt1komDwIsjHFyrP5tDuF1D1U+6z6pNo= +github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= +github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.0 h1:2UO6/nT1lCZq1LqM67Oa4tdgP1CvL1sLSxvuD+VrOeE= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.0/go.mod h1:5zGj2eA85ClyedTDK+Whsu+w9yimnVIZvhvBKrDquM8= github.com/aws/aws-sdk-go-v2/config v1.8.3/go.mod h1:4AEiLtAb8kLs7vgw2ZV3p2VZ1+hBavOc84hqxVNpCyw= -github.com/aws/aws-sdk-go-v2/config v1.27.4 h1:AhfWb5ZwimdsYTgP7Od8E9L1u4sKmDW2ZVeLcf2O42M= -github.com/aws/aws-sdk-go-v2/config v1.27.4/go.mod h1:zq2FFXK3A416kiukwpsd+rD4ny6JC7QSkp4QdN1Mp2g= +github.com/aws/aws-sdk-go-v2/config v1.27.13 h1:WbKW8hOzrWoOA/+35S5okqO/2Ap8hkkFUzoW8Hzq24A= +github.com/aws/aws-sdk-go-v2/config v1.27.13/go.mod h1:XLiyiTMnguytjRER7u5RIkhIqS8Nyz41SwAWb4xEjxs= github.com/aws/aws-sdk-go-v2/credentials v1.4.3/go.mod h1:FNNC6nQZQUuyhq5aE5c7ata8o9e4ECGmS4lAXC7o1mQ= -github.com/aws/aws-sdk-go-v2/credentials v1.17.4 h1:h5Vztbd8qLppiPwX+y0Q6WiwMZgpd9keKe2EAENgAuI= -github.com/aws/aws-sdk-go-v2/credentials v1.17.4/go.mod h1:+30tpwrkOgvkJL1rUZuRLoxcJwtI/OkeBLYnHxJtVe0= +github.com/aws/aws-sdk-go-v2/credentials v1.17.13 h1:XDCJDzk/u5cN7Aple7D/MiAhx1Rjo/0nueJ0La8mRuE= +github.com/aws/aws-sdk-go-v2/credentials v1.17.13/go.mod h1:FMNcjQrmuBYvOTZDtOLCIu0esmxjF7RuA/89iSXWzQI= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.6.0/go.mod h1:gqlclDEZp4aqJOancXK6TN24aKhT0W0Ae9MHk3wzTMM= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.2 h1:AK0J8iYBFeUk2Ax7O8YpLtFsfhdOByh2QIkHmigpRYk= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.2/go.mod h1:iRlGzMix0SExQEviAyptRWRGdYNo3+ufW/lCzvKVTUc= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 h1:FVJ0r5XTHSmIHJV6KuDmdYhEpvlHpiSd38RQWhut5J4= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1/go.mod h1:zusuAeqezXzAB24LGuzuekqMAEgWkVYukBec3kr3jUg= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.0 h1:FHVyVIJpOeQZCnYj9EVKTWahb4WDNFEUOKCx/dOUPcM= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.16.0/go.mod h1:SL/aJzGL0LsQPQ1y2HMNbJGrm/Xh6aVCGq6ki+DLGEw= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.2 h1:bNo4LagzUKbjdxE0tIcR9pMzLR2U/Tgie1Hq1HQ3iH8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.2/go.mod h1:wRQv0nN6v9wDXuWThpovGQjqF1HFdcgWjporw14lS8k= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.2 h1:EtOU5jsPdIQNP+6Q2C5e3d65NKT1PeCiQk+9OdzO12Q= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.2/go.mod h1:tyF5sKccmDz0Bv4NrstEr+/9YkSPJHrcO7UsUKf7pWM= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 h1:aw39xVGeRWlWx9EzGVnhOR4yOjQDHPQ6o6NmBlscyQg= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5/go.mod h1:FSaRudD0dXiMPK2UjknVwwTYyZMRsHv3TtkabsZih5I= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 h1:PG1F3OD1szkuQPzDw3CIQsRIrtTlUC3lP84taWzHlq0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5/go.mod h1:jU1li6RFryMz+so64PpKtudI+QzbKoIEivqdf6LNpOc= github.com/aws/aws-sdk-go-v2/internal/ini v1.2.4/go.mod h1:ZcBrrI3zBKlhGFNYWvju0I3TR93I7YIgAfy82Fh4lcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.0 h1:TkbRExyKSVHELwG9gz2+gql37jjec2R5vus9faTomwE= github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.0/go.mod h1:T3/9xMKudHhnj8it5EqIrhvv11tVZqWYkKcot+BFStc= -github.com/aws/aws-sdk-go-v2/service/amp v1.23.0 h1:0IFTr+pWEM8oWolq1vA1jpOGuVvPWOw0utGrPUm9o5Y= -github.com/aws/aws-sdk-go-v2/service/amp v1.23.0/go.mod h1:cPs18mk/ugaOJp6e6hzCz7eiSh2FLiXPnogG1X54SNk= -github.com/aws/aws-sdk-go-v2/service/apigateway v1.22.0 h1:yBey9hYxLATbDZFkq8gfKkuvr/QlomYyjdmuBbZHgG4= -github.com/aws/aws-sdk-go-v2/service/apigateway v1.22.0/go.mod h1:KAvx9CsNxGYMxCdqZsOUSfdRPEvAsWvs+3R0CWEkpio= -github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.19.0 h1:GvNzvBWD3vyCOgyVvqK9E8Jz4LWC7ENmyE5m7apGMsU= -github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.19.0/go.mod h1:sfDv1ZbBmaIDzCOVgx1eofJ3Wj79dkipyUOyivbu0Ag= +github.com/aws/aws-sdk-go-v2/service/amp v1.25.5 h1:OV/xhdkvG4rY7lcEBPS9pPbT83ezxXE+gM9nVA1OHWU= +github.com/aws/aws-sdk-go-v2/service/amp v1.25.5/go.mod h1:i5BA2ACkXa8Pzqinz/xEukdVJnMdfQLRcx7ftb5g0pk= +github.com/aws/aws-sdk-go-v2/service/apigateway v1.23.7 h1:VOV21NHMzI0OgywTq2iY9UnXIpH4j4s3pa4ensk8Hh8= +github.com/aws/aws-sdk-go-v2/service/apigateway v1.23.7/go.mod h1:3h9BDpayKgNNrpHZBvL7gCIeikqiE7oBxGGcrzmtLAM= +github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.20.5 h1:nk9qRsqcLik5FycE6+y16Xj46oCnoMc0Gp8Q2RHOCpg= +github.com/aws/aws-sdk-go-v2/service/apigatewayv2 v1.20.5/go.mod h1:PkfhkgYj7XKPO/kGyF7s4DC5ZVrxfHoWDD+rrxobLMg= github.com/aws/aws-sdk-go-v2/service/appconfig v1.4.2/go.mod h1:FZ3HkCe+b10uFZZkFdvf98LHW21k49W8o8J366lqVKY= -github.com/aws/aws-sdk-go-v2/service/autoscaling v1.38.0 h1:BnElrrgowaG50hoUCbBc5lq5XX7Fr7F4nvZovCDjevk= -github.com/aws/aws-sdk-go-v2/service/autoscaling v1.38.0/go.mod h1:6ioQn0JPZSvTdXmnUAQa9h7x8m+KU63rkgiAD1ZLnqc= -github.com/aws/aws-sdk-go-v2/service/databasemigrationservice v1.36.0 h1:aQD36/NeII5cKl5tDgGgFRIIVCVofPsYQ/tYJnlVkqY= -github.com/aws/aws-sdk-go-v2/service/databasemigrationservice v1.36.0/go.mod h1:EF/UkL+0uEqcqr0sKFJJIT3Jbcxgt2oWz9R0vaLNSVU= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.147.0 h1:m9+QgPg/qzlxL0Oxb/dD12jzeWfuQGn9XqCWyDAipi8= -github.com/aws/aws-sdk-go-v2/service/ec2 v1.147.0/go.mod h1:ntWksNNQcXImRQMdxab74tp+H94neF/TwQJ9Ndxb04k= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 h1:EyBZibRTVAs6ECHZOw5/wlylS9OcTzwyjeQMudmREjE= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1/go.mod h1:JKpmtYhhPs7D97NL/ltqz7yCkERFW5dOlHyVl66ZYF8= +github.com/aws/aws-sdk-go-v2/service/autoscaling v1.40.6 h1:IDoEdCkKRy7iPlRVSuDATGE57xUjrk5i1M9eWPYwr/Y= +github.com/aws/aws-sdk-go-v2/service/autoscaling v1.40.6/go.mod h1:ZErgk/bPaaZIpj+lUWGlwI1A0UFhSIscgnCPzTLnb2s= +github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.38.1 h1:Lrq1Tuj+tA569WQzuESkm/rUfhIQMmNoZW6rRuZVHVI= +github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.38.1/go.mod h1:U12sr6Lt14X96f16t+rR52+2BdqtydwN7DjEEHRMjO0= +github.com/aws/aws-sdk-go-v2/service/databasemigrationservice v1.38.5 h1:V97n9sqRIMhQP4GuB3xOBOTsg/41uLo3jyewvHSjxwE= +github.com/aws/aws-sdk-go-v2/service/databasemigrationservice v1.38.5/go.mod h1:hTZS15Gghi40UxU03Cv09Qr2tXgoQrZOSGY6oaNUNAg= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.161.1 h1:NbjXshriDs5bGeqKvrOF70L41X0aCMC60ImN2vkcQAc= +github.com/aws/aws-sdk-go-v2/service/ec2 v1.161.1/go.mod h1:xejKuuRDjz6z5OqyeLsz01MlOqqW7CqpAB4PabNvpu8= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2/go.mod h1:5CsjAbs3NlGQyZNFACh+zztPDI7fU6eW9QsxjfnuBKg= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.0 h1:UiSyK6ent6OKpkMJN3+k5HZ4sk4UfchEaaW5wv7SblQ= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.0/go.mod h1:l7kzl8n8DXoRyFz5cIMG70HnPauWa649TUhgw8Rq6lo= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.3.2/go.mod h1:72HRZDLMtmVQiLG2tLfQcaWLCssELvGl+Zf2WVxMmR8= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.2 h1:5ffmXjPtwRExp1zc7gENLgCPyHFbhEPwVTkTiH9niSk= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.2/go.mod h1:Ru7vg1iQ7cR4i7SZ/JTLYN9kaXtbL69UdgG0OQWQxW0= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 h1:ogRAwT1/gxJBcSWDMZlgyFUM962F51A5CRhDLbxLdmo= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7/go.mod h1:YCsIZhXfRPLFFCl5xxY+1T9RKzOKjCut+28JSX2DnAk= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.0 h1:l5puwOHr7IxECuPMIuZG7UKOzAnF24v6t4l+Z5Moay4= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.0/go.mod h1:Oov79flWa/n7Ni+lQC3z+VM7PoRM47omRqbJU9B5Y7E= -github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.20.0 h1:MaTOKZEPC2ANMAKzZgXbBC7OCD3BTv/BKk1dH7dKA6o= -github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.20.0/go.mod h1:BRuiq4shgrokCvNWSXVHz1hhH5sNSLW0ZruTV0jiNMQ= +github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.21.5 h1:GR0vFRc5TpN36ppQJjd+gjRRC9vMAHN5C2W53oMWCJU= +github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.21.5/go.mod h1:FWw+Jnx+SlpsrU/NQ/f7f+1RdixTApZiU2o9FOubiDQ= github.com/aws/aws-sdk-go-v2/service/s3 v1.49.0 h1:VfU15izXQjz4m9y1DkbY79iylIiuPwWtrram4cSpWEI= github.com/aws/aws-sdk-go-v2/service/s3 v1.49.0/go.mod h1:1o/W6JFUuREj2ExoQ21vHJgO7wakvjhol91M9eknFgs= github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.27.0 h1:64jRTsqBcIqlA4N7ZFYy+ysGPE7Rz/nJgU2fwv2cymk= github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.27.0/go.mod h1:JsJDZFHwLGZu6dxhV9EV1gJrMnCeE4GEXubSZA59xdA= -github.com/aws/aws-sdk-go-v2/service/shield v1.24.0 h1:DasZw37v6ciRecoPkslCl8rHmoPfzfwpnR48pxWJaGg= -github.com/aws/aws-sdk-go-v2/service/shield v1.24.0/go.mod h1:sq11Jfbf0XW0SoJ4esedM4kCsBPmjzakxfpvG1Z+pgs= +github.com/aws/aws-sdk-go-v2/service/shield v1.25.5 h1:4fTqvsBpHhPA9ngalsvdLPRir22WQNhFDFmeGSKchQQ= +github.com/aws/aws-sdk-go-v2/service/shield v1.25.5/go.mod h1:KizNr+ORjXFVELwvx3ubt49LMeTeBXm9EbhUcDXvHa8= github.com/aws/aws-sdk-go-v2/service/sso v1.4.2/go.mod h1:NBvT9R1MEF+Ud6ApJKM0G+IkPchKS7p7c2YPKwHmBOk= -github.com/aws/aws-sdk-go-v2/service/sso v1.20.1 h1:utEGkfdQ4L6YW/ietH7111ZYglLJvS+sLriHJ1NBJEQ= -github.com/aws/aws-sdk-go-v2/service/sso v1.20.1/go.mod h1:RsYqzYr2F2oPDdpy+PdhephuZxTfjHQe7SOBcZGoAU8= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.1 h1:9/GylMS45hGGFCcMrUZDVayQE1jYSIN6da9jo7RAYIw= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.1/go.mod h1:YjAPFn4kGFqKC54VsHs5fn5B6d+PCY2tziEa3U/GB5Y= -github.com/aws/aws-sdk-go-v2/service/storagegateway v1.26.0 h1:mUZTy6ckniofJCEiHSISSX7CuioLWHvGyiEIC0ZqxWQ= -github.com/aws/aws-sdk-go-v2/service/storagegateway v1.26.0/go.mod h1:vs7VbPSVlTiuEHVruOY+zqOJLmaW0lcJDj0lzFHuvZs= +github.com/aws/aws-sdk-go-v2/service/sso v1.20.6 h1:o5cTaeunSpfXiLTIBx5xo2enQmiChtu1IBbzXnfU9Hs= +github.com/aws/aws-sdk-go-v2/service/sso v1.20.6/go.mod h1:qGzynb/msuZIE8I75DVRCUXw3o3ZyBmUvMwQ2t/BrGM= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.0 h1:Qe0r0lVURDDeBQJ4yP+BOrJkvkiCo/3FH/t+wY11dmw= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.0/go.mod h1:mUYPBhaF2lGiukDEjJX2BLRRKTmoUSitGDUgM4tRxak= +github.com/aws/aws-sdk-go-v2/service/storagegateway v1.27.5 h1:5t0w6FzW65K9nX+7YEKPLvsuOSOMl9HkJ01rG5VXsmQ= +github.com/aws/aws-sdk-go-v2/service/storagegateway v1.27.5/go.mod h1:gCrKxQ0omX8dIo7jQbXW5typwg8Z4rdVXYndHVoJ4XM= github.com/aws/aws-sdk-go-v2/service/sts v1.7.2/go.mod h1:8EzeIqfWt2wWT4rJVu3f21TfrhJ8AEMzVybRNSb/b4g= -github.com/aws/aws-sdk-go-v2/service/sts v1.28.1 h1:3I2cBEYgKhrWlwyZgfpSO2BpaMY1LHPqXYk/QGlu2ew= -github.com/aws/aws-sdk-go-v2/service/sts v1.28.1/go.mod h1:uQ7YYKZt3adCRrdCBREm1CD3efFLOUNH77MrUCvx5oA= +github.com/aws/aws-sdk-go-v2/service/sts v1.28.7 h1:et3Ta53gotFR4ERLXXHIHl/Uuk1qYpP5uU7cvNql8ns= +github.com/aws/aws-sdk-go-v2/service/sts v1.28.7/go.mod h1:FZf1/nKNEkHdGGJP/cI2MoIMquumuRK6ol3QQJNDxmw= github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= -github.com/aws/smithy-go v1.20.1 h1:4SZlSlMr36UEqC7XOyRVb27XMeZubNcBNN+9IgEPIQw= -github.com/aws/smithy-go v1.20.1/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= +github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= +github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/axiomhq/hyperloglog v0.0.0-20240124082744-24bca3a5b39b h1:F3yMzKumBUQ6Fn0sYI1YQ16vQRucpZOfBQ9HXWl5+XI= github.com/axiomhq/hyperloglog v0.0.0-20240124082744-24bca3a5b39b/go.mod h1:k08r+Yj1PRAmuayFiRK6MYuR5Ve4IuZtTfxErMIh0+c= github.com/aybabtme/iocontrol v0.0.0-20150809002002-ad15bcfc95a0 h1:0NmehRCgyk5rljDQLKUO+cRJCnduDyn11+zGZIc9Z48= @@ -1656,8 +1658,8 @@ github.com/ncabatoff/go-seq v0.0.0-20180805175032-b08ef85ed833 h1:t4WWQ9I797y7QU github.com/ncabatoff/go-seq v0.0.0-20180805175032-b08ef85ed833/go.mod h1:0CznHmXSjMEqs5Tezj/w2emQoM41wzYM9KpDKUHPYag= github.com/ncabatoff/process-exporter v0.7.10 h1:+Ere7+3se6QqP54gg7aBRagWcL8bq3u5zNi/GRSWeKQ= github.com/ncabatoff/process-exporter v0.7.10/go.mod h1:DHZRZjqxw9LCOpLlX0DjBuyn6d5plh41Jv6Tmttj7Ek= -github.com/nerdswords/yet-another-cloudwatch-exporter v0.55.0 h1:M3fH9gzU48jBfYbXXYEZVTcUhnfhDIG/oeIQl6kBGP0= -github.com/nerdswords/yet-another-cloudwatch-exporter v0.55.0/go.mod h1:GR4pDHlRonT97AsGSmlcWiISF8AjifK/19SAVD0tIlU= +github.com/nerdswords/yet-another-cloudwatch-exporter v0.60.0 h1:+027WNpx6sqn1kuhl4fPPz65TaF7kzG9ymAOJlasZjg= +github.com/nerdswords/yet-another-cloudwatch-exporter v0.60.0/go.mod h1:EXA9yqANHYmkbpe9a41X7iFJbK8/WNhp+Ph/+5DvZo4= github.com/newrelic/newrelic-telemetry-sdk-go v0.2.0/go.mod h1:G9MqE/cHGv3Hx3qpYhfuyFUsGx2DpVcGi1iJIqTg+JQ= github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2 h1:BQ1HW7hr4IVovMwWg0E0PYcyW8CzqDcVmaew9cujU4s= github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2/go.mod h1:TLb2Sg7HQcgGdloNxkrmtgDNR9uVYF3lfdFIN4Ro6Sk= @@ -1925,8 +1927,8 @@ github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= -github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= +github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= +github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= @@ -2641,8 +2643,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/internal/component/prometheus/exporter/cloudwatch/cloudwatch.go b/internal/component/prometheus/exporter/cloudwatch/cloudwatch.go index b727cab0a581..6d98ded7b365 100644 --- a/internal/component/prometheus/exporter/cloudwatch/cloudwatch.go +++ b/internal/component/prometheus/exporter/cloudwatch/cloudwatch.go @@ -31,8 +31,10 @@ func createExporter(opts component.Options, args component.Arguments, defaultIns fipsEnabled := !a.FIPSDisabled if a.DecoupledScrape.Enabled { - return cloudwatch_exporter.NewDecoupledCloudwatchExporter(opts.ID, opts.Logger, exporterConfig, a.DecoupledScrape.ScrapeInterval, fipsEnabled, a.Debug), getHash(a), nil + exp, err := cloudwatch_exporter.NewDecoupledCloudwatchExporter(opts.ID, opts.Logger, exporterConfig, a.DecoupledScrape.ScrapeInterval, fipsEnabled, a.Debug, a.UseAWSSDKVersion2) + return exp, getHash(a), err } - return cloudwatch_exporter.NewCloudwatchExporter(opts.ID, opts.Logger, exporterConfig, fipsEnabled, a.Debug), getHash(a), nil + exp, err := cloudwatch_exporter.NewCloudwatchExporter(opts.ID, opts.Logger, exporterConfig, fipsEnabled, a.Debug, a.UseAWSSDKVersion2) + return exp, getHash(a), err } diff --git a/internal/component/prometheus/exporter/cloudwatch/config.go b/internal/component/prometheus/exporter/cloudwatch/config.go index 1f5eecbd684c..bb0c0837aeb7 100644 --- a/internal/component/prometheus/exporter/cloudwatch/config.go +++ b/internal/component/prometheus/exporter/cloudwatch/config.go @@ -5,10 +5,12 @@ import ( "encoding/hex" "time" - "github.com/grafana/agent/static/integrations/cloudwatch_exporter" "github.com/grafana/river" yaceConf "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/config" + "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/logging" yaceModel "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model" + + "github.com/grafana/agent/static/integrations/cloudwatch_exporter" ) // Since we are gathering metrics from CloudWatch and writing them in prometheus during each scrape, the timestamp @@ -26,6 +28,7 @@ var defaults = Arguments{ Enabled: false, ScrapeInterval: 5 * time.Minute, }, + UseAWSSDKVersion2: false, } // Arguments are the river based options to configure the embedded CloudWatch exporter. @@ -37,6 +40,7 @@ type Arguments struct { Discovery []DiscoveryJob `river:"discovery,block,optional"` Static []StaticJob `river:"static,block,optional"` DecoupledScrape DecoupledScrapeConfig `river:"decoupled_scraping,block,optional"` + UseAWSSDKVersion2 bool `river:"aws_sdk_version_v2,attr,optional"` } // DecoupledScrapeConfig is the configuration for decoupled scraping feature. @@ -106,7 +110,7 @@ func (a *Arguments) SetToDefault() { // ConvertToYACE converts the river config into YACE config model. Note that the conversion is // not direct, some values have been opinionated to simplify the config model the agent exposes // for this integration. -func ConvertToYACE(a Arguments) (yaceConf.ScrapeConf, error) { +func ConvertToYACE(a Arguments) (yaceModel.JobsConfig, error) { var discoveryJobs []*yaceConf.Job for _, job := range a.Discovery { discoveryJobs = append(discoveryJobs, toYACEDiscoveryJob(job)) @@ -119,7 +123,7 @@ func ConvertToYACE(a Arguments) (yaceConf.ScrapeConf, error) { APIVersion: "v1alpha1", StsRegion: a.STSRegion, Discovery: yaceConf.Discovery{ - ExportedTagsOnMetrics: yaceModel.ExportedTagsOnMetrics(a.DiscoveryExportedTags), + ExportedTagsOnMetrics: yaceConf.ExportedTagsOnMetrics(a.DiscoveryExportedTags), Jobs: discoveryJobs, }, Static: staticJobs, @@ -127,18 +131,19 @@ func ConvertToYACE(a Arguments) (yaceConf.ScrapeConf, error) { // Run the exporter's config validation. Between other things, it will check that the service for which a discovery // job is instantiated, it's supported. - if err := conf.Validate(); err != nil { - return yaceConf.ScrapeConf{}, err + modelConf, err := conf.Validate(logging.NewNopLogger()) + if err != nil { + return yaceModel.JobsConfig{}, err } - cloudwatch_exporter.PatchYACEDefaults(&conf) + cloudwatch_exporter.PatchYACEDefaults(&modelConf) - return conf, nil + return modelConf, nil } -func (tags Tags) toYACE() []yaceModel.Tag { - yaceTags := []yaceModel.Tag{} +func (tags Tags) toYACE() []yaceConf.Tag { + yaceTags := []yaceConf.Tag{} for key, value := range tags { - yaceTags = append(yaceTags, yaceModel.Tag{Key: key, Value: value}) + yaceTags = append(yaceTags, yaceConf.Tag{Key: key, Value: value}) } return yaceTags } diff --git a/internal/component/prometheus/exporter/cloudwatch/config_test.go b/internal/component/prometheus/exporter/cloudwatch/config_test.go index 37ad2ce01ec5..873ec84a641f 100644 --- a/internal/component/prometheus/exporter/cloudwatch/config_test.go +++ b/internal/component/prometheus/exporter/cloudwatch/config_test.go @@ -3,8 +3,8 @@ package cloudwatch import ( "testing" + "github.com/grafana/regexp" "github.com/grafana/river" - yaceConf "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/config" yaceModel "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model" "github.com/stretchr/testify/require" ) @@ -54,9 +54,9 @@ static "super_ec2_instance_id" { const discoveryJobConfig = ` sts_region = "us-east-2" debug = true -discovery_exported_tags = { "ec2" = ["name"] } +discovery_exported_tags = { "AWS/SQS" = ["name"] } discovery { - type = "sqs" + type = "AWS/SQS" regions = ["us-east-2"] search_tags = { "scrape" = "true", @@ -88,7 +88,7 @@ discovery { // the configuration below overrides the length discovery { - type = "s3" + type = "AWS/S3" regions = ["us-east-1"] role { role_arn = "arn:aws:iam::878167871295:role/yace_testing" @@ -144,9 +144,9 @@ static "super_ec2_instance_id" { const discoveryJobNilToZeroConfig = ` sts_region = "us-east-2" debug = true -discovery_exported_tags = { "ec2" = ["name"] } +discovery_exported_tags = { "AWS/SQS" = ["name"] } discovery { - type = "sqs" + type = "AWS/SQS" regions = ["us-east-2"] search_tags = { "scrape" = "true", @@ -171,7 +171,7 @@ discovery { func TestCloudwatchComponentConfig(t *testing.T) { type testcase struct { raw string - expected yaceConf.ScrapeConf + expected yaceModel.JobsConfig expectUnmarshallErr bool expectConvertErr bool } @@ -191,33 +191,31 @@ func TestCloudwatchComponentConfig(t *testing.T) { }, "single static job config": { raw: singleStaticJobConfig, - expected: yaceConf.ScrapeConf{ - APIVersion: "v1alpha1", - StsRegion: "us-east-2", - Discovery: yaceConf.Discovery{}, - Static: []*yaceConf.Static{ + expected: yaceModel.JobsConfig{ + StsRegion: "us-east-2", + StaticJobs: []yaceModel.StaticJob{ { Name: "super_ec2_instance_id", // assert an empty role is used as default. IMPORTANT since this // is what YACE looks for delegating to the environment role - Roles: []yaceConf.Role{{}}, + Roles: []yaceModel.Role{{}}, Regions: []string{"us-east-2"}, Namespace: "AWS/EC2", CustomTags: []yaceModel.Tag{}, - Dimensions: []yaceConf.Dimension{ + Dimensions: []yaceModel.Dimension{ { Name: "InstanceId", Value: "i01u29u12ue1u2c", }, }, - Metrics: []*yaceConf.Metric{{ + Metrics: []*yaceModel.MetricConfig{{ Name: "CPUUsage", Statistics: []string{"Sum", "Average"}, Period: 60, Length: 60, Delay: 0, - NilToZero: &defaultNilToZero, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, + NilToZero: defaultNilToZero, + AddCloudwatchTimestamp: addCloudwatchTimestamp, }}, }, }, @@ -225,108 +223,127 @@ func TestCloudwatchComponentConfig(t *testing.T) { }, "single discovery job config": { raw: discoveryJobConfig, - expected: yaceConf.ScrapeConf{ - APIVersion: "v1alpha1", - StsRegion: "us-east-2", - Discovery: yaceConf.Discovery{ - ExportedTagsOnMetrics: yaceModel.ExportedTagsOnMetrics{ - "ec2": []string{"name"}, - }, - Jobs: []*yaceConf.Job{ - { - Regions: []string{"us-east-2"}, - // assert an empty role is used as default. IMPORTANT since this - // is what YACE looks for delegating to the environment role - Roles: []yaceConf.Role{{}}, - Type: "sqs", - SearchTags: []yaceModel.Tag{{ - Key: "scrape", Value: "true", - }}, - CustomTags: []yaceModel.Tag{}, - Metrics: []*yaceConf.Metric{ - { - Name: "NumberOfMessagesSent", - Statistics: []string{"Sum", "Average"}, - Period: 60, - Length: 60, - Delay: 0, - NilToZero: &defaultNilToZero, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, - }, - { - Name: "NumberOfMessagesReceived", - Statistics: []string{"Sum", "Average"}, - Period: 60, - Length: 60, - Delay: 0, - NilToZero: &defaultNilToZero, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, - }, + expected: yaceModel.JobsConfig{ + StsRegion: "us-east-2", + DiscoveryJobs: []yaceModel.DiscoveryJob{ + { + Regions: []string{"us-east-2"}, + // assert an empty role is used as default. IMPORTANT since this + // is what YACE looks for delegating to the environment role + Roles: []yaceModel.Role{{}}, + Type: "AWS/SQS", + SearchTags: []yaceModel.SearchTag{{ + Key: "scrape", Value: regexp.MustCompile("true"), + }}, + CustomTags: []yaceModel.Tag{}, + Metrics: []*yaceModel.MetricConfig{ + { + Name: "NumberOfMessagesSent", + Statistics: []string{"Sum", "Average"}, + Period: 60, + Length: 60, + Delay: 0, + NilToZero: defaultNilToZero, + AddCloudwatchTimestamp: addCloudwatchTimestamp, }, - RoundingPeriod: nil, - JobLevelMetricFields: yaceConf.JobLevelMetricFields{ - Period: 0, - Length: 0, + { + Name: "NumberOfMessagesReceived", + Statistics: []string{"Sum", "Average"}, + Period: 60, + Length: 60, Delay: 0, - AddCloudwatchTimestamp: &falsePtr, - NilToZero: &defaultNilToZero, + NilToZero: defaultNilToZero, + AddCloudwatchTimestamp: addCloudwatchTimestamp, }, }, - { - Regions: []string{"us-east-1"}, - Roles: []yaceConf.Role{{ - RoleArn: "arn:aws:iam::878167871295:role/yace_testing", - }}, - Type: "AWS/ECS", - SearchTags: []yaceModel.Tag{}, - CustomTags: []yaceModel.Tag{}, - Metrics: []*yaceConf.Metric{ - { - Name: "CPUUtilization", - Statistics: []string{"Sum", "Maximum"}, - Period: 60, - Length: 60, - Delay: 0, - NilToZero: &defaultNilToZero, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, - }, + RoundingPeriod: nil, + JobLevelMetricFields: yaceModel.JobLevelMetricFields{ + Period: 0, + Length: 0, + Delay: 0, + AddCloudwatchTimestamp: &falsePtr, + NilToZero: &defaultNilToZero, + }, + ExportedTagsOnMetrics: []string{"name"}, + DimensionsRegexps: []yaceModel.DimensionsRegexp{ + { + Regexp: regexp.MustCompile("(?P[^:]+)$"), + DimensionsNames: []string{"QueueName"}, }, - RoundingPeriod: nil, - JobLevelMetricFields: yaceConf.JobLevelMetricFields{ - Period: 0, - Length: 0, + }, + }, + { + Regions: []string{"us-east-1"}, + Roles: []yaceModel.Role{{ + RoleArn: "arn:aws:iam::878167871295:role/yace_testing", + }}, + Type: "AWS/ECS", + SearchTags: []yaceModel.SearchTag{}, + CustomTags: []yaceModel.Tag{}, + Metrics: []*yaceModel.MetricConfig{ + { + Name: "CPUUtilization", + Statistics: []string{"Sum", "Maximum"}, + Period: 60, + Length: 60, Delay: 0, - AddCloudwatchTimestamp: &falsePtr, - NilToZero: &defaultNilToZero, + NilToZero: defaultNilToZero, + AddCloudwatchTimestamp: addCloudwatchTimestamp, }, }, - { - Regions: []string{"us-east-1"}, - Roles: []yaceConf.Role{{ - RoleArn: "arn:aws:iam::878167871295:role/yace_testing", - }}, - Type: "s3", - SearchTags: []yaceModel.Tag{}, - CustomTags: []yaceModel.Tag{}, - DimensionNameRequirements: []string{"BucketName"}, - Metrics: []*yaceConf.Metric{ - { - Name: "BucketSizeBytes", - Statistics: []string{"Sum"}, - Period: 60, - Length: 3600, - Delay: 0, - NilToZero: &defaultNilToZero, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, - }, + RoundingPeriod: nil, + JobLevelMetricFields: yaceModel.JobLevelMetricFields{ + Period: 0, + Length: 0, + Delay: 0, + AddCloudwatchTimestamp: &falsePtr, + NilToZero: &defaultNilToZero, + }, + ExportedTagsOnMetrics: []string{}, + DimensionsRegexps: []yaceModel.DimensionsRegexp{ + { + Regexp: regexp.MustCompile(":cluster/(?P[^/]+)$"), + DimensionsNames: []string{"ClusterName"}, }, - RoundingPeriod: nil, - JobLevelMetricFields: yaceConf.JobLevelMetricFields{ - Period: 0, - Length: 0, + { + Regexp: regexp.MustCompile(":service/(?P[^/]+)/(?P[^/]+)$"), + DimensionsNames: []string{"ClusterName", "ServiceName"}, + }, + }, + }, + { + Regions: []string{"us-east-1"}, + Roles: []yaceModel.Role{{ + RoleArn: "arn:aws:iam::878167871295:role/yace_testing", + }}, + Type: "AWS/S3", + SearchTags: []yaceModel.SearchTag{}, + CustomTags: []yaceModel.Tag{}, + DimensionNameRequirements: []string{"BucketName"}, + Metrics: []*yaceModel.MetricConfig{ + { + Name: "BucketSizeBytes", + Statistics: []string{"Sum"}, + Period: 60, + Length: 3600, Delay: 0, - AddCloudwatchTimestamp: &falsePtr, - NilToZero: &defaultNilToZero, + NilToZero: defaultNilToZero, + AddCloudwatchTimestamp: addCloudwatchTimestamp, + }, + }, + RoundingPeriod: nil, + JobLevelMetricFields: yaceModel.JobLevelMetricFields{ + Period: 0, + Length: 0, + Delay: 0, + AddCloudwatchTimestamp: &falsePtr, + NilToZero: &defaultNilToZero, + }, + ExportedTagsOnMetrics: []string{}, + DimensionsRegexps: []yaceModel.DimensionsRegexp{ + { + Regexp: regexp.MustCompile("(?P[^:]+)$"), + DimensionsNames: []string{"BucketName"}, }, }, }, @@ -335,33 +352,31 @@ func TestCloudwatchComponentConfig(t *testing.T) { }, "static job nil to zero": { raw: staticJobNilToZeroConfig, - expected: yaceConf.ScrapeConf{ - APIVersion: "v1alpha1", - StsRegion: "us-east-2", - Discovery: yaceConf.Discovery{}, - Static: []*yaceConf.Static{ + expected: yaceModel.JobsConfig{ + StsRegion: "us-east-2", + StaticJobs: []yaceModel.StaticJob{ { Name: "super_ec2_instance_id", // assert an empty role is used as default. IMPORTANT since this // is what YACE looks for delegating to the environment role - Roles: []yaceConf.Role{{}}, + Roles: []yaceModel.Role{{}}, Regions: []string{"us-east-2"}, Namespace: "AWS/EC2", CustomTags: []yaceModel.Tag{}, - Dimensions: []yaceConf.Dimension{ + Dimensions: []yaceModel.Dimension{ { Name: "InstanceId", Value: "i01u29u12ue1u2c", }, }, - Metrics: []*yaceConf.Metric{{ + Metrics: []*yaceModel.MetricConfig{{ Name: "CPUUsage", Statistics: []string{"Sum", "Average"}, Period: 60, Length: 60, Delay: 0, - NilToZero: &falsePtr, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, + NilToZero: falsePtr, + AddCloudwatchTimestamp: addCloudwatchTimestamp, }}, }, }, @@ -369,33 +384,31 @@ func TestCloudwatchComponentConfig(t *testing.T) { }, "static job nil to zero metric": { raw: staticJobNilToZeroMetricConfig, - expected: yaceConf.ScrapeConf{ - APIVersion: "v1alpha1", - StsRegion: "us-east-2", - Discovery: yaceConf.Discovery{}, - Static: []*yaceConf.Static{ + expected: yaceModel.JobsConfig{ + StsRegion: "us-east-2", + StaticJobs: []yaceModel.StaticJob{ { Name: "super_ec2_instance_id", // assert an empty role is used as default. IMPORTANT since this // is what YACE looks for delegating to the environment role - Roles: []yaceConf.Role{{}}, + Roles: []yaceModel.Role{{}}, Regions: []string{"us-east-2"}, Namespace: "AWS/EC2", CustomTags: []yaceModel.Tag{}, - Dimensions: []yaceConf.Dimension{ + Dimensions: []yaceModel.Dimension{ { Name: "InstanceId", Value: "i01u29u12ue1u2c", }, }, - Metrics: []*yaceConf.Metric{{ + Metrics: []*yaceModel.MetricConfig{{ Name: "CPUUsage", Statistics: []string{"Sum", "Average"}, Period: 60, Length: 60, Delay: 0, - NilToZero: &falsePtr, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, + NilToZero: falsePtr, + AddCloudwatchTimestamp: addCloudwatchTimestamp, }}, }, }, @@ -403,51 +416,52 @@ func TestCloudwatchComponentConfig(t *testing.T) { }, "discovery job nil to zero config": { raw: discoveryJobNilToZeroConfig, - expected: yaceConf.ScrapeConf{ - APIVersion: "v1alpha1", - StsRegion: "us-east-2", - Discovery: yaceConf.Discovery{ - ExportedTagsOnMetrics: yaceModel.ExportedTagsOnMetrics{ - "ec2": []string{"name"}, - }, - Jobs: []*yaceConf.Job{ - { - Regions: []string{"us-east-2"}, - // assert an empty role is used as default. IMPORTANT since this - // is what YACE looks for delegating to the environment role - Roles: []yaceConf.Role{{}}, - Type: "sqs", - SearchTags: []yaceModel.Tag{{ - Key: "scrape", Value: "true", - }}, - CustomTags: []yaceModel.Tag{}, - Metrics: []*yaceConf.Metric{ - { - Name: "NumberOfMessagesSent", - Statistics: []string{"Sum", "Average"}, - Period: 60, - Length: 60, - Delay: 0, - NilToZero: &falsePtr, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, - }, - { - Name: "NumberOfMessagesReceived", - Statistics: []string{"Sum", "Average"}, - Period: 60, - Length: 60, - Delay: 0, - NilToZero: &truePtr, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, - }, + expected: yaceModel.JobsConfig{ + StsRegion: "us-east-2", + DiscoveryJobs: []yaceModel.DiscoveryJob{ + { + Regions: []string{"us-east-2"}, + // assert an empty role is used as default. IMPORTANT since this + // is what YACE looks for delegating to the environment role + Roles: []yaceModel.Role{{}}, + Type: "AWS/SQS", + SearchTags: []yaceModel.SearchTag{{ + Key: "scrape", Value: regexp.MustCompile("true"), + }}, + CustomTags: []yaceModel.Tag{}, + Metrics: []*yaceModel.MetricConfig{ + { + Name: "NumberOfMessagesSent", + Statistics: []string{"Sum", "Average"}, + Period: 60, + Length: 60, + Delay: 0, + NilToZero: falsePtr, + AddCloudwatchTimestamp: addCloudwatchTimestamp, }, - RoundingPeriod: nil, - JobLevelMetricFields: yaceConf.JobLevelMetricFields{ - Period: 0, - Length: 0, + { + Name: "NumberOfMessagesReceived", + Statistics: []string{"Sum", "Average"}, + Period: 60, + Length: 60, Delay: 0, - AddCloudwatchTimestamp: &falsePtr, - NilToZero: &falsePtr, + NilToZero: truePtr, + AddCloudwatchTimestamp: addCloudwatchTimestamp, + }, + }, + RoundingPeriod: nil, + JobLevelMetricFields: yaceModel.JobLevelMetricFields{ + Period: 0, + Length: 0, + Delay: 0, + AddCloudwatchTimestamp: &falsePtr, + NilToZero: &falsePtr, + }, + ExportedTagsOnMetrics: []string{"name"}, + DimensionsRegexps: []yaceModel.DimensionsRegexp{ + { + Regexp: regexp.MustCompile("(?P[^:]+)$"), + DimensionsNames: []string{"QueueName"}, }, }, }, diff --git a/internal/converter/internal/staticconvert/internal/build/cloudwatch_exporter.go b/internal/converter/internal/staticconvert/internal/build/cloudwatch_exporter.go index f212b2ab091f..f5a9e49c12b1 100644 --- a/internal/converter/internal/staticconvert/internal/build/cloudwatch_exporter.go +++ b/internal/converter/internal/staticconvert/internal/build/cloudwatch_exporter.go @@ -19,6 +19,7 @@ func toCloudwatchExporter(config *cloudwatch_exporter.Config) *cloudwatch.Argume DiscoveryExportedTags: config.Discovery.ExportedTags, Discovery: toDiscoveryJobs(config.Discovery.Jobs), Static: toStaticJobs(config.Static), + UseAWSSDKVersion2: config.UseAWSSDKVersion2, } } diff --git a/internal/converter/internal/staticconvert/testdata-v2/integrations_v2.river b/internal/converter/internal/staticconvert/testdata-v2/integrations_v2.river index 6fc587de7d74..902a83b8e652 100644 --- a/internal/converter/internal/staticconvert/testdata-v2/integrations_v2.river +++ b/internal/converter/internal/staticconvert/testdata-v2/integrations_v2.river @@ -161,6 +161,7 @@ prometheus.exporter.cloudwatch "integrations_cloudwatch_exporter" { } decoupled_scraping { } + aws_sdk_version_v2 = true } discovery.relabel "integrations_cloudwatch" { diff --git a/internal/converter/internal/staticconvert/testdata-v2/integrations_v2.yaml b/internal/converter/internal/staticconvert/testdata-v2/integrations_v2.yaml index cd0c497d15cc..59e2e154091a 100644 --- a/internal/converter/internal/staticconvert/testdata-v2/integrations_v2.yaml +++ b/internal/converter/internal/staticconvert/testdata-v2/integrations_v2.yaml @@ -69,6 +69,7 @@ integrations: store_container_labels: false cloudwatch_configs: - sts_region: us-east-2 + aws_sdk_version_v2: true discovery: jobs: - type: AWS/EC2 diff --git a/internal/converter/internal/staticconvert/testdata/integrations.river b/internal/converter/internal/staticconvert/testdata/integrations.river index 201f5e99e1c2..cfd984f51576 100644 --- a/internal/converter/internal/staticconvert/testdata/integrations.river +++ b/internal/converter/internal/staticconvert/testdata/integrations.river @@ -224,6 +224,7 @@ prometheus.exporter.cloudwatch "integrations_cloudwatch_exporter" { } decoupled_scraping { } + aws_sdk_version_v2 = true } discovery.relabel "integrations_cloudwatch_exporter" { diff --git a/internal/converter/internal/staticconvert/testdata/integrations.yaml b/internal/converter/internal/staticconvert/testdata/integrations.yaml index ced11cf6d911..95b82b45dc93 100644 --- a/internal/converter/internal/staticconvert/testdata/integrations.yaml +++ b/internal/converter/internal/staticconvert/testdata/integrations.yaml @@ -34,6 +34,7 @@ integrations: cloudwatch_exporter: enabled: true sts_region: us-east-2 + aws_sdk_version_v2: true discovery: jobs: - type: AWS/EC2 diff --git a/static/integrations/cloudwatch_exporter/cloudwatch_exporter.go b/static/integrations/cloudwatch_exporter/cloudwatch_exporter.go index f77e2517720b..a0d0f4a675db 100644 --- a/static/integrations/cloudwatch_exporter/cloudwatch_exporter.go +++ b/static/integrations/cloudwatch_exporter/cloudwatch_exporter.go @@ -8,8 +8,9 @@ import ( yace "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg" yaceClients "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/clients" yaceClientsV1 "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/clients/v1" - yaceConf "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/config" + yaceClientsV2 "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/clients/v2" yaceLog "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/logging" + yaceModel "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" @@ -22,28 +23,42 @@ type cachingFactory interface { Clear() } -var _ cachingFactory = &yaceClientsV1.CachingFactory{} +var _ cachingFactory = &yaceClientsV2.CachingFactory{} // exporter wraps YACE entrypoint around an Integration implementation type exporter struct { name string logger yaceLoggerWrapper cachingClientFactory cachingFactory - scrapeConf yaceConf.ScrapeConf + scrapeConf yaceModel.JobsConfig } // NewCloudwatchExporter creates a new YACE wrapper, that implements Integration -func NewCloudwatchExporter(name string, logger log.Logger, conf yaceConf.ScrapeConf, fipsEnabled, debug bool) *exporter { +func NewCloudwatchExporter(name string, logger log.Logger, conf yaceModel.JobsConfig, fipsEnabled, debug bool, useAWSSDKVersionV2 bool) (*exporter, error) { loggerWrapper := yaceLoggerWrapper{ debug: debug, log: logger, } + + var factory cachingFactory + var err error + + if useAWSSDKVersionV2 { + factory, err = yaceClientsV2.NewFactory(loggerWrapper, conf, fipsEnabled) + } else { + factory = yaceClientsV1.NewFactory(loggerWrapper, conf, fipsEnabled) + } + + if err != nil { + return nil, err + } + return &exporter{ name: name, logger: loggerWrapper, - cachingClientFactory: yaceClientsV1.NewFactory(conf, fipsEnabled, loggerWrapper), + cachingClientFactory: factory, scrapeConf: conf, - } + }, nil } func (e *exporter) MetricsHandler() (http.Handler, error) { @@ -68,9 +83,6 @@ func (e *exporter) MetricsHandler() (http.Handler, error) { yace.LabelsSnakeCase(labelsSnakeCase), yace.CloudWatchAPIConcurrency(cloudWatchConcurrency), yace.TaggingAPIConcurrency(tagConcurrency), - // Enable max-dimension-associator feature flag - // https://github.com/nerdswords/yet-another-cloudwatch-exporter/blob/master/docs/feature_flags.md#new-associator-algorithm - yace.EnableFeatureFlag(yaceConf.MaxDimensionsAssociator), ) if err != nil { e.logger.Error(err, "Error collecting cloudwatch metrics") diff --git a/static/integrations/cloudwatch_exporter/cloudwatch_exporter_decoupled.go b/static/integrations/cloudwatch_exporter/cloudwatch_exporter_decoupled.go index e44768ded059..b17ffbce9144 100644 --- a/static/integrations/cloudwatch_exporter/cloudwatch_exporter_decoupled.go +++ b/static/integrations/cloudwatch_exporter/cloudwatch_exporter_decoupled.go @@ -8,7 +8,8 @@ import ( "github.com/go-kit/log" yace "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg" yaceClientsV1 "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/clients/v1" - yaceConf "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/config" + yaceClientsV2 "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/clients/v2" + yaceModel "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "go.uber.org/atomic" @@ -21,7 +22,7 @@ type asyncExporter struct { name string logger yaceLoggerWrapper cachingClientFactory cachingFactory - scrapeConf yaceConf.ScrapeConf + scrapeConf yaceModel.JobsConfig registry atomic.Pointer[prometheus.Registry] // scrapeInterval is the frequency in which a background go-routine collects new AWS metrics via YACE. scrapeInterval time.Duration @@ -30,19 +31,32 @@ type asyncExporter struct { // NewDecoupledCloudwatchExporter creates a new YACE wrapper, that implements Integration. The decouple feature spawns a // background go-routine to perform YACE metric collection allowing for a decoupled collection of AWS metrics from the // ServerHandler. -func NewDecoupledCloudwatchExporter(name string, logger log.Logger, conf yaceConf.ScrapeConf, scrapeInterval time.Duration, fipsEnabled, debug bool) *asyncExporter { +func NewDecoupledCloudwatchExporter(name string, logger log.Logger, conf yaceModel.JobsConfig, scrapeInterval time.Duration, fipsEnabled, debug bool, useAWSSDKVersionV2 bool) (*asyncExporter, error) { loggerWrapper := yaceLoggerWrapper{ debug: debug, log: logger, } + + var factory cachingFactory + var err error + + if useAWSSDKVersionV2 { + factory, err = yaceClientsV2.NewFactory(loggerWrapper, conf, fipsEnabled) + } else { + factory = yaceClientsV1.NewFactory(loggerWrapper, conf, fipsEnabled) + } + + if err != nil { + return nil, err + } + return &asyncExporter{ name: name, logger: loggerWrapper, - cachingClientFactory: yaceClientsV1.NewFactory(conf, fipsEnabled, loggerWrapper), + cachingClientFactory: factory, scrapeConf: conf, registry: atomic.Pointer[prometheus.Registry]{}, - scrapeInterval: scrapeInterval, - } + }, nil } func (e *asyncExporter) MetricsHandler() (http.Handler, error) { @@ -98,9 +112,6 @@ func (e *asyncExporter) scrape(ctx context.Context) { yace.LabelsSnakeCase(labelsSnakeCase), yace.CloudWatchAPIConcurrency(cloudWatchConcurrency), yace.TaggingAPIConcurrency(tagConcurrency), - // Enable max-dimension-associator feature flag - // https://github.com/nerdswords/yet-another-cloudwatch-exporter/blob/master/docs/feature_flags.md#new-associator-algorithm - yace.EnableFeatureFlag(yaceConf.MaxDimensionsAssociator), ) if err != nil { e.logger.Error(err, "Error collecting cloudwatch metrics") diff --git a/static/integrations/cloudwatch_exporter/config.go b/static/integrations/cloudwatch_exporter/config.go index 0bdf6dd92f29..ea4efb6d0b46 100644 --- a/static/integrations/cloudwatch_exporter/config.go +++ b/static/integrations/cloudwatch_exporter/config.go @@ -8,6 +8,7 @@ import ( "github.com/go-kit/log" yaceConf "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/config" + "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/logging" yaceModel "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model" "gopkg.in/yaml.v2" @@ -38,12 +39,13 @@ func init() { // Config is the configuration for the CloudWatch metrics integration type Config struct { - STSRegion string `yaml:"sts_region"` - FIPSDisabled bool `yaml:"fips_disabled"` - Discovery DiscoveryConfig `yaml:"discovery"` - Static []StaticJob `yaml:"static"` - Debug bool `yaml:"debug"` - DecoupledScrape DecoupledScrapeConfig `yaml:"decoupled_scraping"` + STSRegion string `yaml:"sts_region"` + FIPSDisabled bool `yaml:"fips_disabled"` + Discovery DiscoveryConfig `yaml:"discovery"` + Static []StaticJob `yaml:"static"` + Debug bool `yaml:"debug"` + DecoupledScrape DecoupledScrapeConfig `yaml:"decoupled_scraping"` + UseAWSSDKVersion2 bool `yaml:"aws_sdk_version_v2"` } // DecoupledScrapeConfig is the configuration for decoupled scraping feature. @@ -138,10 +140,10 @@ func (c *Config) NewIntegration(l log.Logger) (integrations.Integration, error) if v := c.DecoupledScrape.ScrapeInterval; v != nil { scrapeInterval = *v } - return NewDecoupledCloudwatchExporter(c.Name(), l, exporterConfig, scrapeInterval, fipsEnabled, c.Debug), nil + return NewDecoupledCloudwatchExporter(c.Name(), l, exporterConfig, scrapeInterval, fipsEnabled, c.Debug, c.UseAWSSDKVersion2) } - return NewCloudwatchExporter(c.Name(), l, exporterConfig, fipsEnabled, c.Debug), nil + return NewCloudwatchExporter(c.Name(), l, exporterConfig, fipsEnabled, c.Debug, c.UseAWSSDKVersion2) } // getHash calculates the MD5 hash of the yaml representation of the config @@ -157,7 +159,7 @@ func getHash(c *Config) (string, error) { // ToYACEConfig converts a Config into YACE's config model. Note that the conversion is not direct, some values // have been opinionated to simplify the config model the agent exposes for this integration. // The returned boolean is whether or not AWS FIPS endpoints will be enabled. -func ToYACEConfig(c *Config) (yaceConf.ScrapeConf, bool, error) { +func ToYACEConfig(c *Config) (yaceModel.JobsConfig, bool, error) { discoveryJobs := []*yaceConf.Job{} for _, job := range c.Discovery.Jobs { discoveryJobs = append(discoveryJobs, toYACEDiscoveryJob(job)) @@ -170,7 +172,7 @@ func ToYACEConfig(c *Config) (yaceConf.ScrapeConf, bool, error) { APIVersion: "v1alpha1", StsRegion: c.STSRegion, Discovery: yaceConf.Discovery{ - ExportedTagsOnMetrics: yaceModel.ExportedTagsOnMetrics(c.Discovery.ExportedTags), + ExportedTagsOnMetrics: yaceConf.ExportedTagsOnMetrics(c.Discovery.ExportedTags), Jobs: discoveryJobs, }, Static: staticJobs, @@ -181,25 +183,26 @@ func ToYACEConfig(c *Config) (yaceConf.ScrapeConf, bool, error) { // Run the exporter's config validation. Between other things, it will check that the service for which a discovery // job is instantiated, it's supported. - if err := conf.Validate(); err != nil { - return conf, fipsEnabled, err + modelConf, err := conf.Validate(logging.NewNopLogger()) + if err != nil { + return yaceModel.JobsConfig{}, fipsEnabled, err } - PatchYACEDefaults(&conf) + PatchYACEDefaults(&modelConf) - return conf, fipsEnabled, nil + return modelConf, fipsEnabled, nil } // PatchYACEDefaults overrides some default values YACE applies after validation. -func PatchYACEDefaults(yc *yaceConf.ScrapeConf) { +func PatchYACEDefaults(yc *yaceModel.JobsConfig) { // YACE doesn't allow during validation a zero-delay in each metrics scrape. Override this behaviour since it's taken // into account by the rounding period. // https://github.com/nerdswords/yet-another-cloudwatch-exporter/blob/7e5949124bb5f26353eeff298724a5897de2a2a4/pkg/config/config.go#L320 - for _, job := range yc.Discovery.Jobs { + for _, job := range yc.DiscoveryJobs { for _, metric := range job.Metrics { metric.Delay = 0 } } - for _, staticConf := range yc.Static { + for _, staticConf := range yc.StaticJobs { for _, metric := range staticConf.Metrics { metric.Delay = 0 } @@ -318,10 +321,10 @@ func toYACERoles(roles []Role) []yaceConf.Role { return yaceRoles } -func toYACETags(tags []Tag) []yaceModel.Tag { - outTags := []yaceModel.Tag{} +func toYACETags(tags []Tag) []yaceConf.Tag { + outTags := []yaceConf.Tag{} for _, t := range tags { - outTags = append(outTags, yaceModel.Tag{ + outTags = append(outTags, yaceConf.Tag{ Key: t.Key, Value: t.Value, }) diff --git a/static/integrations/cloudwatch_exporter/config_test.go b/static/integrations/cloudwatch_exporter/config_test.go index 8548f37c7aec..d51019582f36 100644 --- a/static/integrations/cloudwatch_exporter/config_test.go +++ b/static/integrations/cloudwatch_exporter/config_test.go @@ -3,8 +3,9 @@ package cloudwatch_exporter import ( "testing" - yaceConf "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/config" - yaceModel "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model" + "github.com/grafana/regexp" + "github.com/nerdswords/yet-another-cloudwatch-exporter/pkg/model" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gopkg.in/yaml.v2" @@ -35,7 +36,7 @@ discovery: statistics: - Maximum - Average - - type: s3 + - type: AWS/S3 regions: - us-east-2 roles: @@ -69,6 +70,7 @@ static: const configString2 = ` sts_region: us-east-2 fips_disabled: true +aws_sdk_version_v2: true discovery: exported_tags: AWS/EC2: @@ -92,7 +94,7 @@ discovery: statistics: - Maximum - Average - - type: s3 + - type: AWS/S3 regions: - us-east-2 roles: @@ -149,7 +151,7 @@ discovery: statistics: - Maximum - Average - - type: s3 + - type: AWS/S3 regions: - us-east-2 roles: @@ -182,237 +184,203 @@ static: - Average ` -var falsePtr = false -var truePtr = true +var ( + falsePtr = false + truePtr = true +) -var expectedConfig = yaceConf.ScrapeConf{ - APIVersion: "v1alpha1", - StsRegion: "us-east-2", - Discovery: yaceConf.Discovery{ - ExportedTagsOnMetrics: map[string][]string{ - "AWS/EC2": {"name", "type"}, - }, - Jobs: []*yaceConf.Job{ +var expectedConfig = model.JobsConfig{ + StsRegion: "us-east-2", + DiscoveryJobs: []model.DiscoveryJob{{ + Regions: []string{"us-east-2"}, + Type: "AWS/EC2", + Roles: []model.Role{{RoleArn: "arn:aws:iam::878167871295:role/yace_testing", ExternalID: ""}}, + SearchTags: []model.SearchTag{{Key: "instance_type", Value: regexp.MustCompile("spot")}}, + CustomTags: []model.Tag{{Key: "alias", Value: "tesis"}}, + DimensionNameRequirements: []string(nil), + Metrics: []*model.MetricConfig{ { - Type: "AWS/EC2", - Regions: []string{"us-east-2"}, - Roles: []yaceConf.Role{ - { - RoleArn: "arn:aws:iam::878167871295:role/yace_testing", - }, - }, - CustomTags: []yaceModel.Tag{ - { - Key: "alias", - Value: "tesis", - }, - }, - SearchTags: []yaceModel.Tag{ - { - Key: "instance_type", - Value: "spot", - }, - }, - Metrics: []*yaceConf.Metric{ - { - Name: "CPUUtilization", - Statistics: []string{"Maximum", "Average"}, - // Defaults get configured from general settings - Period: 300, - Length: 300, - Delay: 0, - NilToZero: &defaultNilToZero, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, - }, - }, - RoundingPeriod: nil, - JobLevelMetricFields: yaceConf.JobLevelMetricFields{ - Period: 0, - Length: 0, - Delay: 0, - AddCloudwatchTimestamp: &falsePtr, - NilToZero: &defaultNilToZero, - }, + Name: "CPUUtilization", + Statistics: []string{"Maximum", "Average"}, + Period: 300, + Length: 300, + Delay: 0, + NilToZero: true, + AddCloudwatchTimestamp: false, }, + }, + RoundingPeriod: (*int64)(nil), + RecentlyActiveOnly: false, + ExportedTagsOnMetrics: []string{"name", "type"}, + IncludeContextOnInfoMetrics: false, + DimensionsRegexps: []model.DimensionsRegexp{{ + Regexp: regexp.MustCompile("instance/(?P[^/]+)"), + DimensionsNames: []string{"InstanceId"}, + }}, + JobLevelMetricFields: model.JobLevelMetricFields{ + Statistics: []string(nil), + Period: 0, + Length: 0, + Delay: 0, + NilToZero: &truePtr, + AddCloudwatchTimestamp: &falsePtr, + }, + }, { + Regions: []string{"us-east-2"}, + Type: "AWS/S3", + Roles: []model.Role{{RoleArn: "arn:aws:iam::878167871295:role/yace_testing", ExternalID: ""}}, + SearchTags: []model.SearchTag{}, + CustomTags: []model.Tag{}, + DimensionNameRequirements: []string{"BucketName"}, + Metrics: []*model.MetricConfig{ { - Type: "s3", - Regions: []string{"us-east-2"}, - Roles: []yaceConf.Role{ - { - RoleArn: "arn:aws:iam::878167871295:role/yace_testing", - }, - }, - SearchTags: []yaceModel.Tag{}, - CustomTags: []yaceModel.Tag{}, - DimensionNameRequirements: []string{"BucketName"}, - Metrics: []*yaceConf.Metric{ - { - Name: "BucketSizeBytes", - Statistics: []string{"Sum"}, - // Defaults get configured from general settings - Period: 300, - Length: 3600, // 1 hour - Delay: 0, - NilToZero: &defaultNilToZero, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, - }, - }, - RoundingPeriod: nil, - JobLevelMetricFields: yaceConf.JobLevelMetricFields{ - Period: 0, - Length: 0, - Delay: 0, - AddCloudwatchTimestamp: &falsePtr, - NilToZero: &defaultNilToZero, - }, + Name: "BucketSizeBytes", + Statistics: []string{"Sum"}, + Period: 300, + Length: 3600, + Delay: 0, + NilToZero: true, + AddCloudwatchTimestamp: false, }, }, - }, - Static: []*yaceConf.Static{ - { - Name: "custom_tesis_metrics", - Regions: []string{"us-east-2"}, - Roles: []yaceConf.Role{{}}, - Namespace: "CoolApp", - CustomTags: []yaceModel.Tag{}, - Dimensions: []yaceConf.Dimension{ - { - Name: "PURCHASES_SERVICE", - Value: "CoolService", - }, - { - Name: "APP_VERSION", - Value: "1.0", - }, - }, - Metrics: []*yaceConf.Metric{ - { - Name: "KPIs", - Period: 300, - Length: 300, - Statistics: []string{"Average"}, - Delay: 0, - NilToZero: &defaultNilToZero, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, - }, - }, + RoundingPeriod: (*int64)(nil), + RecentlyActiveOnly: false, + ExportedTagsOnMetrics: []string{}, + IncludeContextOnInfoMetrics: false, + DimensionsRegexps: []model.DimensionsRegexp{{ + Regexp: regexp.MustCompile("(?P[^:]+)$"), + DimensionsNames: []string{"BucketName"}, + }}, + JobLevelMetricFields: model.JobLevelMetricFields{ + Statistics: []string(nil), + Period: 0, + Length: 0, + Delay: 0, + NilToZero: &truePtr, + AddCloudwatchTimestamp: &falsePtr, }, - }, -} - -var expectedConfig3 = yaceConf.ScrapeConf{ - APIVersion: "v1alpha1", - StsRegion: "us-east-2", - Discovery: yaceConf.Discovery{ - ExportedTagsOnMetrics: map[string][]string{ - "AWS/EC2": {"name", "type"}, + }}, + StaticJobs: []model.StaticJob{{ + Name: "custom_tesis_metrics", + Regions: []string{"us-east-2"}, + Roles: []model.Role{{RoleArn: "", ExternalID: ""}}, + Namespace: "CoolApp", + CustomTags: []model.Tag{}, + Dimensions: []model.Dimension{ + {Name: "PURCHASES_SERVICE", Value: "CoolService"}, + {Name: "APP_VERSION", Value: "1.0"}, }, - Jobs: []*yaceConf.Job{ - { - Type: "AWS/EC2", - Regions: []string{"us-east-2"}, - Roles: []yaceConf.Role{ - { - RoleArn: "arn:aws:iam::878167871295:role/yace_testing", - }, - }, - CustomTags: []yaceModel.Tag{ - { - Key: "alias", - Value: "tesis", - }, - }, - SearchTags: []yaceModel.Tag{ - { - Key: "instance_type", - Value: "spot", - }, - }, - Metrics: []*yaceConf.Metric{ - { - Name: "CPUUtilization", - Statistics: []string{"Maximum", "Average"}, - // Defaults get configured from general settings - Period: 300, - Length: 300, - Delay: 0, - NilToZero: &falsePtr, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, - }, - }, - RoundingPeriod: nil, - JobLevelMetricFields: yaceConf.JobLevelMetricFields{ - Period: 0, - Length: 0, - Delay: 0, - AddCloudwatchTimestamp: &falsePtr, - NilToZero: &falsePtr, - }, - }, + Metrics: []*model.MetricConfig{ { - Type: "s3", - Regions: []string{"us-east-2"}, - Roles: []yaceConf.Role{ - { - RoleArn: "arn:aws:iam::878167871295:role/yace_testing", - }, - }, - SearchTags: []yaceModel.Tag{}, - CustomTags: []yaceModel.Tag{}, - DimensionNameRequirements: []string{"BucketName"}, - Metrics: []*yaceConf.Metric{ - { - Name: "BucketSizeBytes", - Statistics: []string{"Sum"}, - // Defaults get configured from general settings - Period: 300, - Length: 3600, // 1 hour - Delay: 0, - NilToZero: &falsePtr, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, - }, - }, - RoundingPeriod: nil, - JobLevelMetricFields: yaceConf.JobLevelMetricFields{ - Period: 0, - Length: 0, - Delay: 0, - AddCloudwatchTimestamp: &falsePtr, - NilToZero: &truePtr, - }, + Name: "KPIs", + Statistics: []string{"Average"}, + Period: 300, + Length: 300, + Delay: 0, + NilToZero: true, + AddCloudwatchTimestamp: false, }, }, - }, - Static: []*yaceConf.Static{ + }}, + CustomNamespaceJobs: []model.CustomNamespaceJob(nil), +} + +var expectedConfig3 = model.JobsConfig{ + StsRegion: "us-east-2", + DiscoveryJobs: []model.DiscoveryJob{ { - Name: "custom_tesis_metrics", - Regions: []string{"us-east-2"}, - Roles: []yaceConf.Role{{}}, - Namespace: "CoolApp", - CustomTags: []yaceModel.Tag{}, - Dimensions: []yaceConf.Dimension{ - { - Name: "PURCHASES_SERVICE", - Value: "CoolService", - }, - { - Name: "APP_VERSION", - Value: "1.0", - }, + Regions: []string{"us-east-2"}, + Type: "AWS/EC2", + Roles: []model.Role{{RoleArn: "arn:aws:iam::878167871295:role/yace_testing", ExternalID: ""}}, + SearchTags: []model.SearchTag{{Key: "instance_type", Value: regexp.MustCompile("spot")}}, + CustomTags: []model.Tag{{Key: "alias", Value: "tesis"}}, + DimensionNameRequirements: []string(nil), + Metrics: []*model.MetricConfig{{ + Name: "CPUUtilization", + Statistics: []string{"Maximum", "Average"}, + Period: 300, + Length: 300, + Delay: 0, + NilToZero: false, + AddCloudwatchTimestamp: false, + }}, + RoundingPeriod: (*int64)(nil), + RecentlyActiveOnly: false, + ExportedTagsOnMetrics: []string{"name", "type"}, + IncludeContextOnInfoMetrics: false, + DimensionsRegexps: []model.DimensionsRegexp{{ + Regexp: regexp.MustCompile("instance/(?P[^/]+)"), + DimensionsNames: []string{"InstanceId"}, + }}, + JobLevelMetricFields: model.JobLevelMetricFields{ + Statistics: []string(nil), + Period: 0, + Length: 0, + Delay: 0, + NilToZero: &falsePtr, + AddCloudwatchTimestamp: &falsePtr, }, - Metrics: []*yaceConf.Metric{ - { - Name: "KPIs", - Period: 300, - Length: 300, - Statistics: []string{"Average"}, - Delay: 0, - NilToZero: &falsePtr, - AddCloudwatchTimestamp: &addCloudwatchTimestamp, - }, + }, + { + Regions: []string{"us-east-2"}, + Type: "AWS/S3", + Roles: []model.Role{{ + RoleArn: "arn:aws:iam::878167871295:role/yace_testing", + ExternalID: "", + }}, + SearchTags: []model.SearchTag{}, + CustomTags: []model.Tag{}, + DimensionNameRequirements: []string{"BucketName"}, + Metrics: []*model.MetricConfig{{ + Name: "BucketSizeBytes", + Statistics: []string{"Sum"}, + Period: 300, + Length: 3600, + Delay: 0, + NilToZero: false, + AddCloudwatchTimestamp: false, + }}, + RoundingPeriod: (*int64)(nil), + RecentlyActiveOnly: false, + ExportedTagsOnMetrics: []string{}, + IncludeContextOnInfoMetrics: false, + DimensionsRegexps: []model.DimensionsRegexp{{ + Regexp: regexp.MustCompile("(?P[^:]+)$"), + DimensionsNames: []string{"BucketName"}, + }}, + JobLevelMetricFields: model.JobLevelMetricFields{ + Statistics: []string(nil), + Period: 0, + Length: 0, + Delay: 0, + NilToZero: &truePtr, + AddCloudwatchTimestamp: &falsePtr, }, }, }, + StaticJobs: []model.StaticJob{{ + Name: "custom_tesis_metrics", + Regions: []string{"us-east-2"}, + Roles: []model.Role{{RoleArn: "", ExternalID: ""}}, + Namespace: "CoolApp", + CustomTags: []model.Tag{}, + Dimensions: []model.Dimension{{ + Name: "PURCHASES_SERVICE", + Value: "CoolService", + }, {Name: "APP_VERSION", Value: "1.0"}}, + Metrics: []*model.MetricConfig{ + { + Name: "KPIs", + Statistics: []string{"Average"}, + Period: 300, + Length: 300, + Delay: 0, + NilToZero: false, + AddCloudwatchTimestamp: false, + }, + }, + }}, + CustomNamespaceJobs: []model.CustomNamespaceJob(nil), } func TestTranslateConfigToYACEConfig(t *testing.T) { @@ -444,7 +412,7 @@ func TestTranslateNilToZeroConfigToYACEConfig(t *testing.T) { yaceConf, fipsEnabled, err := ToYACEConfig(&c) require.NoError(t, err, "failed to translate to YACE configuration") - require.EqualValues(t, expectedConfig3, yaceConf) + require.EqualValues(t, expectedConfig3.DiscoveryJobs, yaceConf.DiscoveryJobs) require.EqualValues(t, truePtr, fipsEnabled) } diff --git a/static/integrations/cloudwatch_exporter/docs/doc.go b/static/integrations/cloudwatch_exporter/docs/doc.go index 20430a1efce9..68e8f5cd3115 100644 --- a/static/integrations/cloudwatch_exporter/docs/doc.go +++ b/static/integrations/cloudwatch_exporter/docs/doc.go @@ -61,7 +61,7 @@ func generateServicesDocSection() string { var sb strings.Builder for _, supportedSvc := range yaceConf.SupportedServices { sb.WriteString( - fmt.Sprintf("- Namespace: `%s` or Alias: `%s`\n", supportedSvc.Namespace, supportedSvc.Alias), + fmt.Sprintf("- Namespace: `%s`\n", supportedSvc.Namespace), ) } doc := strings.Replace(docTemplate, servicesListReplacement, sb.String(), 1) diff --git a/static/integrations/cloudwatch_exporter/docs/template.md b/static/integrations/cloudwatch_exporter/docs/template.md index 592d5dda0447..f09ee41cfef3 100644 --- a/static/integrations/cloudwatch_exporter/docs/template.md +++ b/static/integrations/cloudwatch_exporter/docs/template.md @@ -1,6 +1,6 @@ ## Supported services in discovery jobs The following is a list of AWS services that are supported in `cloudwatch_exporter` discovery jobs. When configuring a -discovery job, the `type` field of each `discovery_job` must match either the desired job namespace or alias. +discovery job, the `type` field of each `discovery_job` must match the desired job namespace. {{SERVICE_LIST}}