Problem Description
Hello, when using instana with the boto3.s3.Bucket.upload_fileobj api we start silently failing to upload objects.
The following code works on it's own if an s3 server is listening on localhost:9000
s3 setup using minio if needed:
docker run -p 9000:9000 -p 9001:9001 --name minio -d minio/minio server /data --console-address ":9001"
Working python code:
from io import BytesIO
import boto3
s3_resource = boto3.resource(
service_name="s3",
region_name=None,
use_ssl=True,
verify=True,
endpoint_url="http://127.0.0.1:9000",
aws_access_key_id="minioadmin",
aws_secret_access_key="minioadmin",
)
bucket = s3_resource.Bucket(name="test")
bucket.upload_fileobj(BytesIO(b"somedata"), "somekey")
response = bucket.Object("somekey").get()
file_content = response["Body"].read()
assert file_content == b"somedata"
If I change this code to have an instana span like the following. I start to get an assert error:
from io import BytesIO
from instana.singletons import tracer
import boto3
s3_resource = boto3.resource(
service_name="s3",
region_name=None,
use_ssl=True,
verify=True,
endpoint_url="http://127.0.0.1:9000",
aws_access_key_id="minioadmin",
aws_secret_access_key="minioadmin",
)
bucket = s3_resource.Bucket(name="test")
with tracer.start_as_current_span("test"):
bucket.upload_fileobj(BytesIO(b"somedata"), "somekey")
response = bucket.Object("somekey").get()
file_content = response["Body"].read()
assert file_content == b"somedata"
There are two parts that are concerning to me:
- The error in
upload_fileobj is completely hidden. The function returns like normal but the upload never happens
- There is an error at all. Instana traces should not affect the underlying package operation
Minimal, Complete, Verifiable, Example
No response
Python Version
Python 3.11
Python Modules
Due to security I can't list all packages. Here is the affected versions used in the above example:
instana==3.4.1
boto3==1.35.78
botocore==1.35.78
Python Environment
Unable due to security. None of my envs start with `INSTANA` or have any affect on the above example
Problem Description
Hello, when using instana with the
boto3.s3.Bucket.upload_fileobjapi we start silently failing to upload objects.The following code works on it's own if an s3 server is listening on
localhost:9000s3 setup using minio if needed:
docker run -p 9000:9000 -p 9001:9001 --name minio -d minio/minio server /data --console-address ":9001"Working python code:
If I change this code to have an instana span like the following. I start to get an assert error:
There are two parts that are concerning to me:
upload_fileobjis completely hidden. The function returns like normal but the upload never happensMinimal, Complete, Verifiable, Example
No response
Python Version
Python 3.11
Python Modules
Python Environment
Unable due to security. None of my envs start with `INSTANA` or have any affect on the above example