feat(usage-report): add per-sdk logs counters for web and ruby#65939
Merged
Conversation
Contributor
|
Reviews (1): Last reviewed commit: "feat(usage-report): add per-sdk logs cou..." | Re-trigger Greptile |
22ab5d9 to
e35ec51
Compare
Contributor
|
⏭️ Skipped snapshot commit because branch advanced to The new commit will trigger its own snapshot update workflow. If you expected this workflow to succeed: This can happen due to concurrent commits. To get a fresh workflow run, either:
|
e35ec51 to
0830994
Compare
pawel-cebula
approved these changes
Jun 25, 2026
pawel-cebula
left a comment
Contributor
There was a problem hiding this comment.
A couple of nit comments, approving it.
marandaneto
approved these changes
Jun 25, 2026
marandaneto
left a comment
Member
There was a problem hiding this comment.
already some comments from billing otherwise lgtm
posthog-js already stamps telemetry.sdk.name='web' and posthog-rails stamps 'posthog-ruby' on forwarded log records, so split web and ruby log volume out of logs_records_in_period the same way the mobile SDKs are split. Only widens the existing telemetry.sdk.name match list and adds the matching counters; the logs_distributed query is unchanged.
0830994 to
560cb91
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
logs_records_in_periodin the org usage report has no SDK dimension, and the per-SDK split (get_teams_with_sdk_logs_records_in_period) only matched the mobile SDKs. Web and Ruby log volume was therefore not attributable, even though both SDKs now stamptelemetry.sdk.nameon every record:telemetry.sdk.name = "web"telemetry.sdk.name = "posthog-ruby"(see feat(rails): stamp telemetry.sdk.name on forwarded logs posthog-ruby#197)The previous code comment said web was omitted because posthog-js "doesn't set telemetry.sdk.name yet" — that's no longer true.
Changes
Add
webandrubyto the per-SDK logs split, mirroring the existing mobile pattern:SDK_TELEMETRY_NAMES: add"web": "web"and"posthog-ruby": "ruby"(and refresh the stale comment)UsageReportCounters: addweb_logs_records_in_period,ruby_logs_records_in_period_get_all_usage_dataand_get_team_report, plus the temporalmulti_keys_mappingThe
logs_distributedquery itself is unchanged — this only widens thetelemetry.sdk.namematch list and adds the matching counters. (The earlier per-SDK PR was reverted once for querying the wrong table; this change deliberately doesn't touch the query.)How did you test this code?
I'm an agent (Claude Code, human-directed). Automated only — no manual/product testing claimed.
Extended
test_logs_per_sdk_usage_metricsto insert realwebandposthog-rubyrecords intologs_distributedand assert the new counters (web=3,ruby=7), with aposthog-node/ no-telemetry.sdk.namerecord staying uncounted. Ran locally against ClickHouse + Postgres:TestHogFunctionUsageReports::test_logs_per_sdk_usage_metrics— passedTestHogFunctionUsageReportsclass — 6 passedRegression caught: a new SDK that stamps
telemetry.sdk.namewould silently go uncounted (and a typo'd suffix wouldKeyErrorat report assembly) — the assertions onweb/rubycounts cover both.Automatic notifications
Docs update
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
telemetry.sdk.name = "posthog-ruby").telemetry.sdk.name(consistent with the mobile SDKs and feat(usage-report): re-add per-sdk logs counters via logs_distributed #60706) rather thantelemetry.sdk.language/instrumentation_scope. The latter would work retroactively without an SDK release, but diverges from the established per-SDK convention; chose consistency.test_aggregate_activity.pyneeds no change and the.ambrsnapshot doesn't capture the per-SDK logs query, so neither required updates.