Skip to content

Commit d9fa3cf

Browse files
humitosstsewd
andauthored
Logs: always log documentation size in megabytes (#10812)
* Logs: always log documentation size in megabytes This allows us to have a numeric value in the output and be able to filter it using `>` and `<` symbols on New Relic queries. * Parse it as int Co-authored-by: Santos Gallegos <[email protected]> --------- Co-authored-by: Santos Gallegos <[email protected]>
1 parent 685a255 commit d9fa3cf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

readthedocs/projects/tasks/builds.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -964,14 +964,14 @@ def store_build_artifacts(self):
964964
def _log_directory_size(self, directory, media_type):
965965
try:
966966
output = subprocess.check_output(
967-
["du", "--summarize", "--human-readable", "--", directory]
967+
["du", "--summarize", "-m", "--", directory]
968968
)
969-
# The output is something like: "1.2M\t/path/to/directory".
970-
directory_size = output.decode().split()[0]
969+
# The output is something like: "5\t/path/to/directory".
970+
directory_size = int(output.decode().split()[0])
971971
log.info(
972972
"Build artifacts directory size.",
973973
directory=directory,
974-
size=directory_size,
974+
size=directory_size, # Size in mega bytes
975975
media_type=media_type,
976976
)
977977
except Exception:

0 commit comments

Comments
 (0)