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):
10891089 """
10901090 transaction = execution_context .get_transaction ()
10911091 if not transaction :
1092- if elasticapm .get_client ().config .enabled :
1092+ client = elasticapm .get_client ()
1093+ if not client or client .config .enabled :
10931094 error_logger .warning ("Ignored labels %s. No transaction currently active." , ", " .join (labels .keys ()))
10941095 else :
10951096 transaction .label (** labels )
Original file line number Diff line number Diff line change @@ -536,3 +536,7 @@ def test_check_server_version(elasticapm_client):
536536)
537537def test_user_agent (elasticapm_client , expected ):
538538 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