There's this thing about tragedy. It's called hamartia. It comes from the Ancient Greek, and gets worked out by Aristotle in his Poetics. Hamartia is what is commonly known as the "tragic flaw." The idea is that the main character will make some fatal mistake, some wrong turn in judgment, and the result will be a tragedy. There's a bit of debate as to whether or not this mistake is the result of a personal defect – say, pride – in which case the "tragic flaw" would be the defect itself and not the mistake.
Let's ask a question: what is David's tragic flaw? His flaw probably has to do with dishonesty, with lying both to himself and others. If David were straightforward with Giovanni and Hella from the start, it seems likely that the tragedy would be averted.
What the story is, strictly speaking, is David attempting to get the record straight. He's confessing to everything that happened and trying to present his role directly as possible. Yet here's another question: even on the last page of the book, has David admitted that he's gay?
We'll argue that he has. The reason that he has is bound up with the fact that his confession is also a romance – a tale of forbidden love. Toward the end of the novel, when Hella tells David that she loves him, he says, "Ah! I loved Giovanni–" (2.5.21). Of course, in the context, Hella can take it as platonic love, nothing sexual. Later, when she guesses that it is still Giovanni that is bothering him, David, against his will, exclaims, "He was so beautiful" (2.5.64). Within the story itself, he tiptoes around the exact nature of his love for Giovanni, but looking at the book as a whole, one can't deny that it is a romance.
And that is, in a way, the entire confession: David loved Giovanni.