Skip to content

Commit

Permalink
Please the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
xrmx committed Mar 22, 2024
1 parent e70b6f9 commit 2a8fdfe
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ def wrapper(wrapped, _, args, kwargs):
if body:
# Don't set db.statement for bulk requests, as it can be very large
if isinstance(body, dict):
attributes[SpanAttributes.DB_STATEMENT] = sanitize_body(
body
)
attributes[
SpanAttributes.DB_STATEMENT
] = sanitize_body(body)
if params:
attributes["elasticsearch.params"] = str(params)
if doc_id:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@

Article = helpers.Article

# pylint: disable=too-many-public-methods


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

es = Elasticsearch()
es.bulk([dict(_op_type="index", _index="sw", _doc_type="_doc", _id=1, doc={"name": "adam"})] * 2)
es.bulk(
[
{
"_op_type": "index",
"_index": "sw",
"_doc_type": "_doc",
"_id": 1,
"doc": {"name": "adam"},
},
{
"_op_type": "index",
"_index": "sw",
"_doc_type": "_doc",
"_id": 1,
"doc": {"name": "adam"},
},
]
)

spans_list = self.get_finished_spans()
self.assertEqual(len(spans_list), 1)
Expand Down

0 comments on commit 2a8fdfe

Please sign in to comment.