-
Notifications
You must be signed in to change notification settings - Fork 63
feat: Extract account/access key id and region for cross-account support #1081
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
base: main
Are you sure you want to change the base?
Conversation
@@ -168,6 +187,9 @@ private Attributes generateDependencyMetricAttributes(SpanData span, Resource re | |||
setEgressOperation(span, builder); | |||
setRemoteServiceAndOperation(span, builder); | |||
setRemoteResourceTypeAndIdentifier(span, builder); | |||
setRemoteResourceAccessKeyAndRegion(span, builder); | |||
setRemoteResourceAccountIdAndRegion( |
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.
By reversing the order of these two functions, you won't need to remove AK later.
remoteRegion = domainParts[1]; | ||
} catch (Exception e) { | ||
logger.log( | ||
Level.WARNING, |
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 don't think it should be WARNING logs, it will blow user logs whenever there's a failure in the extraction.
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.
Downgraded to FINEST that has a low level value (300).
queueUrl = queueUrl.replace("https://", ""); | ||
|
||
String[] parts = queueUrl.split("/"); | ||
remoteAccountId = parts[1]; |
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.
Please check the length before getting anything using hard-coded index to avoid unexpected exceptions.
for (AttributeKey<String> attributeKey : ARN_ATTRIBUTES) { | ||
if (isKeyPresent(span, attributeKey)) { | ||
String arn = span.getAttributes().get(attributeKey); | ||
remoteAccountId = arn.split(":")[4]; |
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.
Same here for length checking.
} | ||
} | ||
|
||
if (!remoteAccountId.equals(UNKNOWN_REMOTE_ACCOUNT_ID) |
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.
Why not just set the default values to null or empty string? It seems you are not using UNKNOWN anywhere as assigned values.
@@ -52,6 +52,8 @@ final class AwsSpanProcessingUtil { | |||
static final String UNKNOWN_OPERATION = "UnknownOperation"; | |||
static final String UNKNOWN_REMOTE_SERVICE = "UnknownRemoteService"; | |||
static final String UNKNOWN_REMOTE_OPERATION = "UnknownRemoteOperation"; | |||
static final String UNKNOWN_REMOTE_ACCOUNT_ID = "UnknownRemoteAccountId"; |
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.
Why do we need it?
e8f1f43
to
6df41d3
Compare
Description of changes:
Changes in ADOT package to support cross-account observability in Java V1 & V2 SDK.
Related changes in upstream package: mxiamxia/opentelemetry-java-instrumentation#30
Testing Plan:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.