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

[AWS Billing] Add processor and leader election support #8414

Merged
merged 10 commits into from
Apr 5, 2024

Conversation

BenB196
Copy link
Contributor

@BenB196 BenB196 commented Nov 7, 2023

Proposed commit message

  • Add support for defining processors to AWS Billing
    • Useful for doing things like adding tags/data manipulation.
  • Add support for enabling leaderelection.
    • Useful for if you want to run the integration on Kubernetes.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Author's Checklist

  • I've added both of these settings under advanced as I think both won't see too frequent of usage.

How to test this PR locally

Integration before upgrade
inputs:
  - id: aws/metrics-billing-30d07b98-4f9b-4735-9116-aa37b164a07e
    name: aws-1
    revision: 1
    type: aws/metrics
    use_output: default
    meta:
      package:
        name: aws
        version: 2.8.5
    data_stream:
      namespace: default
    package_policy_id: 30d07b98-4f9b-4735-9116-aa37b164a07e
    streams:
      - id: aws/metrics-aws.billing-30d07b98-4f9b-4735-9116-aa37b164a07e
        data_stream:
          dataset: aws.billing
          type: metrics
        metricsets:
          - billing
        period: 24h
        include_linked_accounts: true
        cost_explorer_config.group_by_dimension_keys:
          - AZ
          - INSTANCE_TYPE
          - SERVICE
          - LINKED_ACCOUNT
        cost_explorer_config.group_by_tag_keys:
          - 'aws:createdBy'
Integration after upgrade

(Observe that neither processors nor condition are added here as it should be)

inputs:
  - id: aws/metrics-billing-30d07b98-4f9b-4735-9116-aa37b164a07e
    name: aws-1
    revision: 2
    type: aws/metrics
    use_output: default
    meta:
      package:
        name: aws
        version: 2.9.0
    data_stream:
      namespace: default
    package_policy_id: 30d07b98-4f9b-4735-9116-aa37b164a07e
    streams:
      - id: aws/metrics-aws.billing-30d07b98-4f9b-4735-9116-aa37b164a07e
        data_stream:
          dataset: aws.billing
          type: metrics
        metricsets:
          - billing
        period: 24h
        include_linked_accounts: true
        cost_explorer_config.group_by_dimension_keys:
          - AZ
          - INSTANCE_TYPE
          - SERVICE
          - LINKED_ACCOUNT
        cost_explorer_config.group_by_tag_keys:
          - 'aws:createdBy'
Leader Election enabled, Processors null
inputs:
  - id: aws/metrics-billing-30d07b98-4f9b-4735-9116-aa37b164a07e
    name: aws-1
    revision: 3
    type: aws/metrics
    use_output: default
    meta:
      package:
        name: aws
        version: 2.9.0
    data_stream:
      namespace: default
    package_policy_id: 30d07b98-4f9b-4735-9116-aa37b164a07e
    streams:
      - id: aws/metrics-aws.billing-30d07b98-4f9b-4735-9116-aa37b164a07e
        data_stream:
          dataset: aws.billing
          type: metrics
        metricsets:
          - billing
        period: 24h
        include_linked_accounts: true
        cost_explorer_config.group_by_dimension_keys:
          - AZ
          - INSTANCE_TYPE
          - SERVICE
          - LINKED_ACCOUNT
        cost_explorer_config.group_by_tag_keys:
          - 'aws:createdBy'
        condition: '${kubernetes_leaderelection.leader} == true'
Leader Election Enabled, Processors Set
inputs:
  - id: aws/metrics-billing-30d07b98-4f9b-4735-9116-aa37b164a07e
    name: aws-1
    revision: 4
    type: aws/metrics
    use_output: default
    meta:
      package:
        name: aws
        version: 2.9.0
    data_stream:
      namespace: default
    package_policy_id: 30d07b98-4f9b-4735-9116-aa37b164a07e
    streams:
      - id: aws/metrics-aws.billing-30d07b98-4f9b-4735-9116-aa37b164a07e
        data_stream:
          dataset: aws.billing
          type: metrics
        metricsets:
          - billing
        period: 24h
        include_linked_accounts: true
        cost_explorer_config.group_by_dimension_keys:
          - AZ
          - INSTANCE_TYPE
          - SERVICE
          - LINKED_ACCOUNT
        cost_explorer_config.group_by_tag_keys:
          - 'aws:createdBy'
        condition: '${kubernetes_leaderelection.leader} == true'
        processors:
          - add_tags:
              tags:
                - test
Leader Elastic disabled, Processors set
inputs:
  - id: aws/metrics-billing-30d07b98-4f9b-4735-9116-aa37b164a07e
    name: aws-1
    revision: 5
    type: aws/metrics
    use_output: default
    meta:
      package:
        name: aws
        version: 2.9.0
    data_stream:
      namespace: default
    package_policy_id: 30d07b98-4f9b-4735-9116-aa37b164a07e
    streams:
      - id: aws/metrics-aws.billing-30d07b98-4f9b-4735-9116-aa37b164a07e
        data_stream:
          dataset: aws.billing
          type: metrics
        metricsets:
          - billing
        period: 24h
        include_linked_accounts: true
        cost_explorer_config.group_by_dimension_keys:
          - AZ
          - INSTANCE_TYPE
          - SERVICE
          - LINKED_ACCOUNT
        cost_explorer_config.group_by_tag_keys:
          - 'aws:createdBy'
        processors:
          - add_tags:
              tags:
                - test

