Cut bacon into dices, then cook in a pot over moderate heat, stirring, until fat begins to render, 1 to 2 minutes.
Add onion and cook, stirring occasionally, until onion is golden (about 10 minutes). Add wine and boil until reduced by half (1 to 2 minutes).
Cook spaghetti in a 6 to 8 quart pot of boiling salted water.
While pasta is cooking, whisk together eggs, Parmesan, Pecorino, 1 teaspoon coarsely ground black pepper and 1/4 teaspoon salt in a small bowl.
Drain spaghetti “al dente” and add to onion mixture, then toss with tongs over moderate heat until coated.
Remove from heat and add egg mixture, tossing to combine.
Serve immediately.