Skip to content

Add new queue metrics with job tags#73

Merged
sarah-witt merged 24 commits into
masterfrom
sarah/add-queue-tags
Jun 24, 2020
Merged

Add new queue metrics with job tags#73
sarah-witt merged 24 commits into
masterfrom
sarah/add-queue-tags

Conversation

@sarah-witt

@sarah-witt sarah-witt commented Jun 10, 2020

Copy link
Copy Markdown
Collaborator

Requirements for Contributing to this repository

  • Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • The pull request must only fix one issue at the time.
  • The pull request must update the test suite to demonstrate the changed functionality.
  • After you create the pull request, all status checks must be pass before a maintainer reviews your contribution. For more details, please see CONTRIBUTING.

What does this PR do?

Add new queue metrics that have job_name tags.

Description of the Change

Alternate Designs

Possible Drawbacks

Verification Process

Additional Notes

Release Notes

Review checklist (to be filled by reviewers)

  • Feature or bug fix MUST have appropriate tests (unit, integration, etc...)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have one changelog/ label attached. If applicable it should have the backward-incompatible label attached.
  • PR should not have do-not-merge/ label attached.
  • If Applicable, issue must have kind/ and severity/ labels attached at least.

@sarah-witt sarah-witt changed the title Sarah/add queue tags Add job_name tag to queue metrics Jun 10, 2020
@sarah-witt
sarah-witt marked this pull request as ready for review June 10, 2020 22:25
ChristineTChen
ChristineTChen previously approved these changes Jun 10, 2020

@FlorianVeaux FlorianVeaux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It doesn't seem like this PR does what you want, see the comment I've added below.
Also I don't think modifying in place those jenkins.queue metrics will work. Ideally we would add new jenkins.queue.size_per_job metrics which would give visibility from Datadog into which jobs are filling the queue.

Last but not least, let's add a test for this.

@github-actions github-actions Bot added the documentation Documentation related changes label Jun 15, 2020
@sarah-witt sarah-witt changed the title Add job_name tag to queue metrics Add new queue metrics with job tags Jun 16, 2020
if (task instanceof Run){
job_name = ((Run)task).getParent().getFullName();
} else {
job_name = task.getFullDisplayName();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should be more careful here. I'd rather not tag (or actually set the job_name to unknown) rather than tagging by something we have no control on.
Task may be extended by any plugin, and the full display name can totally be a unique identifier which will create context explosion.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That makes sense, we would not want that. I will look into it more

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

So, I think checking for Run might also be a problem if this is the case. What do you think about going back to this suggestion: #73 (comment)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think that seems like the right approach :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated!

@sarah-witt
sarah-witt requested a review from FlorianVeaux June 22, 2020 15:46
@FlorianVeaux FlorianVeaux added the changelog/Added Added features results into a minor version bump label Jun 23, 2020
Task task = item.task;
if (task instanceof FreeStyleProject){
job_name = task.getFullDisplayName();
TagsUtil.addTagToTags(job_tags, "job_name", job_name);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's add an else clause that adds job_name:unknown. This will make queries better on Datadog

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good idea, updated!

@sarah-witt
sarah-witt merged commit 00f0a3e into master Jun 24, 2020
@sarah-witt
sarah-witt deleted the sarah/add-queue-tags branch June 24, 2020 13:28
sarah-witt added a commit that referenced this pull request Jun 24, 2020
* Add queue tags

* Add try catch

* Add queue tag

* Remove log changes

* Fix style

* Update for all tasks

* Add tests

* Add individual node metrics

* Remove dependency

* Remove comments

* Add getQueue

* Change to size

* Add more tests

* Fix readme typo

* Update readme

* Fix typo and remove import

* Remove uneeded method

* Add tags to readme

* Use new testing method

* Update metric name

* Check for freestyle project

* Add unknown tag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/Added Added features results into a minor version bump documentation Documentation related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants