Skip to content

H-4991: Write background log files in CI and upload them on completion; Set terminal logging to WARN #7685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

TimDiekmann
Copy link
Member

🌟 What is the purpose of this PR?

When a graph error in CI happens it's very hard to find it. This is because it's spammed with INFO level logs. Sometimes these logs are helpful, but often they're not. We should set the terminal logging level in CI to WARN and emit a more verbose output to a file, which we should upload as artifact.

@TimDiekmann TimDiekmann requested a review from Copilot July 24, 2025 21:12
@github-actions github-actions bot added area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team labels Jul 24, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves CI debugging by implementing separate logging levels for terminal output and file output. The terminal logging is set to WARN level to reduce noise, while verbose INFO level logs are written to files that can be uploaded as artifacts for debugging purposes.

  • Added environment variable support for console and file logging levels
  • Configured CI to use WARN level for terminal output and INFO level for file logging
  • Enabled file logging with a dedicated log folder for CI environments

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
libs/@local/telemetry/src/logging/mod.rs Added environment variable support for console and file logging level configuration
.github/workflows/test.yml Configured CI environment variables to enable differentiated logging levels and file output

Copy link

codecov bot commented Jul 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.06%. Comparing base (73425f8) to head (26bac28).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7685   +/-   ##
=======================================
  Coverage   55.06%   55.06%           
=======================================
  Files        1082     1082           
  Lines       95328    95328           
  Branches     4514     4514           
=======================================
+ Hits        52489    52491    +2     
+ Misses      41852    41850    -2     
  Partials      987      987           
Flag Coverage Δ
apps.hash-ai-worker-ts 1.32% <ø> (ø)
apps.hash-api 0.00% <ø> (ø)
blockprotocol.type-system 35.85% <ø> (ø)
local.harpc-client 50.93% <ø> (ø)
local.hash-backend-utils 3.69% <ø> (ø)
local.hash-graph-sdk 0.00% <ø> (ø)
local.hash-isomorphic-utils 0.00% <ø> (ø)
rust.antsi 0.00% <ø> (ø)
rust.error-stack 89.09% <ø> (ø)
rust.harpc-codec 83.94% <ø> (ø)
rust.harpc-net 95.84% <ø> (+0.03%) ⬆️
rust.harpc-tower 66.34% <ø> (ø)
rust.harpc-types 0.00% <ø> (ø)
rust.harpc-wire-protocol 91.62% <ø> (ø)
rust.hash-codec 75.14% <ø> (ø)
rust.hash-graph-api 4.35% <ø> (ø)
rust.hash-graph-authorization 61.75% <ø> (ø)
rust.hash-graph-postgres-store 19.98% <ø> (ø)
rust.hash-graph-store 32.63% <ø> (ø)
rust.hash-graph-temporal-versioning 48.22% <ø> (ø)
rust.hash-graph-types 0.00% <ø> (ø)
rust.hash-graph-validation 83.15% <ø> (ø)
rust.hashql-ast 86.09% <ø> (ø)
rust.hashql-compiletest 51.45% <ø> (ø)
rust.hashql-core 81.23% <ø> (ø)
rust.hashql-diagnostics 50.24% <ø> (ø)
rust.hashql-eval 71.42% <ø> (ø)
rust.hashql-hir 85.66% <ø> (ø)
rust.hashql-syntax-jexpr 94.15% <ø> (ø)
rust.sarif 97.93% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…n; Set terminal logging to WARN

- Add environment variable support for HASH_GRAPH_LOG_CONSOLE_LEVEL and HASH_GRAPH_LOG_FILE_LEVEL
- Configure CI to use WARN level for terminal output to reduce INFO spam
- Enable INFO level file logging in var/logs for debugging purposes
- Use absolute path for log folder to ensure files are created in correct location
- Existing artifact upload will capture the log files automatically

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

Benchmark results

@rust/hash-graph-benches – Integrations

representative_read_entity

