Skip to content

Conversation

@igormq
Copy link
Contributor

@igormq igormq commented Jan 22, 2026

Summary

  • PostHog's runtime detection uses User-Agent patterns to determine if requests come from server-side or client-side SDKs
  • Use posthog-java User-Agent for server-side runtime detection to enable proper library bucketing
  • This allows users to start migrating to posthog-java
  • Adds internal userAgent property to core PostHogConfig (@PostHogInternal) - not exposed to end users
  • Adds getUserAgent() method that returns userAgent or falls back to sdkName/sdkVersion
  • Server module sets userAgent to "posthog-java/{version}"

See: PostHog/posthog#45652
See: PostHog/posthog#45652 (comment)


Split from original PR addressing contributor feedback to keep changes focused.

@marandaneto
Copy link
Member

@PostHog/team-feature-flags relates to PostHog/posthog#45652 i think you'd know better if this is needed or not

@dustinbyrne
Copy link
Contributor

Similar to what I said here, I think the flags service should include the posthog-server user agent for now. It's server-side, so we can roll that change out instantly.

@igormq igormq force-pushed the fix/server-user-agent-workaround branch from ef02b8c to 649c467 Compare January 23, 2026 01:14
@igormq igormq changed the title fix: use posthog-java/server User-Agent for server-side runtime detection fix: use posthog-java User-Agent for server-side runtime detection Jan 23, 2026
@igormq igormq force-pushed the fix/server-user-agent-workaround branch from 649c467 to cab07ae Compare January 23, 2026 01:16
@igormq igormq force-pushed the fix/server-user-agent-workaround branch from cab07ae to 1179db8 Compare January 23, 2026 01:19
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