This module https://github.com/hypertrace/hypertrace-ingester/tree/main/hypertrace-trace-enricher/hypertrace-trace-enricher-api, has classes for building ApiTraceGraph and StructuredTraceGraph
Also this class https://github.com/hypertrace/hypertrace-ingester/blob/main/hypertrace-view-generator/hypertrace-view-generator/src/main/java/org/hypertrace/viewgenerator/generators/ViewGeneratorState.java has logic for building ViewGenerator state and threadlocal related code for caching state.
These should be moved into a different module (data-model being one option).
Also consider refactoring/optimising the Graph building logic, since it is part of a critical code path.