Skip to content

feat(rails): stamp telemetry.sdk.name on forwarded logs#197

Merged
turnipdabeets merged 1 commit into
mainfrom
telemetry-sdk-name-on-rails-logs
Jun 24, 2026
Merged

feat(rails): stamp telemetry.sdk.name on forwarded logs#197
turnipdabeets merged 1 commit into
mainfrom
telemetry-sdk-name-on-rails-logs

Conversation

@turnipdabeets

@turnipdabeets turnipdabeets commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Problem

posthog-rails forwards Rails.logger output to PostHog Logs over OTLP, but the records carry the OpenTelemetry SDK's default resource attribute telemetry.sdk.name = "opentelemetry" (the gem never overrides it). PostHog's usage report splits per-SDK log volume by matching telemetry.sdk.name against the known PostHog SDKs (posthog-ios, posthog-react-native, posthog-android, posthog-flutter), so Ruby logs match nothing and can't be attributed — there is no ruby_logs_records_in_period.

Change

Stamp telemetry.sdk.name = "posthog-ruby" on the OTLP resource, mirroring the convention the mobile SDKs already use.

Set telemetry.sdk.name='posthog-ruby' on the OTLP resource so PostHog's
usage report can attribute forwarded log volume to the Ruby SDK, the same
way it does for posthog-ios/android/flutter/react-native. Previously the
records carried the OpenTelemetry default ('opentelemetry') and could not
be split out per-SDK.
@greptile-apps

greptile-apps Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(rails): stamp telemetry.sdk.name on..." | Re-trigger Greptile

@turnipdabeets turnipdabeets marked this pull request as ready for review June 24, 2026 22:05
@turnipdabeets turnipdabeets requested a review from a team as a code owner June 24, 2026 22:05
@turnipdabeets turnipdabeets merged commit 9300bdf into main Jun 24, 2026
20 checks passed
@turnipdabeets turnipdabeets deleted the telemetry-sdk-name-on-rails-logs branch June 24, 2026 22:12
# report can attribute log volume to Ruby (mirrors posthog-ios/android/
# flutter/react-native). Overrides the OpenTelemetry SDK default of
# 'opentelemetry'; the posthog-rails integration name stays on the scope.
'telemetry.sdk.name' => 'posthog-ruby',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@turnipdabeets we should extract this to a const and reuse since its duplicated now
see

'$lib' => 'posthog-ruby',
'$lib_version' => PostHog::VERSION.to_s

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.

3 participants