issue 1918: Ensure string values for span status and attribute values
Description
This aims to fix two cases where data types were deemed invalid, resulting in telemetry not being transmitted to our collector. Specifically:
- don't set the
SpanAttributes.DB_MONGODB_COLLECTIONattribute unless the collection is already a string value.
Fixes #1918
Type of change
- [X] Bug fix (non-breaking change which fixes an issue)
How Has This Been Tested?
So far, only adhoc testing has been done. Without these changes, we fail to receive telemetry data and see these logged warnings:
opentelemetry.trace.status.py, line 54 "Invalid status description type, expected str"
opentelemetry.attributes._init_.py, line 70 "Invalid type dict in attribute value sequence. Expected one of ['bool', 'str', 'bytes', 'int', 'float'] or None"
With the changes, the warnings are gone and telemetry data flows as expected. We are using pymongo 4.5.0.
Does This PR Require a Core Repo Change?
- [X] No.
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.
- [ ] Followed the style guidelines of this project
- [x] Changelogs have been updated
- [ ] Unit tests have been added
- [ ] Documentation has been updated
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: cmpilato / name: C. Michael Pilato (b62d9a647f4c2ec206c3f51ffc4e075b5bf36cb4)
@cmpilato could you please rebase this?
@xrmx Rebased as requested.
@xrmx I've added a ChangeLog entry, but unfortunately I lack the overall OTEL domain knowledge (and time) to consider a regression test. Maybe somebody could use the issue #1918 reproduction recipe to whip up such a contribution for at least the "collection isn't a string" problem?