Skip to content

feat(inputs.jenkins): Allow adding build display name and description as tags - #20085

Merged
srebhan merged 2 commits into
influxdata:masterfrom
hsdfat:feat/jenkins-build-tags
Nov 13, 2026
Merged

srebhan merged 2 commits into
influxdata:masterfrom
hsdfat:feat/jenkins-build-tags

Conversation

@hsdfat

@hsdfat hsdfat commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an opt-in build_tags option to inputs.jenkins that adds the build's
displayName and/or description as tags on jenkins_job, as discussed in
the issue. Accepted values are display_name and description; anything else
is rejected in Init(). The default is empty, so existing output does not
change. Empty values are not emitted as tags. The README notes the
cardinality cost.

There is no building tag: the plugin skips builds that are still running, so
it would always be false.

Checklist

Related issues

resolves #16514

…ption as tags

Add an opt-in build_tags option that adds the build's displayName and/or
description as tags on the jenkins_job metric. The default output is unchanged.

Resolves influxdata#16514
@telegraf-tiger telegraf-tiger Bot added feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Nov 6, 2026

@skartikey skartikey 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.

@hsdfat Thanks for the contribution!

@skartikey skartikey added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Nov 11, 2026

@srebhan srebhan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your contribution @hsdfat! One suggestion from my side...

Comment thread plugins/inputs/jenkins/jenkins.go Outdated
Comment on lines +466 to +471
if j.buildTagDisplayName && b.DisplayName != "" {
tags["display_name"] = b.DisplayName
}
if j.buildTagDescription && b.Description != "" {
tags["description"] = b.Description
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How about

Suggested change
if j.buildTagDisplayName && b.DisplayName != "" {
tags["display_name"] = b.DisplayName
}
if j.buildTagDescription && b.Description != "" {
tags["description"] = b.Description
}
for _, t := range j.BuildTags {
switch t {
case "display_name":
if b.DisplayName != "" {
tags["display_name"] = b.DisplayName
}
case "description":
if b.Description != "" {
tags["description"] = b.Description
}
}

as this allows us to get rid of the two boolean and stay more extensible in the future.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Applied in 1fe1dd3, thanks. The two booleans are gone; Init() only validates the values now.

@telegraf-tiger

Copy link
Copy Markdown
Contributor

Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip.
Downloads for additional architectures and packages are available below.

⚠️ This pull request increases the Telegraf binary size by 7.30 % for linux amd64 (new size: 330.7 MB, nightly size 308.2 MB)

📦 Click here to get additional PR build artifacts

Artifact URLs

. DEB . RPM . TAR . GZ . ZIP
amd64.deb aarch64.rpm darwin_amd64.tar.gz windows_amd64.zip
arm64.deb armel.rpm darwin_arm64.tar.gz windows_arm64.zip
armel.deb armv6hl.rpm freebsd_amd64.tar.gz windows_i386.zip
armhf.deb i386.rpm freebsd_armv7.tar.gz
i386.deb ppc64le.rpm freebsd_i386.tar.gz
mips.deb riscv64.rpm linux_amd64.tar.gz
mipsel.deb s390x.rpm linux_arm64.tar.gz
ppc64el.deb x86_64.rpm linux_armel.tar.gz
riscv64.deb linux_armhf.tar.gz
s390x.deb linux_i386.tar.gz
linux_mips.tar.gz
linux_mipsel.tar.gz
linux_ppc64le.tar.gz
linux_riscv64.tar.gz
linux_s390x.tar.gz

@srebhan srebhan changed the title feat(inputs.jenkins): Add option to add build display name and description as tags feat(inputs.jenkins): Allow adding build display name and description as tags Nov 13, 2026

@srebhan srebhan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perfect. Thanks @hsdfat!

@srebhan
srebhan merged commit 904516c into influxdata:master Nov 13, 2026
29 checks passed
@github-actions github-actions Bot added this to the v1.41.0 milestone Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support to Jenkins build attributes as optional tags

3 participants