-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: fixing up railtie middleware install
- Loading branch information
1 parent
86b20a5
commit e75e6d9
Showing
6 changed files
with
71 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module Splunk | ||
module Otel | ||
module Instrumentation | ||
# Contains the RUM instrumentation for the ActionPack gem | ||
module ActionPack | ||
end | ||
end | ||
end | ||
end | ||
|
||
require_relative "./action_pack/railtie" |
36 changes: 36 additions & 0 deletions
36
lib/splunk/otel/instrumentation/action_pack/instrumentation.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# frozen_string_literal: true | ||
|
||
module Splunk | ||
module Otel | ||
module ActionPack | ||
# The Instrumentation class contains logic to detect and install the ActionPack instrumentation | ||
class Instrumentation < OpenTelemetry::Instrumentation::Base | ||
MINIMUM_VERSION = Gem::Version.new('5.2.0') | ||
|
||
install do |_config| | ||
require_railtie | ||
end | ||
|
||
present do | ||
defined?(::ActionController) | ||
end | ||
|
||
compatible do | ||
gem_version >= MINIMUM_VERSION | ||
end | ||
|
||
option :enable_recognize_route, default: false, validate: :boolean | ||
|
||
private | ||
|
||
def gem_version | ||
::ActionPack.version | ||
end | ||
|
||
def require_railtie | ||
require_relative 'railtie' | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module Splunk | ||
module Otel | ||
module ActionPack | ||
VERSION = '0.1.0' | ||
end | ||
end | ||
end |
This file contains 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