Skip to content

Billing integration add tags#15950

Merged
JohannesMahne merged 6 commits intoelastic:mainfrom
3kt:billing_integration_add_tags
Jan 27, 2026
Merged

Billing integration add tags#15950
JohannesMahne merged 6 commits intoelastic:mainfrom
3kt:billing_integration_add_tags

Conversation

@3kt
Copy link
Copy Markdown
Contributor

@3kt 3kt commented Nov 12, 2025

Proposed commit message

This adds a toggle button on the billing integration allowing the collection of deployment tags, which are then added to each billing object related to the corresponding deployment. In case the toggle isn't activated, the old behavior is kept identical

Considerations

There are some caveats:

  1. As the commercial cloud URL is hardcoded, this is only functional for commercial cloud and not gov cloud. This also prevents the override to admin.
  2. The tags are stored as a list of key:value strings, rather than nested objects to prevent mapping explosion.
  3. This doesn't consider historical tags. In other words, the deployment receive the tags that they have at the moment of the data pull, rather than at the time the billing occurred.
  4. This doesn't work for serverless projects.

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.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

Author's Checklist

  • Validate that the caveats are accepted
    -> moved to configurable parameter for deployment search

  • Evaluate whether we want to extend dashboards

  • Evaluate whether we want to make the tag pull behavior default, and remove the control of the user over the setting altogether.
    -> Kept default behavior

How to test this PR locally

  1. Spin a local environment with elastic-package stack up -v -d
  2. Set some relevant tags on the deployment of your choice
  3. Collect the organization ID and billing API key for your organization.
  4. Deploy the integration while activating the Add deployment tags toggle.

Related issues

None

Screenshots

image

@3kt 3kt added enhancement New feature or request Team:Obs-InfraObs Observability Infrastructure Monitoring team [elastic/obs-infraobs-integrations] Integration:ess_billing Elasticsearch Service Billing labels Nov 12, 2025
@elastic-vault-github-plugin-prod
Copy link
Copy Markdown

elastic-vault-github-plugin-prod bot commented Nov 12, 2025

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@andrewkroh andrewkroh added the documentation Improvements or additions to documentation. Applied to PRs that modify *.md files. label Nov 12, 2025
@asazallesmilner
Copy link
Copy Markdown

We definitely have people using this for gov cloud. Can we expose that as a configurable parameter (separate from the main base URL if needed ) ?

@JohannesMahne
Copy link
Copy Markdown

The functionality works on ECH deployments, but, for some reason we cannot add tags on Serverless projects:

Something went wrong

patch request validation failed: field is not allowed in the current configuration: project tagging is not enabled

@asazallesmilner
Copy link
Copy Markdown

I tried patching the code to be configurable, but doesn't seem to work with govcloud still.

@3kt 3kt marked this pull request as ready for review November 25, 2025 14:27
@3kt 3kt requested review from a team as code owners November 25, 2025 14:27
@3kt 3kt requested a review from asazallesmilner November 25, 2025 14:27
Copy link
Copy Markdown

@JohannesMahne JohannesMahne left a comment

Choose a reason for hiding this comment

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

I tested the positive flows, and the tags are coming through nicely.
Please just check the 2 questions I had on the edge cases.

@botelastic
Copy link
Copy Markdown

botelastic bot commented Jan 2, 2026

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 Stalled and removed Stalled labels Jan 2, 2026
@elasticmachine
Copy link
Copy Markdown

💚 Build Succeeded

History

Copy link
Copy Markdown

@JohannesMahne JohannesMahne left a comment

Choose a reason for hiding this comment

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

All good then.

@JohannesMahne
Copy link
Copy Markdown

@asazallesmilner - would you mind reviewing this PR again?

Comment on lines +24 to +26
- name: deployment_tags
type: keyword
description: Tags associated with the Elasticsearch Service deployment.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- name: deployment_tags
type: keyword
description: Tags associated with the Elasticsearch Service deployment.
- name: deployment_tags
type: keyword
description: >-
Tags associated with the Elasticsearch Service deployment, stored as
"key:value" strings. Reflects current tags at collection time.

Copy link
Copy Markdown
Contributor

@agithomas agithomas left a comment

Choose a reason for hiding this comment

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

Left a minor suggestion. The change looks good to me.

@gpop63 , kindly check if this can be approved from your end as well.

bytes(deployments_resp.Body).decode_json().as(deployments_body,
zip(
deployments_body.deployments.map(d,
d.resources.elasticsearch[0].id
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you double-check if this must be replaced as follows

zip(
  deployments_body.deployments.map(d, d.id),                    // ← Use deployment ID
  deployments_body.deployments.map(d, d.metadata.collate("tags"))
)

Copy link
Copy Markdown

@asazallesmilner asazallesmilner left a comment

Choose a reason for hiding this comment

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

LGTM. Work for both cloud.elastic.co and console.us-gov-east-1.aws.elastic-cloud.com.
Should we add docs for the urls to use for govcloud?
Billing endpoint: https://billing.us-gov-east-1.aws.elastic-cloud.com and Tags endpoint: https://console.us-gov-east-1.aws.elastic-cloud.com/api/v1/deployments/_search

@JohannesMahne JohannesMahne merged commit df5b77c into elastic:main Jan 27, 2026
8 checks passed
@elastic-vault-github-plugin-prod
Copy link
Copy Markdown

Package ess_billing - 1.7.0 containing this change is available at https://epr.elastic.co/package/ess_billing/1.7.0/

jakubgalecki0 pushed a commit to jakubgalecki0/integrations that referenced this pull request Feb 19, 2026
* Working tag pull

* Fixed deployment identification: elasticsearch_id is used rather than deployment.id

* Added changelog entry

* Added dep_search_url parameter to control tag fetch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation. Applied to PRs that modify *.md files. enhancement New feature or request Integration:ess_billing Elasticsearch Service Billing Team:Obs-InfraObs Observability Infrastructure Monitoring team [elastic/obs-infraobs-integrations]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants