From 912b894851f0995f6dc305ec16db10742fef9707 Mon Sep 17 00:00:00 2001 From: petlitskiy <81190543+petlitskiy@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:56:54 +0300 Subject: [PATCH 1/2] updated --- amp-ecs.cfhighlander.rb | 4 +++- amp-ecs.cfndsl.rb | 2 +- amp-ecs.config.yaml | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/amp-ecs.cfhighlander.rb b/amp-ecs.cfhighlander.rb index 430aab3..78b6b20 100644 --- a/amp-ecs.cfhighlander.rb +++ b/amp-ecs.cfhighlander.rb @@ -11,9 +11,10 @@ ComponentParam 'Cpu', '512' ComponentParam 'Memory', '1024' ComponentParam 'GrafanaAccountId', '' + ComponentParam 'ParameterPrefix', '' end - Component template: 'fargate-v2@0.7.1', name: 'exporter', render: Inline do + Component template: 'fargate-v2@0.8.6', name: 'exporter', render: Inline do parameter name: 'VPCId', value: Ref(:VPCId) parameter name: 'SubnetIds', value: FnSplit(',', Ref(:SubnetIds)) parameter name: 'EcsCluster', value: Ref(:EcsCluster) @@ -22,6 +23,7 @@ parameter name: 'MaximumPercent', value: 100 parameter name: 'Cpu', value: Ref('Cpu') parameter name: 'Memory', value: Ref('Memory') + parameter name: 'ParameterPrefix', value: Ref('ParameterPrefix') end end \ No newline at end of file diff --git a/amp-ecs.cfndsl.rb b/amp-ecs.cfndsl.rb index e8ee292..6232f9b 100644 --- a/amp-ecs.cfndsl.rb +++ b/amp-ecs.cfndsl.rb @@ -19,7 +19,7 @@ ecs_aot_config['extensions']['ecs_observer'].merge!(aot_ecs_observer) SSM_Parameter(:AotConfig) do - Name FnSub('/${EnvironmentName}/amq-ecs/AOT_CONFIG_CONTENT') + Name FnSub('/${ParameterPrefix}${EnvironmentName}/amp-ecs/AOT_CONFIG_CONTENT') Type 'String' Value FnSub("#{YAML.dump(ecs_aot_config)}") Description 'AWS OpenTelemetry ECS Exporter Config' diff --git a/amp-ecs.config.yaml b/amp-ecs.config.yaml index e6634cc..1bc9537 100644 --- a/amp-ecs.config.yaml +++ b/amp-ecs.config.yaml @@ -18,9 +18,11 @@ aot_ecs_observer: - port_label: ECS_PROMETHEUS_EXPORTER_PORT_V2 metrics_path_label: ECS_PROMETHEUS_EXPORTER_METRICS_PATH - default_aot_config_content: extensions: + sigv4auth: + service: "aps" + region: "${AWS::Region}" ecs_observer: refresh_interval: 60s # format is https://golang.org/pkg/time/#ParseDuration cluster_name: '${EnvironmentName}-services' # cluster name need manual config @@ -56,22 +58,20 @@ default_aot_config_content: batch: {} exporters: - awsprometheusremotewrite: + prometheusremotewrite: endpoint: ${APSWorkspace.PrometheusEndpoint}api/v1/remote_write - aws_auth: - region: ${AWS::Region} - service: "aps" + auth: + authenticator: sigv4auth logging: - loglevel: debug + loglevel: info - service: - extensions: [ ecs_observer ] + extensions: [ ecs_observer, sigv4auth ] pipelines: metrics: receivers: [prometheus] processors: [ batch ] - exporters: [awsprometheusremotewrite] + exporters: [prometheusremotewrite] components: exporter: @@ -85,7 +85,7 @@ components: otelexport: repo: ghcr.io image: base2services/aws-ecs-otel-collector - tag: v0.15.1 + tag: v0.41.0 env_vars: ENVIRONMENT_NAME: Fn::Sub: ${EnvironmentName} @@ -93,7 +93,7 @@ components: Fn::Sub: ${AWS::Region} secrets: ssm: - AOT_CONFIG_CONTENT: /${EnvironmentName}/amq-ecs/AOT_CONFIG_CONTENT + AOT_CONFIG_CONTENT: /${ParameterPrefix}${EnvironmentName}/amp-ecs/AOT_CONFIG_CONTENT iam_policies: ecsscan: action: From 127b44d0e39aa8cff42d9a749c8501c554d3dc3a Mon Sep 17 00:00:00 2001 From: petlitskiy <81190543+petlitskiy@users.noreply.github.com> Date: Mon, 14 Oct 2024 18:27:50 +0300 Subject: [PATCH 2/2] updated --- amp-ecs.cfhighlander.rb | 2 -- amp-ecs.cfndsl.rb | 2 +- amp-ecs.config.yaml | 6 +++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/amp-ecs.cfhighlander.rb b/amp-ecs.cfhighlander.rb index 78b6b20..26eb889 100644 --- a/amp-ecs.cfhighlander.rb +++ b/amp-ecs.cfhighlander.rb @@ -11,7 +11,6 @@ ComponentParam 'Cpu', '512' ComponentParam 'Memory', '1024' ComponentParam 'GrafanaAccountId', '' - ComponentParam 'ParameterPrefix', '' end Component template: 'fargate-v2@0.8.6', name: 'exporter', render: Inline do @@ -23,7 +22,6 @@ parameter name: 'MaximumPercent', value: 100 parameter name: 'Cpu', value: Ref('Cpu') parameter name: 'Memory', value: Ref('Memory') - parameter name: 'ParameterPrefix', value: Ref('ParameterPrefix') end end \ No newline at end of file diff --git a/amp-ecs.cfndsl.rb b/amp-ecs.cfndsl.rb index 6232f9b..c87e466 100644 --- a/amp-ecs.cfndsl.rb +++ b/amp-ecs.cfndsl.rb @@ -19,7 +19,7 @@ ecs_aot_config['extensions']['ecs_observer'].merge!(aot_ecs_observer) SSM_Parameter(:AotConfig) do - Name FnSub('/${ParameterPrefix}${EnvironmentName}/amp-ecs/AOT_CONFIG_CONTENT') + Name FnSub('/${EnvironmentName}/amp-ecs/AOT_CONFIG_CONTENT') Type 'String' Value FnSub("#{YAML.dump(ecs_aot_config)}") Description 'AWS OpenTelemetry ECS Exporter Config' diff --git a/amp-ecs.config.yaml b/amp-ecs.config.yaml index 1bc9537..e57b2bd 100644 --- a/amp-ecs.config.yaml +++ b/amp-ecs.config.yaml @@ -69,9 +69,9 @@ default_aot_config_content: extensions: [ ecs_observer, sigv4auth ] pipelines: metrics: - receivers: [prometheus] + receivers: [ prometheus ] processors: [ batch ] - exporters: [prometheusremotewrite] + exporters: [ prometheusremotewrite ] components: exporter: @@ -93,7 +93,7 @@ components: Fn::Sub: ${AWS::Region} secrets: ssm: - AOT_CONFIG_CONTENT: /${ParameterPrefix}${EnvironmentName}/amp-ecs/AOT_CONFIG_CONTENT + AOT_CONFIG_CONTENT: /${EnvironmentName}/amp-ecs/AOT_CONFIG_CONTENT iam_policies: ecsscan: action: