As raised here https://stackoverflow.com/questions/55631373/telegrafstatsdlinebuilder-appears-to-have-a-race-condition, it seems we can consistently get metrics published to StatsD without common tags applied which _do_ appear on the Actuator Metrics endpoint, or when the Counter's increment is invoked by only a single thread at a time.
I've made a small Spring Boot app which seems to reliably reproduce the problem: https://github.com/bw-tom/concurrent-metrics-publisher/
@bw-tom @Autowired with an infinite loop seems to prevent from completing to start the application. Is this intentional or am I missing something?
@izeye Should only start the infinite loop once the application is ready, from my reading of https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/context/event/ApplicationReadyEvent.html!
@bw-tom As mentioned above, @Autowired seems to kick in first to me, so I鈥檓 not sure how it works for you. By the way why do you need the annotation there?
Ah, I think the Autowired actually does ~nothing~ what you describe, that's what I get for not paying close attention! An earlier version of the method had parameters that needed to be wired in, and this slipped when those moved - I've removed it 馃憤
@bw-tom Thanks for the report and the sample! I reproduced it thanks to your sample. I created #1391 to try to resolve this.
Happy to help, and thank you very much for the rapid response!