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

[processor/deltatorate] Use generated headers #21056

Merged
merged 2 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 9 additions & 5 deletions processor/deltatorateprocessor/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Delta to Rate Processor
<!-- status autogenerated section -->
| Status | |
| ------------------------ |-----------|
| Stability | [development] |
| Supported pipeline types | metrics |
| Distributions | [contrib] |

| Status | |
|--------------------------|---------------|
| Stability | [development] |
| Supported pipeline types | metrics |
| Distributions | [contrib] |
[development]: https://github.com/open-telemetry/opentelemetry-collector#development
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
<!-- end autogenerated section -->

**Status: under development; Not recommended for production usage.**

Expand Down
6 changes: 4 additions & 2 deletions processor/deltatorateprocessor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor/internal/metadata"
)

func TestLoadConfig(t *testing.T) {
Expand All @@ -33,7 +35,7 @@ func TestLoadConfig(t *testing.T) {
errorMessage string
}{
{
id: component.NewIDWithName(typeStr, ""),
id: component.NewIDWithName(metadata.Type, ""),
expected: &Config{
Metrics: []string{
"metric1",
Expand All @@ -42,7 +44,7 @@ func TestLoadConfig(t *testing.T) {
},
},
{
id: component.NewIDWithName(typeStr, "missing_name"),
id: component.NewIDWithName(metadata.Type, "missing_name"),
errorMessage: "metric names are missing",
},
}
Expand Down
2 changes: 2 additions & 0 deletions processor/deltatorateprocessor/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate mdatagen metadata.yaml

// package deltatorateprocessor implements a processor which
// converts delta sum metrics to rates.
package deltatorateprocessor // import "github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor"
11 changes: 3 additions & 8 deletions processor/deltatorateprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,18 @@ import (
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/collector/processor/processorhelper"
)

const (
// The value of "type" key in configuration.
typeStr = "deltatorate"
// The stability level of the processor.
stability = component.StabilityLevelDevelopment
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatorateprocessor/internal/metadata"
)

var processorCapabilities = consumer.Capabilities{MutatesData: true}

// NewFactory returns a new factory for the Delta to Rate processor.
func NewFactory() processor.Factory {
return processor.NewFactory(
typeStr,
metadata.Type,
createDefaultConfig,
processor.WithMetrics(createMetricsProcessor, stability))
processor.WithMetrics(createMetricsProcessor, metadata.Stability))
}

func createDefaultConfig() component.Config {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions processor/deltatorateprocessor/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: deltatorate

status:
class: processor
stability: development
pipelines: [metrics]
distributions: [contrib]