Repository: DataDog/datadog-lambda-python

Issue:
When the response of lambda contain data of type Decimal, datadog  raise except TypeError: 'decimal.Decimal' object is not iterable
## Expected Behavior
When return response from DynamoDB and DynamoDB contains data of type Decimal

## Actual Behavior
Get data of DynamoDB that contains data of type Decimal and raise next exception   **except TypeError: 'decimal.Decimal' object is not iterable**

## Steps to Reproduce the Problem

  1. Get data from Dynamodb inside handler and return response.


In the code core de [datadog_lambda](https://github.com/DataDog/datadog-lambda-python/blob/main/datadog_lambda/tag_object.py) in the line 37 raises of exception because Decimal is instance of object, but this is not iterable


  ```
    if isinstance(obj, object):
        for k in obj:
            v = obj.get(k)
            formatted_key = "{}.{}".format(key, k)
            tag_object(span, formatted_key, v, depth)
        return
  ```
 

## Specifications

  - Datadog Lambda Layer version: 
  
![Screenshot (99)](https://user-images.githubusercontent.com/23509868/157718233-7b60a357-d2b0-43ef-892e-1746177d5dfe.png)

  - Python version: 3.8
  
## Stacktrace
  
  ```
File "/opt/python/lib/python3.8/site-packages/datadog_lambda/wrapper.py", line 203, in _after
tag_object(self.span, "function.response", self.response)
File "/opt/python/lib/python3.8/site-packages/datadog_lambda/tag_object.py", line 40, in tag_object
tag_object(span, formatted_key, v, depth)
File "/opt/python/lib/python3.8/site-packages/datadog_lambda/tag_object.py", line 40, in tag_object
tag_object(span, formatted_key, v, depth)
File "/opt/python/lib/python3.8/site-packages/datadog_lambda/tag_object.py", line 40, in tag_object
tag_object(span, formatted_key, v, depth)
[Previous line repeated 4 more times]
File "/opt/python/lib/python3.8/site-packages/datadog_lambda/tag_object.py", line 37, in tag_object
for k in obj:
TypeError: 'decimal.Decimal' object is not iterable
  ```

Comments:

Patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 0d00bfc..7d7884d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -101,7 +101,7 @@ jobs:
         run: sudo yarn global add serverless@^2.72.2 --prefix /usr/local
       - name: Install Crossbuild Deps
         run: |
-          sudo apt-get update
+          sudo apt-get update --allow-releaseinfo-change --fix-missing
           sudo apt install -y qemu-user-static binfmt-support
 
       - name: Install dependencies
diff --git a/.github/workflows/check-size.yml b/.github/workflows/check-size.yml
index 69d578d..1c247e6 100644
--- a/.github/workflows/check-size.yml
+++ b/.github/workflows/check-size.yml
@@ -15,7 +15,9 @@ jobs:
           python-version: 3.7
 
       - name: Install Crossbuild Deps
-        run: sudo apt install -y qemu-user-static binfmt-support
+        run: |
+          sudo apt-get update --allow-releaseinfo-change --fix-missing
+          sudo apt install -y qemu-user-static binfmt-support
 
       - name: Install dependencies
         run: |
diff --git a/datadog_lambda/tag_object.py b/datadog_lambda/tag_object.py
index 7ca8512..02dc3eb 100644
--- a/datadog_lambda/tag_object.py
+++ b/datadog_lambda/tag_object.py
@@ -3,6 +3,7 @@
 # This product includes software developed at Datadog (https://www.datadoghq.com/).
 # Copyright 2021 Datadog, Inc.
 
+from decimal import Decimal
 import json
 import logging
 
@@ -26,7 +27,7 @@ def tag_object(span, key, obj, depth=0):
         except ValueError:
             redacted = _redact_val(key, obj[0:5000])
             return span.set_tag(key, redacted)
-    if isinstance(obj, int) or isinstance(obj, float):
+    if isinstance(obj, int) or isinstance(obj, float) or isinstance(obj, Decimal):
         return span.set_tag(key, obj)
     if isinstance(obj, list):
         for k, v in enumerate(obj):


Test patch:
diff --git a/tests/test_tag_object.py b/tests/test_tag_object.py
index 0936f0c..cdb2941 100644
--- a/tests/test_tag_object.py
+++ b/tests/test_tag_object.py
@@ -1,4 +1,5 @@
 import unittest
+from decimal import Decimal
 
 try:
     from unittest.mock import MagicMock, patch, call
@@ -82,3 +83,14 @@ class TestTagObject(unittest.TestCase):
             ],
             True,
         )
+
+    def test_decimal_tag_object(self):
+        payload = {"myValue": Decimal(500.50)}
+        spanMock = MagicMock()
+        tag_object(spanMock, "function.request", payload)
+        spanMock.set_tag.assert_has_calls(
+            [
+                call("function.request.myValue", Decimal(500.50)),
+            ],
+            True,
+        )