Related issues

Screenshots

image

@BenB196 BenB196 requested review from a team as code owners November 7, 2023 00:13
@elasticmachine
Copy link

elasticmachine commented Nov 7, 2023

❕ Build Aborted

The PR is not allowed to run in the CI yet

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Start Time: 2023-11-15T23:50:39.654+0000

  • Duration: 3 min 9 sec

Steps errors 2

Expand to view the steps failures

Load a resource file from a library
  • Took 0 min 0 sec . View more details here
  • Description: approval-list/elastic/integrations.yml
Error signal
  • Took 0 min 0 sec . View more details here
  • Description: githubApiCall: The REST API call https://api.github.com/orgs/elastic/members/BenB196 return the message : java.lang.Exception: httpRequest: Failure connecting to the service https://api.github.com/orgs/elastic/members/BenB196 : httpRequest: Failure connecting to the service https://api.github.com/orgs/elastic/members/BenB196 : Code: 404Error: {"message":"User does not exist or is not a member of the organization","documentation_url":"https://docs.github.com/rest/orgs/members#check-organization-membership-for-a-user"}

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@botelastic
Copy link

botelastic bot commented Dec 16, 2023

Hi! We just realized that we haven't looked into this PR in a while. We're sorry! We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1. Thank you for your contribution!

@botelastic botelastic bot added the Stalled label Dec 16, 2023
@mrodm
Copy link
Contributor

mrodm commented Dec 21, 2023

Hi @BenB196, please update your branch with the latest contents from main branch. There was an important PR merged updating the CI pipelines. Thanks!

@botelastic botelastic bot removed the Stalled label Dec 21, 2023
@BenB196 BenB196 requested review from a team as code owners December 21, 2023 11:20
@botelastic
Copy link

botelastic bot commented Jan 20, 2024

Hi! We just realized that we haven't looked into this PR in a while. We're sorry! We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1. Thank you for your contribution!

@botelastic botelastic bot added the Stalled label Jan 20, 2024
@BenB196 BenB196 requested a review from a team as a code owner January 26, 2024 15:27
@botelastic botelastic bot removed the Stalled label Jan 26, 2024
@BenB196
Copy link
Contributor Author

BenB196 commented Jan 26, 2024

Hi, don't mean to bother, but would it be possible to get a review of this PR?

@botelastic
Copy link

botelastic bot commented Feb 25, 2024

Hi! We just realized that we haven't looked into this PR in a while. We're sorry! We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1. Thank you for your contribution!

@botelastic botelastic bot added the Stalled label Feb 25, 2024
@botelastic botelastic bot removed the Stalled label Mar 6, 2024
@BenB196 BenB196 requested a review from ishleenk17 March 8, 2024 11:21
@ishleenk17
Copy link
Contributor

/test

@ishleenk17
Copy link
Contributor

/test

@ishleenk17
Copy link
Contributor

The changes look fine. There is a buildkite failure. I have given a retrigger. Lets wait for the CI/Cd results.
@elastic/obs-ds-hosted-services : Could you review as well ?

@ishleenk17
Copy link
Contributor

/test

Copy link
Contributor

@ishleenk17 ishleenk17 left a comment

Choose a reason for hiding this comment

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

Looks good! @elastic/obs-ds-hosted-services : Please review as well

@BenB196
Copy link
Contributor Author

BenB196 commented Apr 5, 2024

@ishleenk17 sorry to bother, is there anything left that needs to be addressed in this PR?

@ishleenk17
Copy link
Contributor

There are other code owner reviews pending.
@elastic/security-service-integrations : Could you please take a look at it as code owners as well.

@ishleenk17
Copy link
Contributor

/test

@ishleenk17
Copy link
Contributor

@BenB196 : You have the approvals now. I have triggered the build.
If it succeeds, will merge.

@ishleenk17 ishleenk17 enabled auto-merge (squash) April 5, 2024 11:16
@ishleenk17 ishleenk17 disabled auto-merge April 5, 2024 11:17
@elasticmachine
Copy link

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@elasticmachine
Copy link

💚 Build Succeeded

History

Copy link

Quality Gate passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No Coverage information No data about Coverage
0.0% 0.0% Duplication on New Code

See analysis details on SonarQube

@ishleenk17 ishleenk17 merged commit fac9ab9 into elastic:main Apr 5, 2024
5 checks passed
@elasticmachine
Copy link

Package aws - 2.14.0 containing this change is available at https://epr.elastic.co/search?package=aws

@BenB196 BenB196 deleted the aws-billing-processors-leader-elect branch April 5, 2024 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[AWS Billing] Support Processor Configuration
7 participants