Skip to content

docs: Add programmatic configuration guide using ResourceProvider#1226

Open
kuisathaverat wants to merge 1 commit intojenkinsci:mainfrom
kuisathaverat:docs/programmatic-configuration
Open

docs: Add programmatic configuration guide using ResourceProvider#1226
kuisathaverat wants to merge 1 commit intojenkinsci:mainfrom
kuisathaverat:docs/programmatic-configuration

Conversation

@kuisathaverat
Copy link
Copy Markdown
Contributor

@kuisathaverat kuisathaverat commented Feb 1, 2026

Summary

Adds comprehensive documentation for programmatically configuring service.name and service.namespace using OpenTelemetry SDK's ResourceProvider mechanism.

Changes

  • NEW: docs/programmatic-configuration.md - Complete implementation guide
    • Step-by-step ResourceProvider implementation
    • CloudBees CI real-world example
    • Configuration priority explanation
    • API stability guarantees
    • Testing and troubleshooting guidance
  • UPDATE: README.md - Add reference to programmatic configuration section

Motivation

Addresses issue #1155 - CloudBees CI users need to programmatically configure OpenTelemetry service attributes for multiple Jenkins controllers without GUI interaction.

Solution Approach

Documents the recommeDocuments the recommeDocuments the recommeDoculeDocuments autoconfigure.spi.ResourceProvider using OpenTelemetry SDK's Documents the recommeDocuments the recofitDocuments the recommeDocuments the recommeDocuments the recommeDoculeDocumentsenDocuments the recoms Documents the recommeDocuments the recommeDocuments the recommeDoculeDocuments autoconfigure.spi.ResourceProvider using OpenTelemetry SDK's Documents the rect tesDocumentss Documents the recommeDocuments the recommeDocuments the recommeDoculeDocuments ataDocuments the recommeDocuments the recommeDgratioDocuments the recommeDocuments theure additions

Closes #1155

Copilot AI review requested due to automatic review settings February 1, 2026 17:16
@kuisathaverat kuisathaverat self-assigned this Feb 1, 2026
@kuisathaverat kuisathaverat added the documentation Improvements or additions to documentation label Feb 1, 2026
@kuisathaverat kuisathaverat requested a review from a team February 1, 2026 17:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds documentation for programmatically configuring OpenTelemetry service attributes in Jenkins using the OpenTelemetry SDK’s ResourceProvider SPI, plus a README pointer to that guide.

Changes:

  • Add docs/programmatic-configuration.md with a step-by-step guide, examples (including CloudBees CI), configuration precedence, API stability notes, and testing/troubleshooting tips.
  • Update README.md to link to the new programmatic configuration guide for users managing multiple controllers or CloudBees CI installations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
docs/programmatic-configuration.md New guide describing how to implement and register a custom ResourceProvider to set service.name/service.namespace, including examples, testing guidance, and API stability notes.
README.md Adds a “Programmatic Configuration” section that links to the new guide and explains when it is useful.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +57 to +58
import io.opentelemetry.semconv.ServiceAttributes;
import io.opentelemetry.semconv.incubating.ServiceIncubatingAttributes;
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The example imports ServiceAttributes and ServiceIncubatingAttributes, but this project currently uses ResourceAttributes for service.name and service.namespace (see src/main/java/io/jenkins/plugins/opentelemetry/opentelemetry/resources/JenkinsResourceProvider.java), and with the current opentelemetry-semconv version these Service* classes may not be available, so the snippet as written is likely not to compile. Please align the example with the plugin’s current semconv usage (e.g., import and use ResourceAttributes.SERVICE_NAME / SERVICE_NAMESPACE) to ensure it compiles against the documented dependencies.

Copilot uses AI. Check for mistakes.
- `io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider` (OpenTelemetry SDK interface)
- `io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties` (OpenTelemetry SDK interface)
- `io.opentelemetry.sdk.resources.Resource` (OpenTelemetry SDK class)
- `io.opentelemetry.semconv.ServiceAttributes` (OpenTelemetry semantic conventions)
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

In the API stability list, ServiceAttributes is called out as the stable semantic-convention type, but the plugin itself currently uses ResourceAttributes for service-related resource keys. To avoid confusion and keep the docs consistent with the actual APIs in use, this bullet should either reference ResourceAttributes instead, or clearly justify why ServiceAttributes is recommended despite not being used elsewhere in this project.

Suggested change
- `io.opentelemetry.semconv.ServiceAttributes` (OpenTelemetry semantic conventions)
- `io.opentelemetry.semconv.ResourceAttributes` (OpenTelemetry semantic conventions)

Copilot uses AI. Check for mistakes.

- [OpenTelemetry SDK Autoconfiguration](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure)
- [OpenTelemetry Resource Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/resource/)
- [Example ResourceProvider Implementation](https://github.com/jenkinsci/opentelemetry-api-plugin/blob/main/src/main/java/io/jenkins/plugins/opentelemetry/api/instrumentation/resource/JenkinsResourceProvider.java)
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The "Example ResourceProvider Implementation" link path (.../api/instrumentation/resource/JenkinsResourceProvider.java) does not match the actual location in this repository (src/main/java/io/jenkins/plugins/opentelemetry/opentelemetry/resources/JenkinsResourceProvider.java), so the GitHub URL will 404. Please update the link to the correct path so readers can navigate to the example successfully.

Suggested change
- [Example ResourceProvider Implementation](https://github.com/jenkinsci/opentelemetry-api-plugin/blob/main/src/main/java/io/jenkins/plugins/opentelemetry/api/instrumentation/resource/JenkinsResourceProvider.java)
- [Example ResourceProvider Implementation](https://github.com/jenkinsci/opentelemetry-api-plugin/blob/main/src/main/java/io/jenkins/plugins/opentelemetry/opentelemetry/resources/JenkinsResourceProvider.java)

Copilot uses AI. Check for mistakes.
Add comprehensive documentation for programmatically configuring
service.name and service.namespace using OpenTelemetry SDK's
ResourceProvider mechanism.

- NEW: docs/programmatic-configuration.md - Complete implementation guide
  - Step-by-step ResourceProvider implementation
  - CloudBees CI real-world example
  - Configuration priority explanation
  - API stability guarantees
  - Testing and troubleshooting guidance
- UPDATE: README.md - Add reference to programmatic configuration

This addresses the need for CloudBees CI users to programmatically
configure OpenTelemetry service attributes for multiple Jenkins
controllers without GUI interaction.

Closes jenkinsci#1155
@kuisathaverat kuisathaverat force-pushed the docs/programmatic-configuration branch from f0f7ec2 to 443e645 Compare February 22, 2026 15:15
@ArpanC6
Copy link
Copy Markdown

ArpanC6 commented Mar 19, 2026

Great documentation addition @kuisathaverat! I reviewed the PR
and noticed Copilot identified a few issues worth addressing:

  1. Import mismatch — The example uses ServiceAttributes and
    ServiceIncubatingAttributes, but the plugin's own
    JenkinsResourceProvider.java uses ResourceAttributes for
    service.name and service.namespace. Aligning the example
    with ResourceAttributes.SERVICE_NAME / SERVICE_NAMESPACE
    would ensure the snippet compiles against the documented
    dependencies.

  2. Broken link — The "Example ResourceProvider Implementation"
    link points to .../api/instrumentation/resource/JenkinsResourceProvider.java
    which would 404. The correct path appears to be
    .../opentelemetry/resources/JenkinsResourceProvider.java.

The Windows-21 failure looks like a pre-existing timeout —
Linux-21 passed with 232 tests. Otherwise this looks ready to
merge once the above are addressed!

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

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to configure service.namespace and service.name programmatically

4 participants