Skip to content
This repository has been archived by the owner on Jan 23, 2020. It is now read-only.

Count metric for completed jobs #39

Merged
merged 1 commit into from
May 20, 2016
Merged

Count metric for completed jobs #39

merged 1 commit into from
May 20, 2016

Conversation

MadsNielsen
Copy link
Contributor

Here you go @JohnLZeller . This is the pull request for the 'count' metric.

The PR also includes the changes for the tags...which this requires. The relevant part to review would then be in the second commit of this PR.

@JohnLZeller
Copy link
Contributor

Hey @MadsNielsen!

Okay, so this PR works, but it is not the ideal way of doing this. First of all, it's not entirely accurate to use a gauge in such a way, and it'll require using rollups and things on a dashboard to make it work.

Additionally, multiple jobs finishing at the same second will not be counted correctly.
This works fine as a forked hack if someone wants to utilize it, but I have an alternative suggestion.

Let's shoot out a UDP packet to the local Dogstatsd (packaged with the datadog agent). If it's not there, the UDP packets will fall on nothing, if it is there, then the counts will be pushed up to Datadog.

Let me know if I can clarify anything here for you.

@JohnLZeller JohnLZeller added this to the Next milestone Apr 21, 2016
@JohnLZeller JohnLZeller self-assigned this Apr 21, 2016
@MadsNielsen
Copy link
Contributor Author

@JohnLZeller Sounds fine by me. I assume this is documented in your API docs so i can implement it?

@JohnLZeller
Copy link
Contributor

@MadsNielsen It's not in the API docs actually, because it's an agent feature, not a feature of the API.
http://docs.datadoghq.com/guides/dogstatsd/

@MadsNielsen
Copy link
Contributor Author

Hey @JohnLZeller

I've started working on this, and a couple of questions popped up.

  1. We probably want an url // port configuration for the statsdaemon jenkins should communicate with. We can the just default to localhost // 8125
  2. What about tags, i assume we need to attach all the same tags as we do to the build finished. Atleast job name so you can group by job name with this counter.

But i think i got the overall idea on how this works so i'm working on getting this done :)

@MadsNielsen
Copy link
Contributor Author

Hey @JohnLZeller

Another question popped up: What is your thought of using one of the excellent client libraries you're linking to in the plugin?

More specifically im lookin at this: https://github.com/indeedeng/java-dogstatsd-client

@JohnLZeller
Copy link
Contributor

@MadsNielsen Yeah, but let's use our own client fork, https://github.com/DataDog/java-dogstatsd-client

  1. Yeah let's add this as an optional global configuration, with those defaults. Let's hide this behind an Advanced options dropdown.
  2. Yeah, let's include our tags.

@JohnLZeller
Copy link
Contributor

@MadsNielsen once you've implemented the new functionality we spoke of, would you rebase this PR from master (I merged your other changes)? Thanks :)

@MadsNielsen
Copy link
Contributor Author

@JohnLZeller Okay. First draft for this feature is ready. I used your client fork for this part. The configuration now includes an Advanced section where you can specify the address to your daemon.

I found the Client reasonably ok to work with, one issue i had initially was that i just couldn't just create a new client in the onCompleted method. Since a run listener is global (one instance per Jenkins) i found that if i created the client there, and stopped is at well...it would cancel out the udp requests... :)

So...i think i figured out how to do it properly. When the global configuration page is saved. We need to pick up eventual configuration changes and create a new client for our run listener to use. And when we use the Client in the run listener, we can ask the descriptor to give us the current configured instance...

client = new NonBlockingStatsDClient("jenkins.job", hp, pp);
logger.finer(String.format("Created new dogstatsdaemon client (%s:%S)!", hp, pp));
} catch (Exception e) {
logger.log(Level.SEVERE, "Unable to crete new DogstatsClient", e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create*

@JohnLZeller
Copy link
Contributor

@MadsNielsen okay there is my first round of feedback. I'm gonna run some more tests on this :)

@MadsNielsen
Copy link
Contributor Author

@JohnLZeller Great! I tried as best to test this, i think i had a setup with like 10 jobs running at intervals pushing events to datadog. I'll wait ammending this PR until you've finished your validation inhouse so that we can finish it up in a single go.

@JohnLZeller
Copy link
Contributor

@MadsNielsen looks good, other than the nitpicks :)

@MadsNielsen
Copy link
Contributor Author

@JohnLZeller great! Im on vacation now and Will be back after next weekend. I'll fix it then. Is this ok for your release schedule.?

@JohnLZeller
Copy link
Contributor

@MadsNielsen we were hoping to release this a bit sooner actually. Would you mind if I rebased your commit and made the small changes? The commit will show up as a pair commit, but you'll still have attribution on the things you changed, and in the commit user.

@JohnLZeller
Copy link
Contributor

@MadsNielsen here is the final PR, with your permission I'd like to merge this #43

@JohnLZeller JohnLZeller merged commit b040956 into DataDog:master May 20, 2016
JohnLZeller added a commit that referenced this pull request May 20, 2016
@JohnLZeller
Copy link
Contributor

Merged #43

@MadsNielsen
Copy link
Contributor Author

Great you got it fixed! @JohnLZeller im perfectly fine with you fixing the issues you pointed out in your review while i am away😁

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants