Skip to content

Commit 767b013

Browse files
[cmd/mdatagen] Fix the extra blank line in the documentation template (#15459)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Fixes the extra line in the documentation.md between extended description and table Similar to #15307 <!-- Issue number if applicable --> #### Link to tracking issue Fixes #15458 <!--Describe what testing was performed and which tests were added.--> #### Testing Local testing with one of the component. <!--Describe the documentation added.--> #### Documentation <!--Authorship attestation. See AGENTS.md for details. AI agents must not check this box on behalf of the user; the human author must check it themselves before the PR is ready for review.--> #### Authorship - [x] I, a human, wrote this pull request description myself. <!--Please delete paragraphs that you did not use before submitting.-->
1 parent eee19bc commit 767b013

4 files changed

Lines changed: 34 additions & 7 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: 'bug_fix'
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. receiver/otlp)
7+
component: cmd/mdatagen
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Removes the extra line in the documentation.md between extended description and table
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [15458]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: []

cmd/mdatagen/internal/loader_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ func TestLoadMetadata(t *testing.T) {
437437
Signal: Signal{
438438
Enabled: true,
439439
Description: "[DEPRECATED] Non-monotonic delta sum double metric enabled by default.",
440-
ExtendedDocumentation: "The metric will be removed soon.",
440+
ExtendedDocumentation: "The metric will be removed soon.\n",
441441
Stability: component.StabilityLevelDeprecated,
442442
Warnings: Warnings{
443443
IfEnabled: "This metric is deprecated and will be removed soon.",
@@ -485,7 +485,7 @@ func TestLoadMetadata(t *testing.T) {
485485
Signal: Signal{
486486
Enabled: false,
487487
Description: "[DEPRECATED] Example event disabled by default.",
488-
ExtendedDocumentation: "The event will be renamed soon.",
488+
ExtendedDocumentation: "The event will be renamed soon.\n",
489489
Warnings: Warnings{
490490
IfConfigured: "This event is deprecated and will be renamed soon.",
491491
},

cmd/mdatagen/internal/samplereceiver/metadata.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ events:
209209
default.event.to_be_renamed:
210210
enabled: false
211211
description: "[DEPRECATED] Example event disabled by default."
212-
extended_documentation: The event will be renamed soon.
212+
extended_documentation: |
213+
The event will be renamed soon.
213214
attributes: [string_attr, boolean_attr, boolean_attr2, conditional_string_attr]
214215
warnings:
215216
if_configured: This event is deprecated and will be renamed soon.
@@ -245,7 +246,8 @@ metrics:
245246
default.metric.to_be_removed:
246247
enabled: true
247248
description: "[DEPRECATED] Non-monotonic delta sum double metric enabled by default."
248-
extended_documentation: The metric will be removed soon.
249+
extended_documentation: |
250+
The metric will be removed soon.
249251
stability: deprecated
250252
deprecated:
251253
since: "1.0.0"

cmd/mdatagen/internal/templates/documentation.md.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
{{- if $metric.ExtendedDocumentation }}
1010

11-
{{ $metric.ExtendedDocumentation }}
11+
{{ trimRight $metric.ExtendedDocumentation "\n" }}
1212

1313
{{- end }}
1414

@@ -68,7 +68,7 @@ When the disable-old gate is enabled, emission of this metric is suppressed. Whe
6868

6969
{{- if $event.ExtendedDocumentation }}
7070

71-
{{ $event.ExtendedDocumentation }}
71+
{{ trimRight $event.ExtendedDocumentation "\n" }}
7272

7373
{{- end }}
7474

@@ -105,7 +105,7 @@ When the disable-old gate is enabled, emission of this metric is suppressed. Whe
105105

106106
{{- if $metric.ExtendedDocumentation }}
107107

108-
{{ $metric.ExtendedDocumentation }}
108+
{{ trimRight $metric.ExtendedDocumentation "\n" }}
109109

110110
{{- end }}
111111

0 commit comments

Comments
 (0)