Skip to content

Commit 29aaad3

Browse files
authored
[chore] Generate codecov badge for all READMEs (#12962)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description <!-- Issue number if applicable --> Adds a CodeCov status badge unless explicitly disabled. I have disabled this in core until we roll this out in contrib to show the Go SIG and move codecovgen to build tools #### Link to tracking issue Updates open-telemetry/opentelemetry-collector-contrib/issues/39583
1 parent 84888ad commit 29aaad3

File tree

52 files changed

+117
-13
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+117
-13
lines changed

cmd/builder/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: builder
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: cmd
67
stability:
78
alpha: [metrics]

cmd/mdatagen/internal/command_test.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -576,12 +576,13 @@ Some info about a component
576576
Type: "foo",
577577
ShortFolderName: "foo",
578578
Status: &Status{
579-
Stability: stability,
580-
Distributions: tt.distros,
581-
Class: tt.componentClass,
582-
Warnings: tt.warnings,
583-
Codeowners: tt.codeowners,
584-
Deprecation: tt.deprecation,
579+
DisableCodeCov: true,
580+
Stability: stability,
581+
Distributions: tt.distros,
582+
Class: tt.componentClass,
583+
Warnings: tt.warnings,
584+
Codeowners: tt.codeowners,
585+
Deprecation: tt.deprecation,
585586
},
586587
}
587588
tmpdir := t.TempDir()

