Skip to content

Conversation

@3kt
Copy link
Contributor

@3kt 3kt commented Feb 15, 2025

Proposed commit message

This fixes multiple bugs, while slightly changing the collection behavior for credits data.

  1. Wrong credit computation in the credit dashboard.
  2. Stalling collection when an error is encountered.

The wrong credit computation was caused by the lack of deduplication. This is fixed by ensuring we only look at the last 24h, and controlling the IDs within 24h (edge case with multiple collecting agents, or agent full reinstall).

The stalling collection was caused by a missing api_key carry-over when an error is faced. As a nice benefit, i've also ensured that an error while back-feeding doesn't completely stops the collection, ie the agent will attempt to move forward until "live" in spite of the error(s).

TODOs

  • ID control for credits, there should be a single document for the tuple organization_id/daily timestamp/ecu_quantity/start (assuming we never have 2 orders on the same date with the exact amount of ECUs)
  • Fix the credits dashboard to exclude old expired line items
  • Ensure at least an event is returned when want_more is true (reference)

Stalling collection fix

The integration will now return "empty" documents if no cost is returned for the point of collection. This ensures the want_more behavior is enforced.

image
@3kt 3kt added the bugfix Pull request that fixes a bug issue label Feb 15, 2025
@3kt 3kt marked this pull request as ready for review February 19, 2025 23:11
@3kt 3kt requested a review from a team as a code owner February 19, 2025 23:11
@elasticmachine
Copy link

💚 Build Succeeded

History

@elastic-sonarqube
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
11.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube

@3kt 3kt requested a review from efd6 February 20, 2025 16:46
@3kt 3kt merged commit 7ecaed9 into elastic:main Feb 20, 2025
5 of 6 checks passed
@3kt 3kt deleted the billing_integration_dedup_credits branch February 20, 2025 23:26
@elastic-vault-github-plugin-prod

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

Copy link
Contributor

@efd6 efd6 left a comment

Choose a reason for hiding this comment

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

Post merge LGTM

@andrewkroh andrewkroh added Integration:ess_billing Elasticsearch Service Billing dashboard Relates to a Kibana dashboard bug, enhancement, or modification. labels Mar 13, 2025
flexitrev pushed a commit that referenced this pull request Mar 20, 2025
* Changed credits collection mechanism, fixed stalling issue and fixed duplicate credit count issue * Escaped double quotes in dashboard vega * Correct number in changelog entry * Credit fingerprinting * Return a document even when no cost is given * Removed interval configuration * Refactored billing CEL code * Fixed timestamp parsing * Fixed parameter handling * Added time filter in credit view * Fixed total balance in credits dashboard * Use signal event dropped in the ingest pipeline * Wrap credits CEL code in state.with * Ingest pipeline typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes a bug issue dashboard Relates to a Kibana dashboard bug, enhancement, or modification. Integration:ess_billing Elasticsearch Service Billing

5 participants