-
Notifications
You must be signed in to change notification settings - Fork 20
Fix UnknownRemoteOperation for Database instrumentation. #50
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
Merged
Conversation
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
thpierce
reviewed
Feb 9, 2024
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_metric_attribute_generator.py
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_metric_attribute_generator.py
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_span_processing_util.py
Outdated
Show resolved
Hide resolved
sample-applications/vehicle-dealership-sample-app/eks/backend-deployment.yaml
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_span_processing_util.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_metric_attribute_generator.py
Outdated
Show resolved
Hide resolved
thpierce
reviewed
Feb 13, 2024
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_metric_attribute_generator.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_span_processing_util.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_metric_attribute_generator.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_span_processing_util.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_metric_attribute_generator.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_metric_attribute_generator.py
Outdated
Show resolved
Hide resolved
thpierce
reviewed
Feb 14, 2024
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/configuration/dialect_keywords.json
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_metric_attribute_generator.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_metric_attribute_generator.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_span_processing_util.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/configuration/dialect_keywords.json
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_span_processing_util.py
Outdated
Show resolved
Hide resolved
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_metric_attribute_generator.py
Outdated
Show resolved
Hide resolved
...pentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_metric_attribute_generator.py
Outdated
Show resolved
Hide resolved
thpierce
reviewed
Feb 14, 2024
aws-opentelemetry-distro/src/amazon/opentelemetry/distro/_aws_span_processing_util.py
Outdated
Show resolved
Hide resolved
...pentelemetry-distro/tests/amazon/opentelemetry/distro/test_aws_metric_attribute_generator.py
Outdated
Show resolved
Hide resolved
...opentelemetry-distro/src/amazon/opentelemetry/distro/configuration/sql_dialect_keywords.json
Outdated
Show resolved
Hide resolved
thpierce
approved these changes
Feb 14, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of changes:
When
"db.operation"
is not provided in span attributes, the"aws.remote.operation"
will beUnknowRemoteOperation
.This PR updated the
_set_remote_service_and_operation
function to parsing the"db.statement"
attribute when"db.operation"
is missing, and extract the valid"aws.remote.operation"
(We setup a set of valid database related"aws.remote.operation"
for security concern):configuration/dialect_keywords.json
saving all the valid keywords. In this file, the sequence of key words matter -> The keyword with longer word length are placed towards the front of the list so it will be matched first."db.statement"
to avoid the case where very large statements, and use regular expression to match the keyword, it will match the beginning of the string. If the string's start does not conform to the regular expression, the match fails."db.statement"
cases:a. Only 1 valid keywords match
b. More than 1 valid keywords match, we want to pick the longest match
c. More than 1 valid keywords match, but the other keywords is not at the start of the SpanAttributes.DB_STATEMENT. We want to only pick start match
d. No valid match
e. Have valid but it is not at the start of SpanAttributes.DB_STATEMENT
f. Have valid keywords, match the longest word
g. Have valid keywords, match with first word
h.Have valid keywords, match with upper case
5.Add unit test for testing keywords sequence in json file:
a.Confirm the keywords are sorted based on descending order of keywords character length
b.Confirm maximum length of keywords is not longer than MAX_KEYWORD_LENGTH
configuration/dialect_keywords.json
from codespell check because the Keywords are fixed for the query, and codespell does not recognize the comments in json.Testing
Tested by deploying the code changes to EKS and nodes, where we can see the actual operation instead of
UnknowRemoteOperation
:By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.