-
Notifications
You must be signed in to change notification settings - Fork 305
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
[Instrumentation.EntityFrameworkCore] Fix db.statement tag for Devart Oracle #2466
Open
vladajankovic
wants to merge
10
commits into
open-telemetry:main
Choose a base branch
from
vladajankovic:fix_db_statement_tag_for_devart_oracle
base: main
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 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7b66dc5
Fix db.statement tag for Devart Oracle
vladajankovic f455d86
Update CHANGELOG.md
vladajankovic 6e52578
Fix error
vladajankovic a8a7651
Merge branch 'main' into fix_db_statement_tag_for_devart_oracle
Kielek b2ea7d8
Update CHANGELOG.md
vladajankovic 73b0921
Fix lint
vladajankovic 3369e1b
Update code to support both emitting old and new attributes
vladajankovic 175c984
Merge branch 'main' into fix_db_statement_tag_for_devart_oracle
Kielek e7adb6e
Merge branch 'main' into fix_db_statement_tag_for_devart_oracle
Kielek f0c4f46
Merge branch 'main' into fix_db_statement_tag_for_devart_oracle
Kielek 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
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
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.
Consider code below. It is doing couple of things
payloadString.Contains(
usages in new code, it is better to check bools first (cheaper).Sorry for waiting long for a feedback, it is not trivial change.
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.
@Kielek Thank you for the response and suggestions.
When this code is executed
this.commandTypeFetcher.Fetch(command)
in the IF statement, the exception will leave theEntityFrameworkCoreCommandExecuting
case (It will not step into the ELSE IF statement to check if it's Devart). This can be fixed with a try-catch statement, where the TRY part contains the original code, and the CATCH statement handles fallback:With this change we don't need to check if Devart is causing this problem or another provider for database connection.
Is this change acceptable?
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.
What's about converting it to
if (this.commandTypeFetcher.TryFetch(command, out var commandType)
, without try/catch?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.
Tried it but still throws exception unfortunately 😞
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.
Here is what I've dug up while analyzing this exception. Firstly, the Fetch function calls the TryFetch function in its implementation. The TryFetch function is implemented as:
Now if we follow the code execution,
PropertyFetch.FetcherForProperty(property);
is called with the following implementation:The return statement calls
(PropertyFetch)Activator.CreateInstance(instantiatedTypedPropertyFetcher, propertyInfo);
which calls the constructor of theTypedPropertyFetch
:When
CreateDelegate()
is called, the exception is thrownSystem.ArgumentException: 'Cannot bind to the target method because its signature is not compatible with that of the delegate type.'
.This is the part I can't solve, which is why I made this workaround.