Module: PostHog::Rails
- Defined in:
- lib/posthog/rails.rb,
lib/posthog/rails/railtie.rb,
lib/posthog/rails/active_job.rb,
lib/posthog/rails/configuration.rb,
lib/posthog/rails/request_context.rb,
lib/posthog/rails/tracing_headers.rb,
lib/posthog/rails/error_subscriber.rb,
lib/posthog/rails/parameter_filter.rb,
lib/posthog/rails/request_metadata.rb,
lib/posthog/rails/capture_exceptions.rb,
lib/posthog/rails/rescued_exception_interceptor.rb
Defined Under Namespace
Modules: ActiveJobExtensions, ParameterFilter Classes: CaptureExceptions, Configuration, ErrorSubscriber, InitConfig, Railtie, RequestContext, RescuedExceptionInterceptor
Constant Summary collapse
- VERSION =
PostHog::VERSION
- IN_WEB_REQUEST_KEY =
Thread-local key for tracking web request context
:posthog_in_web_request
Class Attribute Summary collapse
-
.config ⇒ PostHog::Rails::Configuration
Rails integration configuration.
Class Method Summary collapse
-
.configure {|config| ... } ⇒ void
Configure Rails integration options.
-
.enter_web_request ⇒ void
private
Mark that we’re in a web request context CaptureExceptions middleware will handle exception capture.
-
.exit_web_request ⇒ void
private
Clear web request context (called at end of request).
-
.in_web_request? ⇒ Boolean
private
Check if we’re currently in a web request context Used by ErrorSubscriber to avoid duplicate captures.
Class Attribute Details
.config ⇒ PostHog::Rails::Configuration
Returns Rails integration configuration.
22 23 24 |
# File 'lib/posthog/rails.rb', line 22 def config @config ||= Configuration.new end |
Class Method Details
.configure {|config| ... } ⇒ void
This method returns an undefined value.
Configure Rails integration options.
33 34 35 |
# File 'lib/posthog/rails.rb', line 33 def configure yield config if block_given? end |
.enter_web_request ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Mark that we’re in a web request context CaptureExceptions middleware will handle exception capture
41 42 43 |
# File 'lib/posthog/rails.rb', line 41 def enter_web_request Thread.current[IN_WEB_REQUEST_KEY] = true end |
.exit_web_request ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Clear web request context (called at end of request)
48 49 50 |
# File 'lib/posthog/rails.rb', line 48 def exit_web_request Thread.current[IN_WEB_REQUEST_KEY] = false end |
.in_web_request? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Check if we’re currently in a web request context Used by ErrorSubscriber to avoid duplicate captures
56 57 58 |
# File 'lib/posthog/rails.rb', line 56 def in_web_request? Thread.current[IN_WEB_REQUEST_KEY] == true end |