mendhak / teamcity-graphite

Teamcity plugin which sends various build, code and test metrics to Graphite.
http://code.mendhak.com/teamcity-graphite/
10 stars 3 forks source link

A lot of "Could not send packet" errors are being logged #11

Closed sferencik closed 7 years ago

sferencik commented 7 years ago

The teamcity-winservice.log file contains a lot of exception messages coming from the Graphite plugin. Example:

[2017-01-04 06:00:38,784] console   [Info] TEAMCITY-GRAPHITE::: Could not send packet to Graphite [buildStageDuration.buildStepRUNNER_55 :: 4048.000000]::: exception: null
[2017-01-04 06:00:38,784] console   [Info] TEAMCITY-GRAPHITE::: Could not send packet to Graphite [buildStageDuration.artifactsPublishing :: 2090.000000]::: exception: null
[2017-01-04 06:00:38,784] console   [Info] TEAMCITY-GRAPHITE::: Could not send packet to Graphite [buildStageDuration.buildFinishing :: 234.000000]::: exception: null
[2017-01-04 06:00:38,784] console   [Info] TEAMCITY-GRAPHITE::: Could not send packet to Graphite [buildStageDuration.sourcesUpdate :: 2559.000000]::: exception: null
[2017-01-04 06:00:38,784] console   [Info] TEAMCITY-GRAPHITE::: Could not send packet to Graphite [buildStageDuration.buildStepRUNNER_127 :: 5735.000000]::: exception: null
[2017-01-04 06:00:38,784] console   [Info] TEAMCITY-GRAPHITE::: Could not send packet to Graphite [buildStageDuration.firstStepPreparation :: 15.000000]::: exception: null
[2017-01-04 06:00:39,885] console   [Info] TEAMCITY-GRAPHITE::: Could not send packet to Graphite [ArtifactsSize :: 17115]:::exception: null
[2017-01-04 06:00:39,885] console   [Info] TEAMCITY-GRAPHITE::: Could not send packet to Graphite [BuildTestStatus :: 1]::: exception: null
[2017-01-04 06:00:39,885] console   [Info] TEAMCITY-GRAPHITE::: Could not send packet to Graphite [SuccessRate :: 1]::: exception: null
[2017-01-04 06:00:39,885] console   [Info] TEAMCITY-GRAPHITE::: Could not send packet to Graphite [TimeSpentInQueue :: 5094]::: exception: null

This seems like a problem with the plugin rather than the actual configuration.

mendhak commented 7 years ago

Have you tried nc or netcat to test the connectivity from the server to Graphite?

Example: http://graphite.readthedocs.io/en/latest/feeding-carbon.html

I think you can also try telnet to see if it can connect

Unfortunately if the connectivity exists, the errors themselves say nothing so I can't say what's going wrong.

sferencik commented 7 years ago

It seems this is coming from int-parsing a null value here. Which in turn is because the plugin kicks in for any build that's finishing (any statisticValuePublished event). It doesn't seem to check if the build feature is even enabled for the build config. So build configs where the plugin isn't added as a build feature have the port equal to null and its int-parsing throws.

mendhak commented 7 years ago

I'm surprised that the feature is kicking off even for builds it's not enabled for, it's not something I had even considered, the assumption always being - the build feature's code will only be invoked if required... like a plugin. I'll have to do some testing for this when I find time.

I found your code checking to see if a feature is enabled:

https://github.com/sferencik/SinCity/blob/master/sin-city-server/src/main/java/sferencik/teamcity/sincity/SinCityBuildFeature.java#L94

so I'll follow some of that.

If you are impatient, you could do a PR for this as well, otherwise I'll have a look at this when I find some time

sferencik commented 7 years ago

Yeah, I thought as much. A colleague is testing this, he should be able to confirm that this is indeed the case (having to verify the plugin is enabled). And I believe he'll have a PR too.

mendhak commented 7 years ago

Many thanks @sferencik and @subhenduray I appreciate the time you put for this

sferencik commented 7 years ago

@subhenduray, it seems to me there's an error in the new logic. Should line 84 here say return true? Right now I see no metrics being sent at all.

subhenduray commented 7 years ago

Many thanks for reporting this @sferencik ; this is an overlook from my side. Committed a fix.