Skip to content

Commit de54284

Browse files
committed
Please the linter
1 parent bd5e494 commit de54284

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ def wrapper(wrapped, _, args, kwargs):
247247
if body:
248248
# Don't set db.statement for bulk requests, as it can be very large
249249
if isinstance(body, dict):
250-
attributes[SpanAttributes.DB_STATEMENT] = sanitize_body(
251-
body
252-
)
250+
attributes[
251+
SpanAttributes.DB_STATEMENT
252+
] = sanitize_body(body)
253253
if params:
254254
attributes["elasticsearch.params"] = str(params)
255255
if doc_id:

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,24 @@ def test_bulk(self, request_mock):
491491
request_mock.return_value = (1, {}, "")
492492

493493
es = Elasticsearch()
494-
es.bulk([dict(_op_type="index", _index="sw", _doc_type="_doc", _id=1, doc={"name": "adam"})] * 2)
494+
es.bulk(
495+
[
496+
{
497+
"_op_type": "index",
498+
"_index": "sw",
499+
"_doc_type": "_doc",
500+
"_id": 1,
501+
"doc": {"name": "adam"},
502+
},
503+
{
504+
"_op_type": "index",
505+
"_index": "sw",
506+
"_doc_type": "_doc",
507+
"_id": 1,
508+
"doc": {"name": "adam"},
509+
},
510+
]
511+
)
495512

496513
spans_list = self.get_finished_spans()
497514
self.assertEqual(len(spans_list), 1)

0 commit comments

Comments
 (0)