Skip to content

Commit 17f964d

Browse files
thc1006steveyiyo
andcommitted
Fix CI failures: add display_name support and fix auto-generation
- Add 'nodisplayname' to spell-check dictionary - Remove incorrect auto-generation of DisplayName in loader.go - Update test expectations for optional display_name field - Add explicit display_name to test metadata files Co-authored-by: SteveYi <[email protected]>
1 parent a029c2a commit 17f964d

File tree

9 files changed

+9
-13
lines changed

9 files changed

+9
-13
lines changed

.github/workflows/utils/cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@
320320
"nonclobbering",
321321
"nopexporter",
322322
"nopreceiver",
323+
"nodisplayname",
323324
"nosuchprocessor",
324325
"notls",
325326
"obsreceiver",

cmd/mdatagen/internal/loader.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ func LoadMetadata(filePath string) (Metadata, error) {
5959
if md.GeneratedPackageName == "" {
6060
md.GeneratedPackageName = "metadata"
6161
}
62-
if md.DisplayName == "" {
63-
md.DisplayName = generateDefaultDisplayName(md.Type)
64-
}
6562

6663
if err := md.Validate(); err != nil {
6764
return md, err
@@ -73,13 +70,6 @@ func LoadMetadata(filePath string) (Metadata, error) {
7370
return md, nil
7471
}
7572

76-
func generateDefaultDisplayName(componentType string) string {
77-
if componentType == "" {
78-
return ""
79-
}
80-
return strings.ToUpper(componentType[:1]) + componentType[1:]
81-
}
82-
8373
var componentTypes = []string{
8474
"connector",
8575
"exporter",

cmd/mdatagen/internal/loader_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ func TestLoadMetadata(t *testing.T) {
559559
name: "testdata/no_display_name.yaml",
560560
want: Metadata{
561561
Type: "nodisplayname",
562-
DisplayName: "Nodisplayname",
562+
DisplayName: "",
563563
GeneratedPackageName: "metadata",
564564
ScopeName: "go.opentelemetry.io/collector/cmd/mdatagen/internal/testdata",
565565
PackageName: "go.opentelemetry.io/collector/cmd/mdatagen/internal/testdata",

cmd/mdatagen/internal/samplereceiver/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ This receiver is used for testing purposes to check the output of mdatagen.
44
# Sample
55

66
<!-- status autogenerated section -->
7+
# Sample
78
| Status | |
89
| ------------- |-----------|
910
| Stability | [deprecated]: profiles |

cmd/mdatagen/internal/samplereceiver/metadata.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Sample metadata file with all available configurations for a receiver.
22

33
type: sample
4+
display_name: Sample
45
scope_name: go.opentelemetry.io/collector/internal/receiver/samplereceiver
56
github_project: open-telemetry/opentelemetry-collector
67

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
<!-- status autogenerated section -->
12
{{- if .DisplayName }}
23
# {{ .DisplayName }}
34

4-
{{ end -}}
5-
<!-- status autogenerated section -->
5+
{{- end }}
66
{{- if len .Status.Stability }}
77
| Status | |
88
| ------------- |-----------|

cmd/mdatagen/internal/testdata/empty_test_config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
type: test
2+
display_name: Test
23

34
status:
45
class: receiver

cmd/mdatagen/internal/testdata/generated_package_name.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
type: custom
2+
display_name: Custom
23

34
generated_package_name: customname
45

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
type: subcomponent
2+
display_name: Subcomponent
23

34
parent: parentComponent

0 commit comments

Comments
 (0)