From de252f78df58c5a3c28a838d76e7fc4556148ee5 Mon Sep 17 00:00:00 2001 From: Alex Boten Date: Fri, 26 May 2023 09:36:18 -0700 Subject: [PATCH] [chore][extension/storage/db] use generated status header (#22817) This PR updates the component to generate the status table using mdatagen. Linked issue: #21213 Signed-off-by: Alex Boten --- extension/storage/dbstorage/README.md | 18 ++++++++++-------- extension/storage/dbstorage/factory.go | 11 ++++++----- .../internal/metadata/generated_status.go | 12 ++++++++++++ extension/storage/dbstorage/metadata.yaml | 7 +++++++ 4 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 extension/storage/dbstorage/internal/metadata/generated_status.go create mode 100644 extension/storage/dbstorage/metadata.yaml diff --git a/extension/storage/dbstorage/README.md b/extension/storage/dbstorage/README.md index 962ba05f1ed2..ed351b88a13f 100644 --- a/extension/storage/dbstorage/README.md +++ b/extension/storage/dbstorage/README.md @@ -1,9 +1,15 @@ # Database Storage -| Status | | -| ------------------------ |-------------------| -| Stability | [alpha] | -| Distributions | [contrib], [sumo] | + +| Status | | +| ------------- |-----------| +| Stability | [alpha] | +| Distributions | [contrib], [sumo] | + +[alpha]: https://github.com/open-telemetry/opentelemetry-collector#alpha +[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib +[sumo]: https://github.com/SumoLogic/sumologic-otel-collector + > :construction: This extension is in alpha. Configuration and functionality are subject to change. @@ -41,7 +47,3 @@ processors: exporters: nop: ``` - -[alpha]:https://github.com/open-telemetry/opentelemetry-collector#alpha -[contrib]:https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib -[sumo]: https://github.com/SumoLogic/sumologic-otel-collector diff --git a/extension/storage/dbstorage/factory.go b/extension/storage/dbstorage/factory.go index b813d224d5aa..39064bd3446f 100644 --- a/extension/storage/dbstorage/factory.go +++ b/extension/storage/dbstorage/factory.go @@ -1,6 +1,8 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +//go:generate mdatagen metadata.yaml + package dbstorage // import "github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage/dbstorage" import ( @@ -8,18 +10,17 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/extension" -) -// The value of extension "type" in configuration. -const typeStr component.Type = "db_storage" + "github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage/dbstorage/internal/metadata" +) // NewFactory creates a factory for DBStorage extension. func NewFactory() extension.Factory { return extension.NewFactory( - typeStr, + metadata.Type, createDefaultConfig, createExtension, - component.StabilityLevelAlpha, + metadata.ExtensionStability, ) } diff --git a/extension/storage/dbstorage/internal/metadata/generated_status.go b/extension/storage/dbstorage/internal/metadata/generated_status.go new file mode 100644 index 000000000000..057cd7cd31a2 --- /dev/null +++ b/extension/storage/dbstorage/internal/metadata/generated_status.go @@ -0,0 +1,12 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "go.opentelemetry.io/collector/component" +) + +const ( + Type = "db_storage" + ExtensionStability = component.StabilityLevelAlpha +) diff --git a/extension/storage/dbstorage/metadata.yaml b/extension/storage/dbstorage/metadata.yaml new file mode 100644 index 000000000000..41d299ec9c8f --- /dev/null +++ b/extension/storage/dbstorage/metadata.yaml @@ -0,0 +1,7 @@ +type: db_storage + +status: + class: extension + stability: + alpha: [extension] + distributions: [contrib, sumo]