DataDog / datadog-lambda-python

The Datadog AWS Lambda Layer for Python
https://docs.datadoghq.com/integrations/amazon_lambda/#installing-and-using-the-datadog-layer
Apache License 2.0
88 stars 46 forks source link

New models from AWS which include region in their name fails #521

Closed narain1 closed 1 month ago

narain1 commented 1 month ago

The logging code breaks when encountering new AWS model names that include region parameters. It was designed to handle older models with two components (provider and model name), but the new naming convention adds a third component (region), causing a ValueError during splitting.

Expected Behavior

The code should correctly extract the model provider and model name from both old and new AWS model naming conventions.

new models from AWS which have a region parameter breaks the logging to data dog

New model: us.meta.llama3-2-1b-instruct-v1:0 old model: meta.llama3-1-8b-instruct-v1:0

Actual Behavior

When a new model name with a region is encountered, the code fails with:

ValueError: too many values to unpack (expected 2)

Specifications

Stacktrace


 \"/home/ec2-user/SageMaker/.cs/conda/envs/llm/lib/python3.10/site-packages/ddtrace/contrib/internal/botocore/patch.py\", line 158, in patched_api_call\n    return patching_fn(\n  File \"/home/ec2-user/SageMaker/.cs/conda/envs/llm/lib/python3.10/site-packages/ddtrace/contrib/internal/botocore/services/bedrock.py\", line 321, in patched_bedrock_api_call\n    model_provider, model_name = params.get(\"modelId\").split(\".\")\nValueError: too many values to unpack (expected 2)\n",

let me know if i can raise a PR for this

duncanista commented 1 month ago

Hey – thanks for reaching out,

It looks like this was fixed in DataDog/dd-trace-py#10949. We might need to upgrade our internal tracer version in the layers for this change to be reflected.

Will keep updating.

narain1 commented 1 month ago

thanks for the update