cmd/mdatagen/internal/loader_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ func TestLoadMetadata(t *testing.T) {
2727
Type: "sample",
2828
SemConvVersion: "1.9.0",
2929
Status: &Status{
30-
Class: "receiver",
30+
DisableCodeCov: true,
31+
Class: "receiver",
3132
Stability: map[component.StabilityLevel][]string{
3233
component.StabilityLevelDevelopment: {"logs"},
3334
component.StabilityLevelBeta: {"traces"},

cmd/mdatagen/internal/metadata.go

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ type Metadata struct {
4545
Tests Tests `mapstructure:"tests"`
4646
}
4747

48+
func (md Metadata) GetCodeCovComponentID() string {
49+
if md.Status.CodeCovComponentID != "" {
50+
return md.Status.CodeCovComponentID
51+
}
52+
53+
return strings.ReplaceAll(md.Status.Class+"_"+md.Type, "/", "_")
54+
}
55+
4856
func (md *Metadata) Validate() error {
4957
var errs error
5058
if err := md.validateType(); err != nil {

cmd/mdatagen/internal/metadata_test.go

+43
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,46 @@ func contains(r string, rs []string) bool {
179179
}
180180
return false
181181
}
182+
183+
func TestCodeCovID(t *testing.T) {
184+
tests := []struct {
185+
md Metadata
186+
want string
187+
}{
188+
{
189+
md: Metadata{
190+
Type: "aes",
191+
Status: &Status{
192+
Class: "provider",
193+
CodeCovComponentID: "my_custom_id",
194+
},
195+
},
196+
want: "my_custom_id",
197+
},
198+
{
199+
md: Metadata{
200+
Type: "count",
201+
Status: &Status{
202+
Class: "connector",
203+
},
204+
},
205+
want: "connector_count",
206+
},
207+
{
208+
md: Metadata{
209+
Type: "file",
210+
Status: &Status{
211+
Class: "exporter",
212+
},
213+
},
214+
want: "exporter_file",
215+
},
216+
}
217+
218+
for _, tt := range tests {
219+
t.Run(tt.md.Type, func(t *testing.T) {
220+
got := tt.md.GetCodeCovComponentID()
221+
assert.Equal(t, tt.want, got)
222+
})
223+
}
224+
}

cmd/mdatagen/internal/sampleconnector/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ github_project: open-telemetry/opentelemetry-collector
66
sem_conv_version: 1.9.0
77

88
status:
9+
disable_codecov_badge: true
910
class: connector
1011
stability:
1112
development: [metrics_to_metrics]

cmd/mdatagen/internal/sampleprocessor/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ github_project: open-telemetry/opentelemetry-collector
77
sem_conv_version: 1.9.0
88

99
status:
10+
disable_codecov_badge: true
1011
class: processor
1112
stability:
1213
development: [logs]

cmd/mdatagen/internal/samplereceiver/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ github_project: open-telemetry/opentelemetry-collector
77
sem_conv_version: 1.9.0
88

99
status:
10+
disable_codecov_badge: true
1011
class: receiver
1112
stability:
1213
development: [logs]

cmd/mdatagen/internal/samplescraper/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ github_project: open-telemetry/opentelemetry-collector
66
sem_conv_version: 1.9.0
77

88
status:
9+
disable_codecov_badge: true
910
class: scraper
1011
stability:
1112
stable: [metrics]

cmd/mdatagen/internal/status.go

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ type Status struct {
4949
Codeowners *Codeowners `mapstructure:"codeowners"`
5050
UnsupportedPlatforms []string `mapstructure:"unsupported_platforms"`
5151
Deprecation DeprecationMap `mapstructure:"deprecation"`
52+
CodeCovComponentID string `mapstructure:"codecov_component_id"`
53+
DisableCodeCov bool `mapstructure:"disable_codecov_badge"`
5254
}
5355

5456
type DeprecationMap map[string]DeprecationInfo

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

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
{{- end }}
2929
{{- if ne $class "" }}
3030
| Issues | [![Open issues](https://img.shields.io/github/issues-search/{{ .GithubProject }}?query=is%3Aissue%20is%3Aopen%20label%3A{{ $class }}%2F{{ $shortName }}%20&label=open&color=orange&logo=opentelemetry)](https://github.com/{{ .GithubProject }}/issues?q=is%3Aopen+is%3Aissue+label%3A{{ $class }}%2F{{ $shortName }}) [![Closed issues](https://img.shields.io/github/issues-search/{{ .GithubProject }}?query=is%3Aissue%20is%3Aclosed%20label%3A{{ $class }}%2F{{ $shortName }}%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/{{ .GithubProject }}/issues?q=is%3Aclosed+is%3Aissue+label%3A{{ $class }}%2F{{ $shortName }}) |
31+
{{- if not .Status.DisableCodeCov }}
32+
| Code coverage | [![codecov](https://codecov.io/github/{{ .GithubProject }}/graph/main/badge.svg?component={{ .GetCodeCovComponentID }})](https://app.codecov.io/gh/{{ .GithubProject}}/tree/main/?components%5B0%5D={{ .GetCodeCovComponentID }}&displayType=list) |
33+
{{- end }}
3134
{{- end }}
3235
{{- if .Status.Codeowners }}
3336
{{- $codeowners := userLinks .Status.Codeowners.Active }}

cmd/mdatagen/internal/testdata/with_goleak_ignores.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
type: foobar
22

33
status:
4+
disable_codecov_badge: true
45
class: connector
56
stability:
67
beta: [traces_to_metrics, traces_to_traces, traces_to_logs, metrics_to_logs, metrics_to_metrics, metrics_to_traces, logs_to_logs, logs_to_metrics, logs_to_traces]
@@ -11,4 +12,4 @@ tests:
1112
top:
1213
- "testfunc1"
1314
any:
14-
- "testfunc2"
15+
- "testfunc2"
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
type: foobar
22

33
status:
4+
disable_codecov_badge: true
45
class: connector
56
stability:
67
beta: [traces_to_metrics, traces_to_traces, traces_to_logs, metrics_to_logs, metrics_to_metrics, metrics_to_traces, logs_to_logs, logs_to_metrics, logs_to_traces]
78

89
tests:
910
goleak:
10-
setup: "setupFunc()"
11+
setup: "setupFunc()"
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
type: foobar
22

33
status:
4+
disable_codecov_badge: true
45
class: connector
56
stability:
67
beta: [traces_to_metrics, traces_to_traces, traces_to_logs, metrics_to_logs, metrics_to_metrics, metrics_to_traces, logs_to_logs, logs_to_metrics, logs_to_traces]
78

89
tests:
910
goleak:
10-
skip: true
11+
skip: true
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
type: foobar
22

33
status:
4+
disable_codecov_badge: true
45
class: connector
56
stability:
67
beta: [traces_to_metrics, traces_to_traces, traces_to_logs, metrics_to_logs, metrics_to_metrics, metrics_to_traces, logs_to_logs, logs_to_metrics, logs_to_traces]
78

89
tests:
910
goleak:
10-
teardown: "teardownFunc()"
11+
teardown: "teardownFunc()"
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
type: foobar
22

33
status:
4+
disable_codecov_badge: true
45
class: connector
56
stability:
67
beta: [traces_to_metrics, traces_to_traces, traces_to_logs, metrics_to_logs, metrics_to_metrics, metrics_to_traces, logs_to_logs, logs_to_metrics, logs_to_traces]

cmd/mdatagen/metadata.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ type: mdatagen
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: cmd
67
stability:
78
alpha: [metrics]
89
codeowners:
9-
active: [dmitryax]
10+
active: [dmitryax]

confmap/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: confmap
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
codeowners:
67
active:
78
- mx-psi

confmap/provider/envprovider/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: env
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: provider
67
stability:
78
stable: [provider]

confmap/provider/fileprovider/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: file
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: provider
67
stability:
78
stable: [provider]

confmap/provider/httpprovider/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: http
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: provider
67
stability:
78
stable: [provider]

confmap/provider/httpsprovider/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: https
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: provider
67
stability:
78
stable: [provider]

confmap/provider/yamlprovider/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: yaml
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: provider
67
stability:
78
stable: [provider]

connector/forwardconnector/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: forward
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: connector
67
stability:
78
beta: [traces_to_traces, metrics_to_metrics, logs_to_logs]

connector/xconnector/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: xconnector
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: pkg
67
codeowners:
78
active:

consumer/xconsumer/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: xconsumer
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: consumer
67
codeowners:
78
active:

docs/rfcs/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: rfcs
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: docs
67
codeowners:
78
active:

exporter/debugexporter/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: debug
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
codeowners:
67
active:
78
- andrzej-stencel

exporter/exporterhelper/internal/queuebatch/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: queuebatch
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: pkg
67
stability:
78
beta: [traces, metrics, logs]

exporter/exporterhelper/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: exporterhelper
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
codeowners:
67
active:
78
- BogdanDrutu

exporter/exporterhelper/xexporterhelper/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: xexporterhelper
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: pkg
67
codeowners:
78
active:

exporter/nopexporter/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: nop
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
codeowners:
67
active:
78
- evan-bradley

exporter/otlpexporter/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: otlp
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: exporter
67
stability:
78
stable: [traces, metrics, logs]

exporter/otlphttpexporter/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: otlphttp
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: exporter
67
stability:
78
stable: [traces, metrics, logs]

exporter/xexporter/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: xexporter
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: pkg
67
codeowners:
78
active:

extension/memorylimiterextension/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: memory_limiter
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: extension
67
stability:
78
development: [extension]

extension/xextension/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: xextension
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: extension
67
codeowners:
78
stability:

extension/xextension/storage/metadata.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ type: xextension
22
github_project: open-telemetry/opentelemetry-collector
33

44
status:
5+
disable_codecov_badge: true
56
class: extension
67
codeowners:
78
active:

0 commit comments

Comments
 (0)