I like pathfinder kingmaker way of revealing enemy stats. You can learn by rolling and killing enemies as far as I know.

Alternatively, I think revealing enemy stats after hitting them would make sense. For example if I use a fire cantrip, I learn if the enemy has resistance to fire. I never played dnd but I watch some games on youtube, dm would say here that " it hurts the creature but not as much as you thought." So you get a clear idea of their resistances like that. And once you know you can just know forever for that specific type of enemy. This way even if you encounter an enemy once you can still learn their resistances in combat.