Skip to content

cloudsmith: add billable_only filter to analytics metrics (default: True) - #3024

Merged
steveny91 merged 13 commits into
DataDog:masterfrom
jtaylor-cs:sup-57-billable-filter-default-true
Jun 18, 2026
Merged

cloudsmith: add billable_only filter to analytics metrics (default: True)#3024
steveny91 merged 13 commits into
DataDog:masterfrom
jtaylor-cs:sup-57-billable-filter-default-true

Conversation

@jtaylor-cs

@jtaylor-cs jtaylor-cs commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds a billable_only boolean configuration option (default: True) to the Cloudsmith integration. When True, the analytics API is queried with billable_only=True, limiting metrics to billable download requests only (download domain, no error responses >= 400). When False, all traffic is returned with no filtering applied — equivalent to omitting the parameter entirely.

Files changed:

File Change
check.py Read billable_only from instance config (default True); append billable_only=<value> to every _build_analytics_url call
spec.yaml Declare billable_only as an optional boolean parameter
conf.yaml.example Document billable_only with @param annotation
__about__.py Bump version 1.3.01.4.0
CHANGELOG.md Add v1.4.0 release notes
tests/test_cloudsmith.py Add 2 new tests: default→billable_only=True in URL; explicit Falsebillable_only=False in URL

Motivation

Cloudsmith is introducing native logs — a new category of traffic that is non-billable and was not previously tracked. Once native logs are live, the analytics API will return a mix of billable and non-billable requests unless filtered. Without this change, customers and Cloudsmith users monitoring download/bandwidth metrics via this Datadog integration would see a sudden and unexplained increase in metric values.

By defaulting billable_only=True, the integration maintains the same billing-consistent behaviour it had before native logs were introduced — no customer action required. Users who explicitly want to include all traffic (billable and non-billable) can opt in by setting billable_only: false.

Cloudsmith API parameter details

  • Parameter name: billable_only
  • True: Filters to billable requests only — requests through the download domain with HTTP status < 400
  • False: Returns all results with no filtering applied (includes native CDN logs and errored requests); equivalent to omitting the parameter entirely

Review checklist

  • PR has a meaningful title
  • Feature has tests (2 new tests covering default and explicit-false cases; all 48 tests pass)
  • Git history is clean (single focused commit)
  • If PR impacts documentation, docs team has been notified or an issue has been opened on the documentation repo
  • If this PR includes a log pipeline, please add a description describing the remappers and processors.

Additional Notes

  • The billable_only query parameter was added to the Cloudsmith Analytics v2 API as part of internal ticket ENG-11511.
  • The default of True is intentional and backwards-compatible — it preserves existing metric values for all current users.
  • This change affects only the analytics time-series endpoint (/analytics/metrics/client/time-series/); all other API calls (quota, audit log, vulnerabilities, members, repositories) are unaffected.

- Add `billable` config option (default: true) to filter analytics API calls
  to billable download requests only
- Prevents inflated metrics when Cloudsmith native (non-billable) traffic is
  introduced alongside standard download logs
- Adds `billable` query param to all `_build_analytics_url` calls
- Bump version 1.3.0 -> 1.4.0
- Update spec.yaml, conf.yaml.example, CHANGELOG.md, README.md
- Add 2 new tests covering default-true and explicit-false behaviour
@datadog-prod-us1-5

This comment has been minimized.

The Cloudsmith analytics API parameter has been renamed from 'billable'
to 'billable_only', with capitalised True/False values.

Semantics: True filters to billable requests only (download domain, no
error responses >= 400). False returns all results with no filtering
applied (equivalent to omitting the parameter entirely).

- Rename instance config key: billable -> billable_only
- Rename internal attribute: analytics_billable -> analytics_billable_only
- Update URL param: billable=true/false -> billable_only=True/False
- Update spec.yaml, conf.yaml.example, CHANGELOG, and tests
@jtaylor-cs jtaylor-cs changed the title cloudsmith: add billable filter to analytics metrics (default: true) cloudsmith: add billable_only filter to analytics metrics (default: True) Jun 2, 2026

@BartoszBlizniak BartoszBlizniak 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.

One small comment from me

Comment thread cloudsmith/assets/configuration/spec.yaml Outdated
@jtaylor-cs
jtaylor-cs marked this pull request as ready for review June 3, 2026 15:12
@jtaylor-cs
jtaylor-cs requested review from a team as code owners June 3, 2026 15:12
@jtaylor-cs
jtaylor-cs requested review from london-wharton and removed request for a team June 3, 2026 15:12
@jtaylor-cs

Copy link
Copy Markdown
Contributor Author

@london-wharton this PR is still pending your review. Thank you.

@BartoszBlizniak

Copy link
Copy Markdown
Contributor

Hey @dkirov-dd (apologies for direct @ ), but is there any chance we could please push this forward up in your review queue - it's a small parameter change, however, it's a very necessary change on our end as our data team is changing how the API works and this is currently blocking us. Thank you 🙏

@jtaylor-cs

Copy link
Copy Markdown
Contributor Author

@london-wharton this is still pending your review. Unfortunately, one of the checks is now failing:
Asset Review: Failed
A system error occurred while assets were being validated.
Contact Datadog to find out how to resolve the problem.

@jtaylor-cs

Copy link
Copy Markdown
Contributor Author

@joepeeples, can you help get a second reviewer on this pending PR?

@steveny91
steveny91 added this pull request to the merge queue Jun 18, 2026
Merged via the queue into DataDog:master with commit d4745a8 Jun 18, 2026
37 of 38 checks passed
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.

4 participants