private GradleModelHolderState withOpenTelemetry(@NotNull Function<GradleOpenTelemetry, GradleModelHolderState> action) {
    GradleTracingContext tracingContext = myTracingContext;
    if (tracingContext == null) {
      GradleOpenTelemetry noopTelemetry = new GradleOpenTelemetry();
      return action.apply(noopTelemetry);
    }

    GradleOpenTelemetry telemetry = new GradleOpenTelemetry();
    telemetry.start(tracingContext);
    GradleModelHolderState state;
    try {
      state = action.apply(telemetry);
    }
    catch (Throwable exception) {
      telemetry.shutdown();
      throw exception;
    }
    byte[] traces = telemetry.shutdown();
    return state.withOpenTelemetryTraces(traces);
  }
private GradleModelHolderState withOpenTelemetry(@NotNull Function<GradleOpenTelemetry, GradleModelHolderState> action)