Skip to content

Commit 3b16d8c

Browse files
Fix AttributeError in sync httpx instrumentation (#1423)
* Fix AttributeError in sync httpx instrumentation Closes 1422 * Link PR Co-authored-by: Colton Myers <colton.myers@gmail.com>
1 parent 2eb6436 commit 3b16d8c

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

CHANGELOG.asciidoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@ endif::[]
1818
===== Bug fixes
1919
////
2020
21-
//=== Unreleased
21+
=== Unreleased
2222
2323
// Unreleased changes go here
2424
// When the next release happens, nest these changes under the "Python Agent version 6.x" heading
2525
//[float]
2626
//===== Features
2727
//
2828
//
29-
//[float]
30-
//===== Bug fixes
29+
[float]
30+
===== Bug fixes
31+
* fix AttributeError in sync instrumentation of httpx {pull}1423[1423]
3132
3233
3334
[[release-notes-6.x]]

elasticapm/instrumentation/packages/httpx/sync/httpcore.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ def mutate_unsampled_call_args(self, module, method, wrapped, instance, args, kw
9191
trace_parent = transaction.trace_parent.copy_from(
9292
span_id=transaction.id, trace_options=TracingOptions(recorded=False)
9393
)
94-
if "headers" in kwargs:
95-
headers = kwargs["headers"]
96-
if headers is None:
97-
headers = []
98-
kwargs["headers"] = headers
99-
self._set_disttracing_headers(headers, trace_parent, transaction)
94+
headers = utils.get_request_data(args, kwargs)[2]
95+
utils.set_disttracing_headers(headers, trace_parent, transaction)
10096
return args, kwargs

0 commit comments

Comments
 (0)