-
Notifications
You must be signed in to change notification settings - Fork 399
Add view_component integration for Datadog::Tracing
#4977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tcannonfodder
wants to merge
9
commits into
DataDog:master
Choose a base branch
from
practical-computer:tcannonfodder/add-view_component-tracing
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4578863
Add `view_component` integration for `Datadog::Tracing`
tcannonfodder 6292351
Make `ViewComponent::Events::Render#event_name` configurable
tcannonfodder 88cd7b0
WIP: Add `view_component` build matricies in `appraisal`
tcannonfodder 882e142
WIP `DD_TRACE_VIEW_COMPONENT_ENABLED` to `supported-configurations`
tcannonfodder 714985a
WIP: Prepare `appraisal` files for `view_component` integration tests
tcannonfodder 3e1791c
Add integration test for `Datadog::Tracing::Contrib::ViewComponent`
tcannonfodder 94316ea
Update lib/datadog/tracing/contrib/view_component/event.rb
tcannonfodder d31ec60
ViewComponent Tracing: `require_relative` for intra-tracer requires
tcannonfodder beee8c9
refactor `*::ViewComponent::Events#subscriptions`: use `flat_map`
tcannonfodder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
46 changes: 46 additions & 0 deletions
46
lib/datadog/tracing/contrib/view_component/configuration/settings.rb
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require_relative '../../../configuration/settings' | ||
| require_relative '../ext' | ||
|
|
||
| module Datadog | ||
| module Tracing | ||
| module Contrib | ||
| module ViewComponent | ||
| module Configuration | ||
| # Custom settings for the ViewComponent integration | ||
| # @public_api | ||
| class Settings < Contrib::Configuration::Settings | ||
| option :enabled do |o| | ||
| o.type :bool | ||
| o.env Ext::ENV_ENABLED | ||
| o.default true | ||
| end | ||
|
|
||
| # @!visibility private | ||
| option :analytics_enabled do |o| | ||
| o.type :bool | ||
| o.env Ext::ENV_ANALYTICS_ENABLED | ||
| o.default false | ||
| end | ||
|
|
||
| # TODO: Rename to components_base_path when revisiting the ActionView refactor | ||
| # The ViewComponent and ActionView configurations should mirror each other, since they're generally | ||
| # run together. We may also need to revisit that the format is correct. | ||
| # see: https://github.com/DataDog/dd-trace-rb/pull/4977#discussion_r2440187824 | ||
| option :service_name | ||
| option :component_base_path do |o| | ||
| o.type :string | ||
| o.default 'components/' | ||
| end | ||
|
|
||
| option :use_deprecated_instrumentation_name do |o| | ||
| o.type :bool | ||
| o.default false | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
| end | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would
components_base_pathbe better? Since it's a path containing multiple components.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think we would need to ensure the correct format here - when calculating the component identifier, we are relying that this path will end with
/, otherwise component identifiers will start with a/There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both this (and the comment below) are essentially straight ports from the
action_viewintegration; which felt like the right approach to take here because these components are run together (you often render ViewComponents inside ActionView), so it feels right that they are configured and behave similarly.But! Y’all have the final say here; so just lemme know what makes sense for the repo. :) I just wanted to explain my reasoning for these decisions.
References: https://github.com/DataDog/dd-trace-rb/blob/master/lib/datadog/tracing/contrib/action_view/configuration/settings.rb#L34-L37
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@y9v I wanted to followup on about my explanations for this and https://github.com/DataDog/dd-trace-rb/pull/4977/files#diff-0afa0dfa1931ce2e54bb4846366587860be0b2ca1a205abdcb4b69483c7cdc41.
Let me know if you want me to make these changes, or stick with what's currently in place with ActionView. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep it aligned with ActionView, despite the concerns pointed by @y9v.
But @tcannonfodder, can you please add a comment, in code, with the concerns. We can revisit them at a later time, when we review the ActionView situation as well.