docs: Add programmatic configuration guide using ResourceProvider#1226
docs: Add programmatic configuration guide using ResourceProvider#1226kuisathaverat wants to merge 1 commit intojenkinsci:mainfrom
Conversation
There was a problem hiding this comment.
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.mdwith a step-by-step guide, examples (including CloudBees CI), configuration precedence, API stability notes, and testing/troubleshooting tips. - Update
README.mdto 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.
| import io.opentelemetry.semconv.ServiceAttributes; | ||
| import io.opentelemetry.semconv.incubating.ServiceIncubatingAttributes; |
There was a problem hiding this comment.
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.
| - `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) |
There was a problem hiding this comment.
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.
| - `io.opentelemetry.semconv.ServiceAttributes` (OpenTelemetry semantic conventions) | |
| - `io.opentelemetry.semconv.ResourceAttributes` (OpenTelemetry semantic conventions) |
|
|
||
| - [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) |
There was a problem hiding this comment.
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.
| - [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) |
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
f0f7ec2 to
443e645
Compare
|
Great documentation addition @kuisathaverat! I reviewed the PR
The Windows-21 failure looks like a pre-existing timeout — |
Summary
Adds comprehensive documentation for programmatically configuring
service.nameandservice.namespaceusing OpenTelemetry SDK's ResourceProvider mechanism.Changes
docs/programmatic-configuration.md- Complete implementation guideREADME.md- Add reference to programmatic configuration sectionMotivation
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.ResourceProviderusing OpenTelemetry SDK's Documents the rect tesDocumentss Documents the recommeDocuments the recommeDocuments the recommeDoculeDocuments ataDocuments the recommeDocuments the recommeDgratioDocuments the recommeDocuments theure additionsCloses #1155