Determine whether or not we can send usage stats to the server. The logic is as follows: - By default, it should be enabled. - Three environment variables can disable it: - DO_NOT_TRACK=1
()
| 57 | |
| 58 | |
| 59 | def is_usage_stats_enabled(): |
| 60 | """Determine whether or not we can send usage stats to the server. |
| 61 | The logic is as follows: |
| 62 | - By default, it should be enabled. |
| 63 | - Three environment variables can disable it: |
| 64 | - DO_NOT_TRACK=1 |
| 65 | """ |
| 66 | global _USAGE_STATS_ENABLED |
| 67 | if _USAGE_STATS_ENABLED is None: |
| 68 | do_not_track = envs.DO_NOT_TRACK |
| 69 | |
| 70 | _USAGE_STATS_ENABLED = not do_not_track |
| 71 | return _USAGE_STATS_ENABLED |
| 72 | |
| 73 | |
| 74 | def get_current_timestamp_ns() -> int: |
no outgoing calls