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

Getting warning message from span_pointers.dynamodb #11320

Open
anna20160606 opened this issue Nov 6, 2024 · 4 comments
Open

Getting warning message from span_pointers.dynamodb #11320

anna20160606 opened this issue Nov 6, 2024 · 4 comments
Assignees

Comments

@anna20160606
Copy link

Get warning message, but looks like AWS DB update went through. What kind of error does this message indicates? Assume this exception will not break the existing function?

WARNING [ddtrace._trace.utils_botocore.span_pointers.dynamodb] [dynamodb.py:181] [dd.service=<SERVICE_NAME>.env=prod dd.version= dd.span_id=<SPAN_ID>] - failed to generate DynamoDB.UpdateItem span pointer: primary key value object must have exactly one field: 12, 2 additional messages skipped

Maybe related to this change? b98138c

@harshilprajapati96
Copy link

I am also getting similar issue, I have table with

  • hash_key: PK
  • range _key: SK

and I am getting

failed to generate DynamoDB.PutItem span pointer: primary key field PK must have exactly one value: 10

@apiarian-datadog
Copy link
Contributor

Hello! Thanks for letting us know about this. The span pointer code fails safe, so while these spans won't have span pointers associated with them, the rest of the code should work just fine.

We wrote the logic based on the documentation available to us. Perhaps the underlying boto3 api handling is more flexible than their docs had suggested?

Could you share more about the schema of the table (the primary key in particular) and an example of the boto3 api call you are making? That should help us adjust our parsing logic accordingly.

@apiarian-datadog apiarian-datadog self-assigned this Nov 8, 2024
@harshilprajapati96
Copy link

I have table with

hash_key: PK
range _key: SK

ddtrace.config.botocore["dynamodb_primary_key_names_for_tables"] = {
        f"table_name": {"PK", "SK"},
    }

Here is how I put item

item = {"PK": "something", "SK": "otherthing", "key1": "value1", "key2": "value2" }
client = boto3.resource("dynamodb")
table = client.Table(table_name)
table.put_item(Item=item)

I get

failed to generate DynamoDB.PutItem span pointer: primary key field PK must have exactly one value: 10, 1 additional messages skipped

This also happens when I only have PK no SK.

@apiarian-datadog
Copy link
Contributor

Ah, interesting. Our code currently assumes that the dynamo api is being called with value objects, not values. i.e. {"PK": {"S": "something"}, ... } rather than {"PK": "something", ...}. I couldn't get the latter working with some of the lower level APIs, but perhaps the Table version of put_item does more interesting argument processing. I'll update our code to handle this form as well.

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