Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete Attribute By Key And Value #213

Merged
merged 1 commit into from
May 15, 2024
Merged

Conversation

sethAmazon
Copy link

@sethAmazon sethAmazon commented May 14, 2024

Description:
You can only delete an attribute by key or pattern. We need to delete an attribute only if the key has a specific value.

Link to tracking Issue:
N/A

Testing:
Make the change. Take in cwa. Add a delete with service.name removed when value is unknow_service:java

2024/05/14 19:23:26 I! Config has been translated into TOML /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.toml 
2024/05/14 19:23:26 D! config [agent]
  collection_jitter = "0s"
  debug = true
  flush_interval = "1s"
  flush_jitter = "0s"
  hostname = ""
  interval = "60s"
  logfile = "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log"
  logtarget = "lumberjack"
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  omit_hostname = false
  precision = ""
  quiet = false
  round_interval = false

[outputs]

  [[outputs.cloudwatch]]
2024/05/14 19:23:26 I! Config has been translated into YAML /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.yaml 
2024/05/14 19:23:26 D! config exporters:
    awscloudwatch:
        force_flush_interval: 1m0s
        max_datums_per_call: 1000
        max_values_per_datum: 150
        middleware: agenthealth/metrics
        namespace: JMX
        region: us-west-2
        resource_to_telemetry_conversion:
            enabled: true
extensions:
    agenthealth/metrics:
        is_usage_data_enabled: true
        stats:
            operations:
                - PutMetricData
            usage_flags:
                mode: EC2
                region_type: EC2M
processors:
    filter/jmx/0:
        error_mode: propagate
        logs: {}
        metrics:
            include:
                match_type: regexp
                metric_names:
                    - jvm\..*
        spans: {}
        traces: {}
    resource/jmx:
        attributes:
            - action: delete
              converted_type: ""
              from_attribute: ""
              from_context: ""
              key: ""
              pattern: telemetry.sdk.*
            - action: delete
              converted_type: ""
              from_attribute: ""
              from_context: ""
              key: service.name
              pattern: ""
              value: unknown_service:java
receivers:
    jmx/0:
        collection_interval: 10s
        endpoint: localhost:2020
        jar_path: /opt/aws/amazon-cloudwatch-agent/bin/opentelemetry-jmx-metrics.jar
        otlp:
            endpoint: 0.0.0.0:0
            timeout: 5s
        target_system: jvm
service:
    extensions:
        - agenthealth/metrics
    pipelines:
        metrics/jmx/0:
            exporters:
                - awscloudwatch
            processors:
                - resource/jmx
                - filter/jmx/0
            receivers:
                - jmx/0
    telemetry:
        logs:
            development: false
            disable_caller: false
            disable_stacktrace: false
            encoding: console
            level: debug
            output_paths:
                - /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log
            sampling:
                enabled: true
                initial: 2
                thereafter: 500
                tick: 10s
        metrics:
            address: ""
            level: None
        traces: {}
Screenshot 2024-05-14 at 3 37 51 PM Screenshot 2024-05-14 at 3 38 07 PM

Documentation:
N/A

Copy link

@okankoAMZ okankoAMZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's currently failing few unit tests

@sethAmazon
Copy link
Author

sethAmazon commented May 14, 2024

It failed for the linting in a section of the code this does not touch. It failed for the govul. I will not fix as that only gets fixed by upgrading contrib version. The unit tests passed.

@sethAmazon sethAmazon merged commit 67df910 into aws-cwa-dev May 15, 2024
114 of 122 checks passed
@sethAmazon sethAmazon deleted the delete-attribute-by-value branch May 15, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants