Skip to content

[chargeback] feature parity with chargeback_serverless and agentless - #22730

Draft
JohannesMahne wants to merge 17 commits into
mainfrom
feat/chargeback-0.7.0-parity-agentless
Draft

JohannesMahne wants to merge 17 commits into
mainfrom
feat/chargeback-0.7.0-parity-agentless

Conversation

@JohannesMahne

@JohannesMahne JohannesMahne commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Proposed commit message

Upgrade the chargeback integration to 0.7.0 with Agentless deployment mode (beta, default), AI & ML and Synthetics FinOps parity with chargeback_serverless, additive in-place 0.6.0 -> 0.7.0 upgrade safety, currency_symbol parity, 365-day transform retention policies, and four new FinOps ES|QL alerting rule templates.

What & Why

Organizations running Chargeback on Elastic Cloud Hosted (ECH) or self-managed monitoring clusters need full FinOps parity with chargeback_serverless (AI/ML and Synthetics cost attribution, budget/spike/data-trust alerting, and currency symbol formatting) as well as zero-infrastructure Agentless execution for ECH estates—without breaking existing 0.6.0 lookup destinations or manual configuration overrides on upgrade:

  1. Agentless deployment mode (default, beta):

    • Enables deployment_modes.agentless (enabled: true, is_default: true, release: beta) while preserving traditional Fleet-managed Elastic Agent (>= 9.2.0) policies for self-managed / On-Premises, private-network, or assets-only deployments.
    • Hides agent-host-only settings (proxy_url, ssl, enable_request_tracer) in Agentless mode and enforces the runtime Elastic Agent >= 9.2.0 guard on Kibana 9.2/9.3.
  2. AI & Machine Learning FinOps and Synthetics FinOps parity:

    • Extends chargeback.usage (cel.yml.hbs + ingest pipeline) to optionally harvest _ml/trained_models/_stats, _inference, and synthetics-* telemetry with non-overlapping interval merging and collector-agnostic fingerprinting.
    • Adds cluster_ai_contrib (chargeback_lookup.cluster_ai_model_contribution) and cluster_synthetics_contrib (chargeback_lookup.cluster_synthetics_monitor_contribution) continuous transforms.
    • Ships two new standard Lens ES|QL dashboards ([Chargeback] AI & Machine Learning and [Chargeback] Synthetics) wired into the shared navigation bar across all five dashboards.
  3. In-place 0.6.0 -> 0.7.0 upgrade compatibility, currency_symbol parity & retention:

    • Adds currency_symbol configuration parity (default € matching EUR) via chargeback_currency_lookup (chargeback_lookup.chargeback_currency).
    • Isolates new 0.7.0 billing and usage metadata fields in additive lookup transforms (billing_enrichment and usage_deployment_metadata) so existing 0.6.0 dest_*-1 destinations, transform grouping keys, and manual chargeback_conf rows remain intact in place on upgrade.
    • Adds 365-day retention_policy to all time-series transforms.
  4. FinOps & operational ES|QL alerting rule templates:

    • Adds four FinOps ES|QL alerting rule templates with per-currency aggregation:
      • [Chargeback] Rolling 30-day total spend budget exceeded (chargeback-alert-total-monthly-spend)
      • [Chargeback] Deployment daily spend threshold exceeded (chargeback-alert-deployment-spend)
      • [Chargeback] Deployment daily spend spike vs. 7-day baseline (chargeback-alert-deployment-spend-spike)
      • [Chargeback] Data trust & harvest health issue (chargeback-alert-data-trust-health)
    • Updates existing operational alerts (chargeback-deployment-missing-usage-data, chargeback-new-group-detected, chargeback-transform-health).

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

  • Bumped packages/chargeback to 0.7.0 in manifest.yml with matching changelog.yml entries and LICENSE.txt.
  • Verified additive 0.6.0 -> 0.7.0 upgrade safety (billing_enrichment, usage_deployment_metadata, chargeback_currency_lookup, and upgrade_060_to_070.txt script test).
  • Added pipeline, policy, and script tests covering new lookup pipelines, AI/Synthetics telemetry, currency sync, and auxiliary event fingerprinting.
  • Updated docs/README.md and _dev/build/docs/README.md for Agentless beta, AI/ML and Synthetics FinOps, alerts, and 0.7.0 upgrade guidance.
  • Removed obsolete 0.4.x proof screenshots from img/.

How to test this PR locally

  1. Run validation and unit/pipeline/policy tests from packages/chargeback:
    elastic-package check
    elastic-package test pipeline
    elastic-package test static
  2. Build build/packages/chargeback-0.7.0.zip and install or upgrade from 0.6.0 on an Elastic Cloud Hosted (ECH) or self-managed monitoring cluster running Elasticsearch/Kibana 9.2.0+.
  3. Test Agentless deployment mode (default on ECH) or attach to a Fleet-managed Elastic Agent (>= 9.2.0) policy, configure an Elastic Cloud Organization ID and API key (and/or Hub ES credentials), and verify:
    • Existing 0.6.0 dest_*-1 lookup destinations and manual chargeback_conf entries remain intact on upgrade.
    • All continuous transforms (including cluster_ai_contrib, cluster_synthetics_contrib, chargeback_currency_lookup, billing_enrichment, and usage_deployment_metadata) start cleanly.
    • All five [Chargeback] dashboards (including AI & Machine Learning and Synthetics) and all seven ES|QL alerting rule templates render and evaluate as expected.

Related issues

Screenshots

Updated and existing dashboard screenshots are packaged under packages/chargeback/img/.

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ Elastic Docs Style Checker (Vale)

No issues found on modified lines!


The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale.

@github-actions

This comment has been minimized.

@JohannesMahne JohannesMahne changed the title feat(chargeback): 0.7.0 feature parity with chargeback_serverless and… [chargeback] feature parity with chargeback_serverless and agentless Nov 26, 2026
@JohannesMahne
JohannesMahne force-pushed the feat/chargeback-0.7.0-parity-agentless branch from 5f005c8 to 54c4f1c Compare November 26, 2026 06:24
@JohannesMahne
JohannesMahne force-pushed the feat/chargeback-0.7.0-parity-agentless branch from 54c4f1c to da66a8e Compare November 26, 2026 09:19
@JohannesMahne
JohannesMahne requested a balanced review from Copilot November 26, 2026 10:22

Copilot AI left a comment

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.

🟡 Changes recommended

Unresolved upgrade-mapping, attribution, daily aggregation, and alert-selection defects can leave new fields unsearchable, produce incorrect chargeback results, and cause alerts to fail or miss deployments.

5 open issues
What changed in this PR

Extends Chargeback’s cost-allocation integration toward feature parity with Chargeback Serverless, adding Agentless deployment support and broader workload reporting.

Changes:

  • Enables Agentless mode by default in beta and hardens collection configuration and response handling.
  • Adds AI/ML and Synthetics rollups, expands billing metadata and currency settings, and introduces 365-day transform retention.
  • Adds four spending and data-health alert templates, updates existing alerts, and refreshes documentation and test fixtures.
File Description
packages/​chargeback/​manifest.yml Bumps version and enables default beta Agentless mode.
packages/​chargeback/​LICENSE.txt Adds Elastic License 2.0 text.
packages/​chargeback/​kibana/​alerting_rule_template/​chargeback-transform-health.json Includes AI/ML and Synthetics transforms in health monitoring.
packages/​chargeback/​kibana/​alerting_rule_template/​chargeback-new-group-detected.json Detects recently introduced groups using historical billing.
packages/​chargeback/​kibana/​alerting_rule_template/​chargeback-deployment-missing-usage-data.json Preserves billing metadata across the usage lookup join.
packages/​chargeback/​kibana/​alerting_rule_template/​chargeback-alert-total-monthly-spend.json Adds rolling-budget and projected-spend alerts.
packages/​chargeback/​kibana/​alerting_rule_template/​chargeback-alert-deployment-spend.json Adds per-deployment daily-spend threshold alerts.
packages/​chargeback/​kibana/​alerting_rule_template/​chargeback-alert-deployment-spend-spike.json Adds spend-spike detection against historical baselines.
packages/​chargeback/​kibana/​alerting_rule_template/​chargeback-alert-data-trust-health.json Adds billing freshness and allocation-health alerts.
packages/​chargeback/​elasticsearch/​transform/​cluster_tier_contribution/​transform.yml Expands exclusions and adds retention and templated pipelines.
packages/​chargeback/​elasticsearch/​transform/​cluster_tier_contribution/​fields/​fields.yml Clarifies tier documentation.
packages/​chargeback/​elasticsearch/​transform/​cluster_tier_and_ds_contribution/​transform.yml Updates exclusions, retention, and destination pipeline references.
packages/​chargeback/​elasticsearch/​transform/​cluster_tier_and_ds_contribution/​fields/​fields.yml Clarifies tier and namespace descriptions.
packages/​chargeback/​elasticsearch/​transform/​cluster_synthetics_contrib/​transform.yml Adds daily Synthetics monitor rollups.
packages/​chargeback/​elasticsearch/​transform/​cluster_synthetics_contrib/​manifest.yml Configures the Synthetics lookup destination.
packages/​chargeback/​elasticsearch/​transform/​cluster_synthetics_contrib/​fields/​fields.yml Defines Synthetics rollup fields.
packages/​chargeback/​elasticsearch/​transform/​cluster_deployment_contribution/​transform.yml Preserves deployment metadata and updates retention and exclusions.
packages/​chargeback/​elasticsearch/​transform/​cluster_deployment_contribution/​fields/​fields.yml Adds deployment name and group mappings.
packages/​chargeback/​elasticsearch/​transform/​cluster_datastream_contribution/​transform.yml Preserves deployment metadata in data-stream rollups.
packages/​chargeback/​elasticsearch/​transform/​cluster_datastream_contribution/​fields/​fields.yml Adds deployment metadata and clarifies namespace documentation.
packages/​chargeback/​elasticsearch/​transform/​cluster_capacity_utilization/​transform.yml Adds retention and a templated pipeline reference.
packages/​chargeback/​elasticsearch/​transform/​cluster_ai_contrib/​transform.yml Adds daily model and inference-activity rollups.
packages/​chargeback/​elasticsearch/​transform/​cluster_ai_contrib/​manifest.yml Configures the AI/ML lookup destination.
packages/​chargeback/​elasticsearch/​transform/​cluster_ai_contrib/​fields/​fields.yml Defines AI/ML rollup fields.
packages/​chargeback/​elasticsearch/​transform/​chargeback_conf_lookup/​transform.yml Preserves currency symbols and updates pipeline references.
packages/​chargeback/​elasticsearch/​transform/​chargeback_conf_lookup/​fields/​base-fields.yml Adds the currency-symbol mapping.
packages/​chargeback/​elasticsearch/​transform/​billing_realized_pool/​transform.yml Separates AI/Synthetics pools and expands billing classification.
packages/​chargeback/​elasticsearch/​transform/​billing_realized_pool/​fields/​fields.yml Adds AI and Synthetics chargeable-unit fields.
packages/​chargeback/​elasticsearch/​transform/​billing_credits/​transform.yml Updates exclusions, retention, and pipeline references.
packages/​chargeback/​elasticsearch/​transform/​billing_cluster_cost/​transform.yml Handles unassociated deployments and preserves billing units.
packages/​chargeback/​elasticsearch/​transform/​billing_cluster_cost/​fields/​fields.yml Adds billing units and expands field descriptions.
packages/​chargeback/​docs/​README.md Documents Agentless mode, workloads, alerts, and upgrade behavior.
packages/​chargeback/​data_stream/​usage/​fields/​fields.yml Adds deployment-group, AI/ML, and Synthetics fields.
packages/​chargeback/​data_stream/​usage/​elasticsearch/​ingest_pipeline/​default.yml Supports auxiliary workloads and removes Agentless metadata.
packages/​chargeback/​data_stream/​usage/​_dev/​test/​system/​test-default-config.yml Updates expected counts for auxiliary workload events.
packages/​chargeback/​data_stream/​usage/​_dev/​test/​pipeline/​test-usage.json-expected.json Refreshes expected ingestion timestamps.
packages/​chargeback/​data_stream/​node_stats/​manifest.yml Exposes the node-stat collection interval.
packages/​chargeback/​data_stream/​node_stats/​elasticsearch/​ingest_pipeline/​default.yml Removes conflicting Agentless metadata fields.
packages/​chargeback/​data_stream/​node_stats/​agent/​stream/​cel.yml.hbs Adds version guards, credential trimming, and response validation.
packages/​chargeback/​data_stream/​node_stats/​_dev/​test/​policy/​test-default.expected Updates default policy expectations for collector changes.
packages/​chargeback/​data_stream/​node_stats/​_dev/​test/​policy/​test-custom.expected Updates custom policy expectations for collector changes.
packages/​chargeback/​data_stream/​node_stats/​_dev/​test/​pipeline/​test-node-stats.json-expected.json Refreshes expected ingestion timestamps.
packages/​chargeback/​data_stream/​lookup/​fields/​fields.yml Expands shared billing and workload mappings.
packages/​chargeback/​data_stream/​lookup/​elasticsearch/​ingest_pipeline/​usage.yml Normalizes auxiliary rollups, metadata, and data-stream names.
packages/​chargeback/​data_stream/​lookup/​elasticsearch/​ingest_pipeline/​realized_pool.yml Emits separate AI/Synthetics totals and fallback deployment names.
packages/​chargeback/​data_stream/​lookup/​elasticsearch/​ingest_pipeline/​chargeback_conf.yml Normalizes currency codes and derives display symbols.
packages/​chargeback/​data_stream/​lookup/​elasticsearch/​ingest_pipeline/​billing.yml Expands billing normalization and cost classification.
packages/​chargeback/​data_stream/​lookup/​_dev/​test/​pipeline/​test-usage-lookup.json-expected.json Adds expected AI/ML and Synthetics lookup outputs.
packages/​chargeback/​data_stream/​lookup/​_dev/​test/​pipeline/​test-usage-lookup.json Adds auxiliary workload and metadata fixtures.
packages/​chargeback/​data_stream/​lookup/​_dev/​test/​pipeline/​test-realized-pool.json-expected.json Adds expected separate workload-pool totals.
packages/​chargeback/​data_stream/​lookup/​_dev/​test/​pipeline/​test-realized-pool.json Adds mixed data-tier, AI, and Synthetics fixtures.
packages/​chargeback/​data_stream/​lookup/​_dev/​test/​pipeline/​test-credits.json-expected.json Refreshes expected ingestion timestamps.
packages/​chargeback/​data_stream/​lookup/​_dev/​test/​pipeline/​test-chargeback-conf.json-expected.json Adds expected derived currency symbols.
packages/​chargeback/​data_stream/​lookup/​_dev/​test/​pipeline/​test-capacity-utilization.json-expected.json Refreshes expected ingestion timestamps.
packages/​chargeback/​data_stream/​lookup/​_dev/​test/​pipeline/​test-billing-lookup.json-expected.json Updates expected billing-kind normalization and timestamps.
packages/​chargeback/​data_stream/​billing/​manifest.yml Adds currency-symbol and collection-interval settings.
packages/​chargeback/​data_stream/​billing/​fields/​fields.yml Adds billing-unit and currency-symbol fields.
packages/​chargeback/​data_stream/​billing/​elasticsearch/​ingest_pipeline/​default.yml Updates Agentless cleanup, fingerprints, and billing normalization.
packages/​chargeback/​data_stream/​billing/​_dev/​test/​system/​test-default-config.yml Includes idle discovered projects in expected event counts.
packages/​chargeback/​data_stream/​billing/​_dev/​test/​pipeline/​test-billing.json-expected.json Refreshes expected ingestion timestamps.
packages/​chargeback/​changelog.yml Records the 0.7.0 enhancements.
packages/​chargeback/​_dev/​deploy/​docker/​files/​stream-config.yml Adds mock billing, discovery, AI/ML, and Synthetics responses.
packages/​chargeback/​_dev/​build/​docs/​README.md Updates documentation source for the new capabilities.

Review effort: Balanced

Comment on lines +10 to +11
- name: conf_currency_symbol
type: keyword

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 71d1369ce1.

  • Bumped dest.index from -1 to -2 across all five existing transforms with new 0.7.0 mappings (chargeback_conf_lookup, billing_cluster_cost, billing_realized_pool, cluster_deployment_contribution, and cluster_datastream_contribution) while keeping move_on_creation: true on their chargeback_lookup.* aliases so Fleet creates fresh dynamic: false lookup indices with the updated field mappings on upgrade.
  • Extended chargeback_conf_lookup and data_stream/lookup/elasticsearch/ingest_pipeline/chargeback_conf.yml (cb_conf_bucket_key runtime mapping + dest_chargeback_conf-1* wildcard source) so _id: config, _id: config_onprem, and any custom/historical period documents (_id preserved via _manual_doc_id and config_join_key restored) are carried over automatically from chargeback_lookup.dest_chargeback_conf-1 into -2 when sync_fleet_config is disabled or on assets-only / multi-period setups.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in d84dfdd: completed the _id fielddata removal and disabled-sync overwrite guard for chargeback_conf_lookup carryover into dest_chargeback_conf-2 (details on the two new threads).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in bcb2e87: completed the disabled-sync 0.6.0 upgrade guard (conf_schema_version: 1 vs v2|) and historical On-Premises rate-row preservation in chargeback_conf_lookup/transform.yml.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in bcd30cb138: added the chargeback_conf_init destination-initialisation tracker (chargeback_lookup.dest_chargeback_conf_init-1) so -1 and legacy chargeback_conf_lookup carryover into chargeback_lookup.dest_chargeback_conf-2 always runs before disabled snapshots suppress overwrites.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed completely across 71d1369ce1–7fde88da91 within Fleet and Elasticsearch's declarative transform lifecycle:

  • Fresh dynamic: false mappings on upgrade: All five modified 0.6.0 transforms (chargeback_conf_lookup, billing_cluster_cost, billing_realized_pool, cluster_deployment_contribution, and cluster_datastream_contribution) advance dest.index from -1 to -2 (_meta.fleet_transform_version: 0.7.0), so Kibana Fleet creates new -2 templates/indices with the added 0.7.0 fields (conf_row_id, conf_currency_symbol, group_first_seen, ai_chargeable_units, synthetics_*, deployment_name, deployment_group) without deleting existing -1 indices.
  • Single-index chargeback_lookup.* aliases (move_on_creation: true): Kibana Fleet's transform installer (x-pack/platform/plugins/shared/fleet/server/services/epm/elasticsearch/transform/install.ts) does not update dynamic: false destination mappings in place or run post-checkpoint alias switches, and ES|QL LOOKUP JOIN rejects multi-index aliases (Lookup Join requires a single lookup mode index). Using move_on_creation: true ensures Elasticsearch (TransformIndex.setUpDestinationAliases) moves each alias atomically to -2 on destination creation while billing_* and cluster_* transforms re-aggregate retained history automatically.
  • Zero-loss chargeback_conf_lookup carryover before suppressing disabled snapshots: chargeback_conf_lookup sources chargeback_lookup.dest_chargeback_conf-1* and legacy chargeback_conf_lookup*, preserves _id: config, _id: config_onprem, and custom/historical period documents (conf_row_id), and delegates destination-initialisation tracking to chargeback_conf_init (chargeback_lookup.dest_chargeback_conf_init-1). Until -2 receives its first document per config_join_key bucket, carryover runs even when sync_fleet_config: false; once chargeback_conf_init records initialisation, disabled snapshots drop writes so manual edits in -2 are never overwritten.
  • Upgrade documentation (_dev/build/docs/README.md / docs/README.md): Documented the twelve transforms (including chargeback_conf_init) and -1 -> -2 alias behaviour under Upgrading to 0.7.0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in d94f800335 to add full -1 historical carryover across all four remaining upgraded -2 lookup transforms as well as immediate Checkpoint 1 visibility in chargeback_conf_lookup:

  • billing_cluster_cost & billing_realized_pool: Now include chargeback_lookup.dest_*-1* in source.index and source.query, expose cb_sync_ts = 1262304000000L for -1 rows so they are visible on Checkpoint 1, guard native and legacy scripted metrics against -1 documents, and add a carryover_v1 scripted_metric fallback consumed in billing.yml and realized_pool.yml strictly when raw native/legacy source counts are zero (raw billing streams always win wherever retained).
  • cluster_deployment_contribution & cluster_datastream_contribution: Now include chargeback_lookup.dest_*-1* in source.index and carry over historical -1 rollup metrics when natCnt == 0 && legCnt == 0 for a daily bucket (raw metrics-chargeback.usage-* / monitoring-indices* sources always win wherever retained).
  • chargeback_conf_lookup: Updated cb_sync_ts to emit 1262304000000L for chargeback_lookup.dest_chargeback_conf-1 and chargeback_conf_lookup rows (computing lSync from event.ingested / @timestamp), so recent manual or 0.6.0 config edits within the 60s sync delay are carried over on Checkpoint 1; added distinct _meta.order (0..11) across all twelve transforms so Fleet installs them sequentially (chargeback_conf_lookup -> chargeback_conf_init -> downstream transforms).
  • _dev/build/docs/README.md / docs/README.md: Documented automatic Checkpoint 1 -1 -> -2 carryover and raw-stream precedence under Upgrading to 0.7.0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated packages/chargeback/elasticsearch/transform/chargeback_conf_lookup/fields/base-fields.yml alongside the -1 -> -2 destination upgrade implementation in 665c8a6cc8 (following d94f800335):

  • Why versioned destinations with move_on_creation: true are used instead of in-place putMapping: Fleet's transform installer (x-pack/platform/plugins/shared/fleet/server/services/epm/elasticsearch/transform/install.ts) retains existing destinations on package upgrade and never alters dynamic: false transform mappings in place, while ES|QL LOOKUP JOIN rejects multi-index aliases. Bumping dest.index from -1 to -2 across all five affected transforms (chargeback_conf_lookup, billing_cluster_cost, billing_realized_pool, cluster_deployment_contribution, cluster_datastream_contribution) causes Fleet to create fresh -2 indices containing the new 0.7.0 fields (conf_currency_symbol, conf_row_id, group_first_seen, ai_chargeable_units, synthetics_*, deployment_name, deployment_group) and atomically move chargeback_lookup.* on destination creation.
  • Zero-loss Checkpoint 1 carryover across all five -2 transforms:
    • chargeback_conf_lookup + chargeback_conf_init carry over _id: config, _id: config_onprem, and custom/historical rows from chargeback_lookup.dest_chargeback_conf-1 and chargeback_conf_lookup on Checkpoint 1 (emitting cb_sync_ts = 1262304000000L so recently written -1 rows within the 60s delay are included) before disabled Fleet snapshots suppress overwrites.
    • billing_cluster_cost, billing_realized_pool, cluster_deployment_contribution, and cluster_datastream_contribution carry over aged-out historical buckets from chargeback_lookup.dest_*-1 via carryover_v1 / -1 fallback whenever raw backing streams have aged out, while raw streams always take precedence wherever retained.
  • Documented the dynamic: false / -1 -> -2 requirement in base-fields.yml and verified all five migration paths end-to-end against live Elasticsearch 9.2.0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated in 4f7003b0a6 to resolve both the 0.6.0 -> 0.7.0 schema/destination migration and the upgrade-replay billing deduplication interaction flagged in the overview:

  • Upgrade-safe dedupKey & organization_id normalisation (billing_cluster_cost & billing_realized_pool): Removed derived bType (ess.billing.type) and bKind (ess.billing.kind) from dedupKey in both native and legacy scripted_metric aggregations (keeping both fields on rec so 0.7.0 enriches the winning document) and trimmed orgId, depId, and sku. Because 0.7.0 billing ingest populates kind on Serverless SKUs and refines type normalisation alongside updated _id fingerprints, 0.6.0 and 0.7.0 7-day replay documents now collapse onto the same dedupKey instead of double-counting historical Elasticsearch costs.
  • Unassociated bucket normalisation (billing_cluster_cost, billing_realized_pool, lookup/billing.yml): Mapped legacy 0.6.0 deployment_id: "unassociated" documents (both raw and -1 carryover in billing_cluster_cost) into unassociated_<type> via cb_deployment_id, excluded untyped dest_billing_realized_pool-1 "unassociated" rows from carryover_v1, and read cb_deployment_id first when building dedupKey.
  • Deleted-resource replay guards & CEL balance repair (data_stream/billing/agent/stream/cel.yml.hbs): Persisted pre_v07_high_water (to gate /costs/items residual attribution and prev_day_keys tombstones on pre-0.7.0 cursor days lacking recent_day_keys), persisted ech_id_map for deleted wrapper-ID ECH deployments across the 7-day window, widened Serverless elasticsearch SKU/residual matching, and removed 2 stray trailing ) left by d84dfdd57b (depth=0).
  • Verification: Regenerated billing policy expectations, passed elastic-package format, build, test policy, test pipeline, and check, and verified all R3–R8 scenarios end-to-end on live Elasticsearch 9.2.0 (R8-1..R8-3 cover Serverless ES / Ingest / integrations_server replay dedup, unassociated -> unassociated_elasticsearch -1 + raw consolidation, and 0.0 ECU retractions).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 600b48d by shifting from an asynchronous -2 index migration to a zero-mutation additive-lookup architecture:

  • Restored all nine existing 0.6.0 transforms to their 0.6.0 destination indices (chargeback_lookup.dest_*-1 and cluster_capacity_utilization_lookup) and exact 0.6.0 field schemas (dynamic: false untouched), removing chargeback_conf_init and carryover_v1 completely. Existing 0.6.0 manual/historical rate windows and aged-out billing rows remain preserved in place across 0.6.0 -> 0.7.0 upgrades.
  • Isolated all newly introduced 0.7.0 lookup fields into three dedicated index.mode: lookup sidecar transforms (alongside billing_credits, cluster_ai_contrib, and cluster_synthetics_contrib):
    • chargeback_lookup.chargeback_currency (chargeback_currency_lookup): conf_currency_symbol, conf_currency_unit
    • chargeback_lookup.billing_enrichment (billing_enrichment): ai_chargeable_units, synthetics_chargeable_units, synthetics_executions_units, synthetics_pings_units, group_first_seen
    • chargeback_lookup.usage_deployment_metadata (usage_deployment_metadata): deployment_name and deployment_group overrides
  • Updated all dashboards and alerting rules to LOOKUP JOIN these additive indices with unit-mismatch guards and safe fallback behaviour when sidecars are unpopulated, added all 14 transforms to chargeback-transform-health, and added an end-to-end 0.6.0 -> 0.7.0 script test (upgrade_060_to_070.txt) verifying in-place preservation and alert evaluation.

…ollup, synthetics cardinality, and spend alerts
@JohannesMahne

Copy link
Copy Markdown
Contributor Author

Addressed all five Copilot review items from #pullrequestreview-6072555676 in 71d1369ce1 (replied inline on each thread as well):

  1. Upgrade destination mappings & manual config preservation (chargeback_conf_lookup & sibling transforms): Bumped dest.index from -1 to -2 on the five existing transforms with new 0.7.0 mappings (chargeback_conf_lookup, billing_cluster_cost, billing_realized_pool, cluster_deployment_contribution, and cluster_datastream_contribution), and updated chargeback_conf_lookup + chargeback_conf.yml to automatically carry over _id: config, _id: config_onprem, and custom/historical period rows from chargeback_lookup.dest_chargeback_conf-1 into -2. Updated README.md upgrade notes and changelog.yml accordingly.
  2. Independent name and group timestamps (cluster_deployment_contribution & cluster_datastream_contribution): Tracked dep_name_ts/dep_name_ing and dep_group_ts/dep_group_ing independently across init_script, map_script, and reduce_script.
  3. Cleared chargeback_group propagation (cluster_deployment_contribution, cluster_datastream_contribution, usage.yml): Selected the latest explicitly present deployment_group (including empty "") and removed ctx.deployment_group in the usage lookup pipeline when cleared so full-document transform overwrites drop stale group attribution.
  4. Daily Synthetics location cardinality (cel.yml.hbs, usage/fields/fields.yml, cluster_synthetics_contrib, usage.yml): Emitted observer_locations identifiers per polling window and aggregated daily cardinality in cluster_synthetics_contrib with fallback to max(locations_count).
  5. Per-deployment latest billing timestamps (chargeback-alert-deployment-spend.json & chargeback-alert-deployment-spend-spike.json): Scoped INLINE STATS latest-timestamp calculations BY deployment_id so lagging deployments are evaluated independently.

Verification

  • elastic-package test policy (all 6 policy tests passed)
  • elastic-package test pipeline (all 18 pipeline and ingest-warning checks passed, including new test-chargeback-conf.json and test-usage-lookup.json cases)
  • elastic-package format, elastic-package build, and elastic-package check (clean; only pre-existing SVR00002 dashboard filter warnings skipped)
  • Live Elasticsearch 9.2.0 _transform/_preview, _ingest/pipeline/_simulate, and ES|QL /_query checks passed across all five scenarios.

Copilot AI left a comment

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.

…olicy AI/Synthetics dedup, and new-group replay
@JohannesMahne

Copy link
Copy Markdown
Contributor Author

Addressed all Round 2 Copilot review comments in d84dfdd:

  1. Zero _id fielddata on config migration (chargeback_conf_lookup): Removed every doc['_id'] read, added mapped conf_row_id (keyword) persisted by chargeback_conf.yml, and derived deterministic keys from mapped config_join_key, conf_start_date, and conf_end_date for pre-0.7.0 rows.
  2. One-way config migration guard when disabling sync: Stamped conf_schema_version: 2 on 0.7.0 config_snapshot events (including sync disable transitions) and gated legacy -1/chargeback_conf_lookup carryover in chargeback_conf_lookup/transform.yml so turning off sync_fleet_config never overwrites -2 with stale -1 data.
  3. Multi-policy deduplication in cluster_ai_contrib & cluster_synthetics_contrib: Replaced plain sum/max aggregations with an aux_rollup scripted_metric selecting a single covering emitter per daily bucket (unwrapped in lookup usage.yml).
  4. Immutable group observation tracking across 7-day billing replay: Added group_first_seen across billing CEL state, billing_cluster_cost/transform.yml, lookup billing.yml, and chargeback-new-group-detected.json so adding a chargeback_group tag during 7-day replay triggers the new-group alert.

Verification run locally after edits:

  • elastic-package test policy (6/6 passed)
  • elastic-package format, elastic-package build, elastic-package check (exit 0)
  • elastic-package test pipeline (all billing, node_stats, usage, and lookup cases passed)
  • Live Elasticsearch 9.2.0 verification with transient indices.id_field_data.enabled: false and 2-shard transform previews + _ingest/pipeline/_simulate + ES|QL alert execution (all Round 2 scenarios passed).

Copilot AI left a comment

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.

@github-actions

Copy link
Copy Markdown
Contributor

TL;DR

Buildkite step Check integrations chargeback failed, but the provided log is truncated to teardown output and does not include the originating test/error line. Immediate action: re-run the step and capture the earlier failing section (or attach test-result artifacts) to identify the exact code-level fix.

Remediation

  • Re-run Check integrations chargeback and provide the first failure block before --- [chargeback] failed (not only teardown tail).
  • Download and inspect uploaded artifacts from this run (build/test-results/chargeback-*.xml) to pinpoint which test suite and assertion failed.
  • After extracting the concrete failure, patch the implicated chargeback file/test and re-run .buildkite/scripts/test_one_package.sh packages/chargeback origin/main d84dfdd57ba49b7399a5efc83476846a5a26fbd3.
Investigation details

Root Cause

Current evidence is insufficient to isolate a code root cause. The only available failure log for this run contains teardown and exit-status lines, not the triggering error/test output.

Evidence

  • Build: https://buildkite.com/elastic/integrations/builds/54192

  • Job/step: Check integrations chargeback

  • Key log excerpt:

    • --- [chargeback] failed
    • 🚨 Error: The command exited with status 1
    • user command error: exit status 1
  • Provided log file: /tmp/gh-aw/buildkite-logs/integrations-check-integrations-chargeback.txt (contains teardown/artifact upload section only)

Verification

  • Local repro/tests: not run (this detective workflow is read-only and the available Buildkite log does not include the failing assertion/stack trace).
  • Flaky test check: searched open flaky-test issues; no visible chargeback-specific flaky issue found.

Follow-up

If you share either:

  1. the earlier failing log segment, or
  2. the failing build/test-results/chargeback-*.xml content,
    I can map it to exact source file(s) and provide a concrete patch-level fix recommendation.

What is this? | From workflow: Observability Agentic Workflow — Status

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

…sampled keys, agent emitter identity, and group replay
@JohannesMahne

Copy link
Copy Markdown
Contributor Author

Addressed all Round 3 Copilot review comments in bcb2e87:

  1. Config upgrade carryover when sync is disabled (chargeback_conf_lookup): Prefixed 0.7.0 enabled conf_sig values with v2|, stamped conf_schema_version: 2 on disabled transitions only from v2| cursors (preserving conf_schema_version: 1 when disabling during a 0.6.0 upgrade), and gated legacy fallback carryover on !hasV2Snap.
  2. Historical On-Premises rate rows (chargeback_conf_lookup): Restricted legacy chargeback_conf_lookup exclusion to the open-ended default config_onprem row so closed historical On-Premises rate periods migrate into -2.
  3. composite_datastream_key normalisation (lookup usage.yml): Normalised ctx.datastream (including downsample-*-.ds-* backing index names) before computing composite_datastream_key.
  4. Per-collector emitter isolation (cluster_ai_contrib & cluster_synthetics_contrib): Included agent.id / elastic_agent.id in both fingerprint_ai_or_synthetics_event and the transform emitter key (ns|polId|collectorId) so multiple Elastic Agents in the same policy are deduplicated.
  5. New-group replay hardening (billing, billing_cluster_cost): Derived new groups strictly from emitted day_evts, distinguished 0.6.0 upgrades from Day-1 backfill, and took max(bestReplayIng, bestExplicitGfs) in billing_cluster_cost/transform.yml.

Verification run locally after edits:

  • elastic-package test policy (6/6 passed)
  • elastic-package format, elastic-package build, elastic-package check (exit 0)
  • elastic-package test pipeline (all cases passed, including the downsampled usage.yml fixture)
  • Live Elasticsearch 9.2.0 verification with transient indices.id_field_data.enabled: false covering R3-1 through R3-5 (all passed).

Copilot AI left a comment

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.

…als and track conf -2 init before suppressing disabled snapshots
@JohannesMahne

Copy link
Copy Markdown
Contributor Author

Addressed the remaining Copilot review feedback in bcd30cb138:

  1. Merge non-overlapping collector intervals (cluster_ai_contrib, cluster_synthetics_contrib, usage): Added mapped interval_start/interval_end (date) fields stamped on ai_model and synthetics_monitor events, and updated both transforms' aux_rollup aggregations to keep collector identities separate for deduplication while merging non-overlapping intervals across replacement collectors.
  2. Track -2 destination initialisation independently of disabled snapshots (chargeback_conf_init, chargeback_conf_lookup): Added chargeback_conf_init (chargeback_lookup.dest_chargeback_conf_init-1) per config_join_key bucket and gated disabled-sync legacy/-1 carryover in chargeback_conf_lookup on !destInitialized instead of snapshot schema heuristics, removing the cursor schema-version workaround from billing/usage/node_stats cel.yml.hbs.

Verification run after final edits (bcd30cb138):

  • elastic-package test policy (6/6 passed across billing, usage, node_stats), elastic-package format, elastic-package build, elastic-package test pipeline (all passed including test-chargeback-conf-init.json), and elastic-package check (exit 0).
  • Live Elasticsearch 9.2.0 transform preview + ingest pipeline simulation (indices.id_field_data.enabled: false) confirming initial -1/legacy carryover before dest_chargeback_conf_init-1 population, suppression once initialised, AI & Synthetics morning/afternoon handoff merging (2,400 + 2,400 -> 4,800 and 1,200 + 1,200 -> 2,400), and concurrent/cumulative deduplication.

Copilot AI left a comment

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.

🟡 Changes recommended

The rules aggregate incompatible currencies, producing incorrect budget and projection checks, and misclassify successfully collected zero-byte usage as a missing harvest.

3 open issues
2 resolved since last review

Review effort: Balanced

Copilot AI left a comment

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.

🟡 Changes recommended

Critical issues remain: changed grouping keys can double-count historical billing during upgrades, and legacy routing reads _id, which can halt the transform when ID field data is disabled.

6 open issues

Review effort: Balanced

@JohannesMahne

Copy link
Copy Markdown
Contributor Author

Addressed both High-severity findings from review 6080939019 in 2f045d4d13:

  • 0.6.0 grouping identity preservation (#discussion_r4713690834): Kept 0.6.0 pivot.group_by bucket keys identical on all retained dest_*-1 transforms (unassociated and raw cb_sku in billing transforms, plus exact 0.6.0 cb_resolved_datastream in cluster_datastream_contribution and cluster_tier_and_ds_contribution) so reprocessed days overwrite 0.6.0 buckets in place without double-counting, while isolating unassociated product types inside dedupKey and preserving usage.yml ingest normalisation.
  • Zero _id fielddata reads (#discussion_r4713690877): Removed all doc['_id'] accesses from chargeback_conf_lookup/transform.yml, routing and prioritising legacy rows exclusively via params._source fields.

Verified locally on Elastic Stack 9.2.0: live ES transform previews with indices.id_field_data.enabled: false, elastic-package format, build, test policy (6/6), test pipeline (all assertions and warnings), check, and test script --verbose-scripts (4/4 pass: billing/discovery_404, billing/upgrade_060_to_070, node_stats/auth_key_short_circuit, usage/partial_shard_stats).

Copilot AI left a comment

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.

🔵 Needs a closer look

Human assessment is needed because current tests do not verify that index-less auxiliary events survive ingestion or that fingerprinting prevents distinct models, monitors, and collector IDs from overwriting one another.

3 open issues
3 resolved since last review

Review effort: Balanced

@JohannesMahne

Copy link
Copy Markdown
Contributor Author

Addressed the Buildkite test system failure (#54231) and Copilot Review 6081151820 (Needs a closer look) in 51ab165d84:

  • Currency lookup multi-stream normalisation & system preview parity (chargeback_currency_lookup / chargeback_currency.yml):
    • Unified chargeback_currency_lookup/transform.yml owner/emitter resolution with chargeback_conf_lookup (normalising cel-chargeback.<stream>-<uuid> policy IDs, preserving 48h stale-owner expiry, and emitting merged per-stream settings).
    • Updated data_stream/lookup/elasticsearch/ingest_pipeline/chargeback_currency.yml to support both merged streams buckets and direct test fixtures, defaulting active sync-enabled usage-only / node_stats-only policies to EUR / € consistently with chargeback_conf.yml while continuing to protect manual currency rows whenever sync_fleet_config is disabled or owner_conflict is true.
    • Restored chargeback@0.7.0 package installation after final cleanup in data_stream/billing/_dev/test/scripts/upgrade_060_to_070.txt.
  • Collector/workload fingerprinting & auxiliary ingestion tests:
    • Replaced unlabeled multi-field fingerprinting in data_stream/usage/elasticsearch/ingest_pipeline/default.yml with a field-labeled _cb_fp_key across policy (conf_policy_id, package_policy_id, input.*, elastic_agent.*), collector (agent:, ea:, host_id:, host_name:), cluster, timestamp/observation window, and workload identifiers (ai_model, synthetics_monitor, or index/tier), preventing cross-field collector collisions (for example agent.id vs host.id) and keeping replay deduplication intact.
    • Added index-less ai_model (host.id endpoint and agent.id trained model) and synthetics_monitor cases to test-usage.json, streams-shaped cases to test-chargeback-currency.json, prio: 3 fixture alignment to test-chargeback-conf.json, and end-to-end ES ingestion/collision/replay verification in data_stream/usage/_dev/test/scripts/aux_events_fingerprint.txt.

Verified locally on Elastic Stack 9.2.0 (51ab165d84, zero failures):

  • Live ES transformation preview, ingest pipeline simulation, and ES|QL verification (Scenarios A, B, C)
  • Sequential elastic-package suite: format, build, check -v, test static (3/3), test asset (10/10), test policy (6/6), test pipeline (24/24), test system (3/3 — billing, node_stats, usage), and test script (5/5 — discovery_404, upgrade_060_to_070, auth_key_short_circuit, aux_events_fingerprint, partial_shard_stats).

Copilot AI left a comment

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.

🟡 Changes recommended

Collector-specific fingerprints allow duplicate index_usage observations from different agents to persist across shards, doubling usage and distorting cost allocation because the rollups lack cross-shard interval deduplication.

4 open issues

Review effort: Balanced

@JohannesMahne

Copy link
Copy Markdown
Contributor Author

Addressed #discussion_r4714365888 from review 6081751858 in 1a33435d17:

  • Restricted collector-labeled _cb_fp_key fingerprinting in packages/chargeback/data_stream/usage/elasticsearch/ingest_pipeline/default.yml exclusively to ai_model and synthetics_monitor events, restoring the collector-agnostic fingerprint_usage_event key for index_usage so duplicate index observations from multiple agents resolve to a single _id.
  • Extended packages/chargeback/data_stream/usage/_dev/test/scripts/aux_events_fingerprint.txt to verify both per-collector auxiliary isolation (ai_model and synthetics_monitor) and cross-collector index_usage 409 deduplication.

Re-verified locally on Elastic Stack 9.2.0 (1a33435d17, zero failures): elastic-package format, build, check -v, test static (3/3), test asset (10/10), test policy (6/6), test pipeline (24/24), test system (3/3 — billing, node_stats, usage), and test script (5/5).

Copilot AI left a comment

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.

🟡 Changes recommended

Including conf_policy_id in the fingerprint prevents deduplication of identical index-usage observations across policies, potentially inflating usage and cost allocation when copies land on different shards.

4 open issues
1 resolved since last review

Review effort: Balanced

@JohannesMahne

Copy link
Copy Markdown
Contributor Author

Addressed #discussion_r4714512379 from review 6081947574 in c11ebbecb4:

  • Restored the exact 0.6.0 five-field fingerprint_usage_event key (elasticsearch.cluster.name, @timestamp, period_obs_ts, elasticsearch.index.name, elasticsearch.index.tier) in packages/chargeback/data_stream/usage/elasticsearch/ingest_pipeline/default.yml so duplicate index_usage observations across policies and agents resolve to the same _id while ai_model and synthetics_monitor events keep labeled per-collector fingerprints.
  • Updated packages/chargeback/data_stream/usage/_dev/test/scripts/aux_events_fingerprint.txt with a cross-policy (pol-1 vs pol-2) and cross-collector index_usage 409 deduplication regression case.

Verified locally on Elastic Stack 9.2.0 (c11ebbecb4, zero failures): elastic-package format, build, check -v, test static (3/3), test asset (10/10), test policy (6/6), test pipeline (24/24), test system (3/3 — billing, node_stats, usage), and test script (5/5).

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

✅ All changelog entries have the correct PR link.

Copilot AI left a comment

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.

🔵 Needs a closer look

Human assessment is needed because an omitted finding shows that inconsistent legacy On-Premises join-key normalization can replace a saved rate with a fallback.

3 open issues
1 resolved since last review

Review effort: Balanced

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
Contributor

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Integration:chargeback Chargeback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants