Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pkg/ottl] Add status header to readme #27896

Merged
merged 6 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/githubgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ type DependabotData struct {

func makePriority(status *Status) int {
// not an internal component such as pkg/**, and no distributions:
if len(status.Distributions) == 0 && status.Class != "" {
if (status.Class == "receiver" || status.Class == "processor" || status.Class == "exporter" || status.Class == "connector" || status.Class == "extension" || status.Class == "cmd") &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we allow pkg modules now that they can have stability levels?

Copy link
Member Author

@TylerHelmuth TylerHelmuth Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if statement makes it so the priority of pkg (and any other future group like internal) have their priority set using the switch statement below and not this special case. Without these checks, the pkg type was getting the lowest priority because it wasn't in any distributions. That resulted in make gendependabot removing ottl from the dependabot list.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks. Won't cmd modules hit the same case since they're also not in distributions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't have class set I believe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should gendependabot be affected by this change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was bc gendependabot depends on mdatagen and I had to update mdatagen to handle generating a README for a pkg. OTTL is now the first pkg to include a header in the readme and it broke some assumptions in mdatagen and githubgen.

len(status.Distributions) == 0 && status.Class != "" {
return 1
}
// start with a score of 2
Expand Down
8 changes: 5 additions & 3 deletions cmd/mdatagen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ func run(ymlPath string) error {
return fmt.Errorf("unable to create output directory %q: %w", codeDir, err)
}
if md.Status != nil {
if err = generateFile(filepath.Join(tmplDir, "status.go.tmpl"),
filepath.Join(codeDir, "generated_status.go"), md); err != nil {
return err
if md.Status.Class != "cmd" && md.Status.Class != "pkg" {
if err = generateFile(filepath.Join(tmplDir, "status.go.tmpl"),
filepath.Join(codeDir, "generated_status.go"), md); err != nil {
return err
}
}

if _, err = os.Stat(filepath.Join(ymlDir, "README.md")); err == nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/mdatagen/metadata-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parent: string
# Required for components (Optional for subcomponents): A high-level view of the development status and use of this component
status:
# Required: The class of the component (For example receiver)
class: <receiver|processor|exporter|connector|extension>
class: <receiver|processor|exporter|connector|extension|cmd|pkg>
# Required: The stability of the component - See https://github.com/open-telemetry/opentelemetry-collector#stability-levels
stability:
development: [<metrics|traces|logs|traces_to_metrics|metrics_to_metrics|logs_to_metrics|extension>]
Expand Down
2 changes: 1 addition & 1 deletion cmd/mdatagen/templates/readme.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{{- $idx = inc $idx }}
{{- end }}
{{- end}}
{{- if ne $class "cmd" }}
{{- if and (ne $class "cmd") (ne $class "pkg") }}
| Distributions | [{{ stringsJoin .Status.SortedDistributions "], [" }}] |
{{- end }}
{{- if .Status.Warnings }}
Expand Down
2 changes: 1 addition & 1 deletion cmd/mdatagen/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (s *Status) validateClass() error {
if s.Class == "" {
return errors.New("missing class")
}
if s.Class != "receiver" && s.Class != "processor" && s.Class != "exporter" && s.Class != "connector" && s.Class != "extension" && s.Class != "cmd" {
if s.Class != "receiver" && s.Class != "processor" && s.Class != "exporter" && s.Class != "connector" && s.Class != "extension" && s.Class != "cmd" && s.Class != "pkg" {
return fmt.Errorf("invalid class: %v", s.Class)
}
return nil
Expand Down
9 changes: 9 additions & 0 deletions pkg/ottl/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# OpenTelemetry Transformation Language
<!-- status autogenerated section -->
| Status | |
| ------------- |-----------|
| Stability | [alpha]: traces, metrics, logs |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Apkg%2Fottl%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Apkg%2Fottl) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Apkg%2Fottl%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Apkg%2Fottl) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@TylerHelmuth](https://www.github.com/TylerHelmuth), [@kentquirk](https://www.github.com/kentquirk), [@bogdandrutu](https://www.github.com/bogdandrutu), [@evan-bradley](https://www.github.com/evan-bradley) |

[alpha]: https://github.com/open-telemetry/opentelemetry-collector#alpha
<!-- end autogenerated section -->

The OpenTelemetry Transformation Language is a language for transforming open telemetry data based on the [OpenTelemetry Collector Processing Exploration](https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/processing.md).

Expand Down
6 changes: 6 additions & 0 deletions pkg/ottl/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

//go:generate mdatagen metadata.yaml

package ottl // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl"
5 changes: 5 additions & 0 deletions pkg/ottl/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
type: ottl

status:
class: pkg
stability:
alpha: [ traces, metrics, logs ]
codeowners:
active: [TylerHelmuth, kentquirk, bogdandrutu, evan-bradley]