-
Notifications
You must be signed in to change notification settings - Fork 40
AWS SDK Instrumentation should use AWS SDK values for rpc
attributes
#160
Comments
You are right
Looks like in v2 we can use the Do you know if What do you think? |
There is a conversation about this issue exactly in the PR which added it to the spec, it looks like we should use the serviceIdentifier for Copying the conversation here for reference:
|
rpc
attributesrpc
attributes
Thank you for your thoughtful reply! 😄 Thanks for posting that thread, yes I think using And then for
But hopefully that small change wouldn't break anyone using this instrumentation 🙂 |
@blumamir I made a pull request to update these |
According to the cited thread you should be able to retrieve the operation name from the metadata. I would create a spec issue, asking for clarification. My gut feeling is that in doubt you should rather report what you have as-is than doing any string manipulation. |
@NathanielRN thanks, I commented on the PR. just fix the tests and I think it's good to go |
Thank you @Oberon00 for taking the time to read and comment here. I agree with your comment in general. Unfortunately, for aws-sdk js the situation is very complex: in v2, the operation name is set with PascalCase in the apis (see example) but then later on changed to camelCase somewhere in the code which is what is accessible to the patching code. I think that the sentence "as returned by the AWS SDK" is simply not valid for JS sdk specifically. Since the spec is (deliberately?) blurry about what value should be set for these attributes, I'm ok with applying common sense and produce values (i.e |
@anuraaga please take a look, it seems like the spec could use some improvement in that area. |
Maybe instead of saying "as returned by the AWS SDK", the spec can explicitly point to a table of the expected service names? That way the spec does not have to tell the SDKs how to set that value, only what value it needs to set. However I don't think I would suggest that for operation name, because that table would be much, much, larger. |
The spec can state the values should always be PascalCase to match the way they are documented in the api reference |
Recently there has been convergence of AWS API definitions on Smithy. I think the field in the Smithy model that matches what we want here is the https://awslabs.github.io/smithy/1.0/spec/aws/aws-core.html#cloudformationname It's generally the pascal space without spaces I think. I think we at AWS need to start an internal discussion with the AWS SDK team to ensure this field is available in any smithy-based SDK (JS v3, Go v2, Rust currently) at the least, for use in observability. So far I haven't found an authoritative source for the models, each SDK seems to vendor them in https://github.com/aws/aws-sdk-js-v3/tree/main/codegen/sdk-codegen/aws-models So referencing those for the value within the spec is one approach. It looks too tedious though, so will check with the SDKs team if we can simplify this. |
@anuraaga And in the meantime, should we update the spec to require normalization to PascalCase, or clarify that the raw value should be used even if different languages may have different results in the meantime? Or do we leave it unclear until you got feedback from the SDK teams? |
@Oberon00 Sure I filed open-telemetry/opentelemetry-specification#1851 to provide a fallback for now. |
@anuraaga @Oberon00 - thanks for bringing it up and creating the relevant fix in the spec. After the spec update, I believe that we are spec compliant in regards to rpc attributes. Let's wait for the spec PR to be merged and then we can close this issue, right? unless someone spots something else that needs our attention |
Description
In the aws sdk instrumentation package,
rpc
attributes are set from thenormalizedRequest
.opentelemetry-ext-js/packages/instrumentation-aws-sdk/src/utils.ts
Lines 40 to 47 in 243e19b
normalizedRequest
(v2 and v3) modify the request metadata values returned from the AWS SDK like this:opentelemetry-ext-js/packages/instrumentation-aws-sdk/src/utils.ts
Lines 15 to 23 in 243e19b
Specifically:
service
name.toLowerCase()
operation
name.toCamelCase()
However, the specs for AWS SDK instrumentation give examples that contradict these patterns.
Action Items
Based on the examples, we should return
S3
instead ofs3
andListBuckets
instead oflistBuckets
(for example).This means using
toUpperCase()
and a modified version oftoCamelCase()
with the first character Upper Case.The text was updated successfully, but these errors were encountered: