File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -1089,7 +1089,8 @@ def label(**labels):
1089
1089
"""
1090
1090
transaction = execution_context .get_transaction ()
1091
1091
if not transaction :
1092
- if elasticapm .get_client ().config .enabled :
1092
+ client = elasticapm .get_client ()
1093
+ if not client or client .config .enabled :
1093
1094
error_logger .warning ("Ignored labels %s. No transaction currently active." , ", " .join (labels .keys ()))
1094
1095
else :
1095
1096
transaction .label (** labels )
Original file line number Diff line number Diff line change @@ -536,3 +536,7 @@ def test_check_server_version(elasticapm_client):
536
536
)
537
537
def test_user_agent (elasticapm_client , expected ):
538
538
assert elasticapm_client .get_user_agent () == "apm-agent-python/unknown (myapp{})" .format (expected )
539
+
540
+
541
+ def test_label_without_client ():
542
+ elasticapm .label (foo = "foo" )
You can’t perform that action at this time.
0 commit comments