Skip to content
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

AWS Otel middleware not populating attributes for DynamoDB #2260

Closed
noliva opened this issue May 4, 2022 · 3 comments
Closed

AWS Otel middleware not populating attributes for DynamoDB #2260

noliva opened this issue May 4, 2022 · 3 comments

Comments

@noliva
Copy link
Contributor

noliva commented May 4, 2022

Background

When using the Otel middleware, no attributes like tableName get populated in the span.

This is how I'm instrumenting the code.

awsCfg, err := awsConfig.LoadDefaultConfig(ctx)
if err != nil {
    panic("configuration error, " + err.Error())
}

otelaws.AppendMiddlewares(&awsCfg.APIOptions)

client := dynamodb.NewFromConfig(cfg)

When the middleware is trying to detect the ServiceID here the function returns DynamoDB, however, when it later looks for the DefaultAttributeSetter it can not get the DynamoDBAttributeSetter because the servicemap looks like this

var servicemap = map[string]AttributeSetter{
	"dynamodb": DynamoDBAttributeSetter,
}

The key of the map references the signingNameKey and not the serviceIDKey.

Proposal

I believe that the servicemap should be updated to reflect the serviceIDKey, so it would look like this.

var servicemap = map[string]AttributeSetter{
	"DynamoDB": DynamoDBAttributeSetter,
}

Is that the case or am I doing something wrong in the process?

@Aneurysm9
Copy link
Member

I think your analysis is correct. Can you open a PR to update this? As the dynamodb.ServiceID constant is exported it might be best to use that rather than a string literal.

@noliva
Copy link
Contributor Author

noliva commented May 11, 2022

Thank you for looking into this, yes, I will open a PR to address this.

noliva pushed a commit to noliva/opentelemetry-go-contrib that referenced this issue May 13, 2022
…t added because of a wrong name in the servicemap.
noliva added a commit to noliva/opentelemetry-go-contrib that referenced this issue May 16, 2022
…t added because of a wrong name in the servicemap.
MrAlias added a commit that referenced this issue May 24, 2022
#2272)

* Fixed issue #2260 where attributes for DynamoDB were not added because of a wrong name in the servicemap.

* ran make precommit

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
@MrAlias
Copy link
Contributor

MrAlias commented May 24, 2022

This looks to have been resolved by #2272

@MrAlias MrAlias closed this as completed May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants