First the words;
Eulogy: a speech or piece of writing that praises someone or something highly, especially a tribute to someone who has just died.

Elegy: An elegy is a sad poem, usually written to praise and express sorrow for someone who is dead. 

But eulogies, Wikipedia assures me, can also be delivered at retirement functions and other such events when a person is leaving you but not for the next world. I assume that it is not a crime to deliver a eulogy, so to speak, by simply expressing appreciation and thanks to someone who has been good to you in different ways, without any formal function or speechmaking. …

https://www.yawarbaig.com/seewithyourheart/eulogy-or-elegy/