Skip to content

Add example declarative configuration doc#17854

Draft
jaydeluca wants to merge 7 commits into
open-telemetry:mainfrom
jaydeluca:example-config-doc
Draft

Add example declarative configuration doc#17854
jaydeluca wants to merge 7 commits into
open-telemetry:mainfrom
jaydeluca:example-config-doc

Conversation

@jaydeluca

@jaydeluca jaydeluca commented Apr 16, 2026

Copy link
Copy Markdown
Member

I thought it would be useful to have a "kitchen sink" doc of all the declarative config instrumentation properties, so I updated the nightly metadata updater to also maintain a new file using the metadata as a source.

@jaydeluca
jaydeluca requested a review from a team as a code owner April 16, 2026 01:21

Copilot AI 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.

Pull request overview

Adds a generated “kitchen sink” declarative-configuration YAML example to the docs, produced from instrumentation metadata as part of the nightly metadata update workflow.

Changes:

  • Add a docs analyzer output file: docs/declarative-configuration-example.yaml.
  • Add generator utilities to convert flat otel.* property names + defaults into a nested YAML structure with inline comments.
  • Update the metadata update workflow to stage the newly generated YAML file.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/utils/DeclarativeConfigYamlGenerator.java Builds a config tree from module metadata and renders it as commented YAML.
instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/utils/DeclarativeConfigConverter.java Converts flat property keys into declarative YAML paths, with a small set of special mappings.
instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/DocGeneratorApplication.java Writes the new generated declarative config example file during runAnalysis.
docs/declarative-configuration-example.yaml Generated example output intended for users to reference.
.github/workflows/metadata-update.yml Ensures the new generated file is included in automated commits.

Comment on lines +44 to +49
public static void generateConfigurationYaml(
List<InstrumentationModule> modules, BufferedWriter writer) throws IOException {

Map<String, Object> configTree = buildConfigTree(modules);

writeYaml(configTree, writer, 0);
Comment on lines +306 to +329
StringBuilder currentLine = new StringBuilder();

for (String word : words) {
// If adding this word would exceed the limit
if (currentLine.length() + word.length() + 1 > availableWidth) {
// If current line is not empty, save it and start a new line
if (!currentLine.isEmpty()) {
lines.add(currentLine.toString());
currentLine = new StringBuilder(word);
} else {
lines.add(word);
}
} else {
if (!currentLine.isEmpty()) {
currentLine.append(" ");
}
currentLine.append(word);
}
}

// Add remaining text
if (!currentLine.isEmpty()) {
lines.add(currentLine.toString());
}
Comment on lines +340 to +350
private static String formatValue(@Nullable Object value) {
if (value == null) {
return "\"\"";
}
if (value instanceof String str) {
// Quote strings if they're empty or contain special characters
if (str.isEmpty() || str.contains(":") || str.contains("#") || str.contains("\"")) {
return "\"" + str.replace("\"", "\\\"") + "\"";
}
return str;
}
Comment thread docs/declarative-configuration-example.yaml
@jaydeluca
jaydeluca marked this pull request as draft April 16, 2026 15:51
@trask trask mentioned this pull request May 5, 2026
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 18, 2026

Copy link
Copy Markdown

Pull request dashboard status

Status last refreshed: 2026-07-22 16:37:41 UTC.

  • Waiting on: Author
  • Next step: Move out of draft to request review.

This automated status or its linked feedback items may be incorrect. If something looks wrong, please report it with the result you expected.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants