Skip to content

Commit 2a8fdfe

Browse files
committed
Please the linter
1 parent e70b6f9 commit 2a8fdfe

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

Diff for: instrumentation/opentelemetry-instrumentation-elasticsearch/src/opentelemetry/instrumentation/elasticsearch/__init__.py

+3-3
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:

Diff for: instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151

5252
Article = helpers.Article
5353

54+
# pylint: disable=too-many-public-methods
55+
5456

5557
@mock.patch(
5658
"elasticsearch.connection.http_urllib3.Urllib3HttpConnection.perform_request"
@@ -491,7 +493,24 @@ def test_bulk(self, request_mock):
491493
request_mock.return_value = (1, {}, "")
492494

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

496515
spans_list = self.get_finished_spans()
497516
self.assertEqual(len(spans_list), 1)

0 commit comments

Comments
 (0)