feat(rails): stamp telemetry.sdk.name on forwarded logs#197
Merged
Conversation
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.
Contributor
|
Reviews (1): Last reviewed commit: "feat(rails): stamp telemetry.sdk.name on..." | Re-trigger Greptile |
dustinbyrne
approved these changes
Jun 24, 2026
marandaneto
reviewed
Jun 25, 2026
| # 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', |
Member
There was a problem hiding this comment.
@turnipdabeets we should extract this to a const and reuse since its duplicated now
see
posthog-ruby/lib/posthog/field_parser.rb
Lines 147 to 148 in 8dd77c8
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
posthog-rails forwards
Rails.loggeroutput to PostHog Logs over OTLP, but the records carry the OpenTelemetry SDK's default resource attributetelemetry.sdk.name = "opentelemetry"(the gem never overrides it). PostHog's usage report splits per-SDK log volume by matchingtelemetry.sdk.nameagainst 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 noruby_logs_records_in_period.Change
Stamp
telemetry.sdk.name = "posthog-ruby"on the OTLP resource, mirroring the convention the mobile SDKs already use.