Skip to content

Commit 05bf7b9

Browse files
authored
Merge branch 'main' into emptyroute
2 parents fd6fdeb + c9004bd commit 05bf7b9

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
- `opentelemetry-instrumentation-django` Fix empty span name when using
1515
`path("", ...)` ([#1788](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1788)
16+
- Fix elastic-search instrumentation sanitization to support bulk queries
17+
([#1870](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1870))
1618
- Update falcon instrumentation to follow semantic conventions
1719
([#1824](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1824))
1820

instrumentation/opentelemetry-instrumentation-elasticsearch/src/opentelemetry/instrumentation/elasticsearch/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
import json
1415

1516
sanitized_keys = (
1617
"message",
@@ -51,6 +52,9 @@ def _unflatten_dict(d):
5152

5253

5354
def sanitize_body(body) -> str:
55+
if isinstance(body, str):
56+
body = json.loads(body)
57+
5458
flatten_body = _flatten_dict(body)
5559

5660
for key in flatten_body:

instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,3 +479,7 @@ def test_body_sanitization(self, _):
479479
sanitize_body(sanitization_queries.filter_query),
480480
str(sanitization_queries.filter_query_sanitized),
481481
)
482+
self.assertEqual(
483+
sanitize_body(json.dumps(sanitization_queries.interval_query)),
484+
str(sanitization_queries.interval_query_sanitized),
485+
)

0 commit comments

Comments
 (0)