Skip to content

Commit

Permalink
[processor/deltatorate] Use generated headers (#21056)
Browse files Browse the repository at this point in the history
* Use generated headers

* fix lint
  • Loading branch information
TylerHelmuth authored Apr 18, 2023
1 parent 5df3130 commit 1856dfa
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 15 deletions.
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]

0 comments on commit 1856dfa

Please sign in to comment.