From 8a3310964ea307d38b08b6e03723095e38f07d13 Mon Sep 17 00:00:00 2001 From: Tyler Helmuth <12352919+TylerHelmuth@users.noreply.github.com> Date: Wed, 25 Oct 2023 14:48:05 -0600 Subject: [PATCH] [pkg/ottl] Add status header to readme (#27896) --- cmd/githubgen/main.go | 3 ++- cmd/mdatagen/main.go | 8 +++++--- cmd/mdatagen/metadata-schema.yaml | 2 +- cmd/mdatagen/templates/readme.md.tmpl | 2 +- cmd/mdatagen/validate.go | 2 +- pkg/ottl/README.md | 9 +++++++++ pkg/ottl/doc.go | 6 ++++++ pkg/ottl/metadata.yaml | 5 +++++ 8 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 pkg/ottl/doc.go diff --git a/cmd/githubgen/main.go b/cmd/githubgen/main.go index 55854c73fe06..7de47722cd4a 100644 --- a/cmd/githubgen/main.go +++ b/cmd/githubgen/main.go @@ -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") && + len(status.Distributions) == 0 && status.Class != "" { return 1 } // start with a score of 2 diff --git a/cmd/mdatagen/main.go b/cmd/mdatagen/main.go index e841f8a31219..5bf96cd074f1 100644 --- a/cmd/mdatagen/main.go +++ b/cmd/mdatagen/main.go @@ -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 { diff --git a/cmd/mdatagen/metadata-schema.yaml b/cmd/mdatagen/metadata-schema.yaml index 539a9527a5d1..91ab3404bcbd 100644 --- a/cmd/mdatagen/metadata-schema.yaml +++ b/cmd/mdatagen/metadata-schema.yaml @@ -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: + class: # Required: The stability of the component - See https://github.com/open-telemetry/opentelemetry-collector#stability-levels stability: development: [] diff --git a/cmd/mdatagen/templates/readme.md.tmpl b/cmd/mdatagen/templates/readme.md.tmpl index 87ad60297624..364d3ad484d4 100644 --- a/cmd/mdatagen/templates/readme.md.tmpl +++ b/cmd/mdatagen/templates/readme.md.tmpl @@ -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 }} diff --git a/cmd/mdatagen/validate.go b/cmd/mdatagen/validate.go index e1e7a8ec121f..75c61f730406 100644 --- a/cmd/mdatagen/validate.go +++ b/cmd/mdatagen/validate.go @@ -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 diff --git a/pkg/ottl/README.md b/pkg/ottl/README.md index 82ea6c5998f2..82d97db70495 100644 --- a/pkg/ottl/README.md +++ b/pkg/ottl/README.md @@ -1,4 +1,13 @@ # OpenTelemetry Transformation Language + +| 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 + 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). diff --git a/pkg/ottl/doc.go b/pkg/ottl/doc.go new file mode 100644 index 000000000000..65093fe8daed --- /dev/null +++ b/pkg/ottl/doc.go @@ -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" diff --git a/pkg/ottl/metadata.yaml b/pkg/ottl/metadata.yaml index a5288ab53293..e7333a2c5fdf 100644 --- a/pkg/ottl/metadata.yaml +++ b/pkg/ottl/metadata.yaml @@ -1,3 +1,8 @@ +type: ottl + status: + class: pkg + stability: + alpha: [ traces, metrics, logs ] codeowners: active: [TylerHelmuth, kentquirk, bogdandrutu, evan-bradley] \ No newline at end of file