This repository was archived by the owner on Apr 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change
1
+ Fix logcontext spam on non-Linux platforms.
Original file line number Diff line number Diff line change @@ -1712,7 +1712,7 @@ opentracing:
1712
1712
# enabled: true
1713
1713
1714
1714
# The list of homeservers we wish to send and receive span contexts and span baggage.
1715
- # See docs/opentracing.md
1715
+ # See docs/opentracing.rst
1716
1716
# This is a list of regexes which are matched against the server_name of the
1717
1717
# homeserver.
1718
1718
#
Original file line number Diff line number Diff line change 1
1
# Copyright 2014-2016 OpenMarket Ltd
2
+ # Copyright 2019 The Matrix.org Foundation C.I.C.
2
3
#
3
4
# Licensed under the Apache License, Version 2.0 (the "License");
4
5
# you may not use this file except in compliance with the License.
42
43
# exception.
43
44
resource .getrusage (RUSAGE_THREAD )
44
45
46
+ is_thread_resource_usage_supported = True
47
+
45
48
def get_thread_resource_usage ():
46
49
return resource .getrusage (RUSAGE_THREAD )
47
50
48
51
49
52
except Exception :
50
53
# If the system doesn't support resource.getrusage(RUSAGE_THREAD) then we
51
- # won't track resource usage by returning None.
54
+ # won't track resource usage.
55
+ is_thread_resource_usage_supported = False
56
+
52
57
def get_thread_resource_usage ():
53
58
return None
54
59
@@ -359,7 +364,11 @@ def stop(self):
359
364
360
365
# When we stop, let's record the cpu used since we started
361
366
if not self .usage_start :
362
- logger .warning ("Called stop on logcontext %s without calling start" , self )
367
+ # Log a warning on platforms that support thread usage tracking
368
+ if is_thread_resource_usage_supported :
369
+ logger .warning (
370
+ "Called stop on logcontext %s without calling start" , self
371
+ )
363
372
return
364
373
365
374
utime_delta , stime_delta = self ._get_cputime ()
You can’t perform that action at this time.
0 commit comments