One of the most important and also overlooked elements of integrating your drumming into a melody is knowing when to stay out of the way to give it space to breathe. I can't think of better role model of letting a melody breathe in this fashion than Vernell Fournier. His playing with Ahmad Jamal's trio, most famously on the recording "Live at the Pershing", is the standard of economical, swinging, and tasteful trio drumming.
In the clip above (listen with headphones if you can), notice how Vernell is always there to play important hits and clever responses to the piano when called for. Similarly, notice how the reason these hits and responses come across so clearly is because he has played so little in between. By allowing Ahmad's spare playing to be the primary focus by giving it space, Vernell's interjections come as a welcome contrast. Just imagine what this same exact recording would sound like with a drummer who insisted on comping at every possible juncture and you can imagine how much less impact this music would have.
Listen to how those well placed bass drum accents jump out and make you pay attention.
If playing jazz is like having a conversation, think of the difference between talking to somebody who genuinely listens to you, gives you time to express yourself, and responds with a well timed and thought out response, versus somebody who insists on dominating the entire interaction by constantly talking. This same dynamic plays itself out on the bandstand all the time.
The lesson to take from Vernell's playing is to be mindful of what is going on around you, give the melody (or soloist) space to breathe, and then respond when the time is right. It's easy to forget this super important lesson in the heat of the moment, but listening to and playing along with Vernell is a great way to start absorbing his style.