Vaseline won't have any effect on bugs that fly, but ground insects will get stuck in the petrolatum jelly. Keep it off the leaves because it will damage the plant.
Put fruit in the jar and coat the rim with Vaseline. The bugs will get trapped, either trying to get to the food or trying to escape from the sticky rim.
You can also add salt over the Vaseline, which will slow them down more and can even kill them. Err on the side of caution when adding the salt since it can be hard on the plants.