Function Value Mean Flame graphs
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$29.9 \mathrm{ms} \pm 276 \mathrm{μs}\left({\color{gray}1.54 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$29.9 \mathrm{ms} \pm 274 \mathrm{μs}\left({\color{gray}-1.622 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$30.3 \mathrm{ms} \pm 275 \mathrm{μs}\left({\color{gray}3.28 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$29.8 \mathrm{ms} \pm 290 \mathrm{μs}\left({\color{gray}-2.719 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$30.3 \mathrm{ms} \pm 313 \mathrm{μs}\left({\color{gray}1.31 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$30.6 \mathrm{ms} \pm 326 \mathrm{μs}\left({\color{gray}4.18 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1 $$29.8 \mathrm{ms} \pm 308 \mathrm{μs}\left({\color{gray}-3.523 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$30.0 \mathrm{ms} \pm 274 \mathrm{μs}\left({\color{gray}-0.830 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$29.4 \mathrm{ms} \pm 308 \mathrm{μs}\left({\color{gray}-2.570 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_linkless

Function Value Mean Flame graphs
entity_by_id 10000 entities $$21.4 \mathrm{ms} \pm 152 \mathrm{μs}\left({\color{lightgreen}-22.777 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$14.7 \mathrm{ms} \pm 91.7 \mathrm{μs}\left({\color{lightgreen}-9.518 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1 entities $$14.6 \mathrm{ms} \pm 79.1 \mathrm{μs}\left({\color{gray}-3.356 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$15.0 \mathrm{ms} \pm 101 \mathrm{μs}\left({\color{gray}2.74 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$14.0 \mathrm{ms} \pm 102 \mathrm{μs}\left({\color{gray}1.65 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_one_depth

Function Value Mean Flame graphs
entity_by_id 1 entities $$55.3 \mathrm{ms} \pm 249 \mathrm{μs}\left({\color{gray}0.222 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 50 entities $$5.34 \mathrm{s} \pm 597 \mathrm{ms}\left({\color{red}1371 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$104 \mathrm{ms} \pm 467 \mathrm{μs}\left({\color{gray}-0.252 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$258 \mathrm{ms} \pm 1.10 \mathrm{ms}\left({\color{gray}1.34 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$65.7 \mathrm{ms} \pm 497 \mathrm{μs}\left({\color{gray}-1.356 \mathrm{\%}}\right) $$ Flame Graph

scaling_read_entity_complete_zero_depth

Function Value Mean Flame graphs
entity_by_id 1 entities $$14.6 \mathrm{ms} \pm 63.1 \mathrm{μs}\left({\color{gray}-4.098 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 50 entities $$18.0 \mathrm{ms} \pm 126 \mathrm{μs}\left({\color{gray}3.34 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$15.7 \mathrm{ms} \pm 123 \mathrm{μs}\left({\color{gray}3.44 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 25 entities $$16.7 \mathrm{ms} \pm 159 \mathrm{μs}\left({\color{gray}-1.420 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 5 entities $$14.8 \mathrm{ms} \pm 106 \mathrm{μs}\left({\color{gray}0.316 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity_type

Function Value Mean Flame graphs
get_entity_type_by_id Account ID: bf5a9ef5-dc3b-43cf-a291-6210c0321eba $$8.82 \mathrm{ms} \pm 42.9 \mathrm{μs}\left({\color{gray}-0.152 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
link_by_source_by_property depths: DT=2, PT=2, ET=2, E=2 $$266 \mathrm{ms} \pm 1.57 \mathrm{ms}\left({\color{gray}1.03 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=2 $$240 \mathrm{ms} \pm 1.20 \mathrm{ms}\left({\color{gray}1.04 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=255, PT=255, ET=255, E=255 $$285 \mathrm{ms} \pm 2.44 \mathrm{ms}\left({\color{gray}1.18 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=0, E=0 $$195 \mathrm{ms} \pm 1.39 \mathrm{ms}\left({\color{gray}1.26 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=0, ET=2, E=2 $$255 \mathrm{ms} \pm 2.53 \mathrm{ms}\left({\color{gray}1.37 \mathrm{\%}}\right) $$ Flame Graph
link_by_source_by_property depths: DT=0, PT=2, ET=2, E=2 $$260 \mathrm{ms} \pm 1.77 \mathrm{ms}\left({\color{gray}1.02 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=2, PT=2, ET=2, E=2 $$134 \mathrm{ms} \pm 1.06 \mathrm{ms}\left({\color{gray}1.53 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=2 $$111 \mathrm{ms} \pm 1.05 \mathrm{ms}\left({\color{gray}0.632 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=255, PT=255, ET=255, E=255 $$152 \mathrm{ms} \pm 1.09 \mathrm{ms}\left({\color{gray}-0.534 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=0, E=0 $$102 \mathrm{ms} \pm 1.03 \mathrm{ms}\left({\color{gray}-0.338 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=0, ET=2, E=2 $$120 \mathrm{ms} \pm 943 \mathrm{μs}\left({\color{gray}1.30 \mathrm{\%}}\right) $$ Flame Graph
entity_by_property depths: DT=0, PT=2, ET=2, E=2 $$127 \mathrm{ms} \pm 861 \mathrm{μs}\left({\color{gray}1.89 \mathrm{\%}}\right) $$ Flame Graph

@TimDiekmann TimDiekmann requested a review from indietyp July 24, 2025 22:49
@TimDiekmann TimDiekmann marked this pull request as ready for review July 24, 2025 22:49
@TimDiekmann TimDiekmann enabled auto-merge July 26, 2025 15:37
@TimDiekmann TimDiekmann added this pull request to the merge queue Jul 26, 2025
Merged via the queue into main with commit 02ddb11 Jul 26, 2025
159 of 161 checks passed
@TimDiekmann TimDiekmann deleted the t/h-4991-write-background-log-files-in-ci-and-upload-them-on branch July 26, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team
Development

Successfully merging this pull request may close these issues.

2 participants