Skip to content

Commit

Permalink
[chore] [receiver/apache] Use type generated from metadata.yaml (open…
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed May 11, 2023
1 parent 538663c commit fca3245
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 3 additions & 1 deletion receiver/apachereceiver/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/receiver/apachereceiver/internal/metadata"
)

func TestValidate(t *testing.T) {
Expand Down Expand Up @@ -97,7 +99,7 @@ func TestLoadConfig(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()

sub, err := cm.Sub(component.NewIDWithName(typeStr, "").String())
sub, err := cm.Sub(component.NewIDWithName(metadata.Type, "").String())
require.NoError(t, err)
require.NoError(t, component.UnmarshalConfig(sub, cfg))

Expand Down
2 changes: 1 addition & 1 deletion receiver/apachereceiver/documentation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[comment]: <> (Code generated by mdatagen. DO NOT EDIT.)

# apachereceiver
# apache

## Default Metrics

Expand Down
6 changes: 2 additions & 4 deletions receiver/apachereceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@ import (
)

const (
typeStr = "apache"

httpDefaultPort = "80"
httpsDefaultPort = "443"
)

// NewFactory creates a factory for apache receiver.
func NewFactory() receiver.Factory {
return receiver.NewFactory(
typeStr,
metadata.Type,
createDefaultConfig,
receiver.WithMetrics(createMetricsReceiver, metadata.MetricsStability))
}
Expand Down Expand Up @@ -86,7 +84,7 @@ func createMetricsReceiver(
}

ns := newApacheScraper(params, cfg, serverName, port)
scraper, err := scraperhelper.NewScraper(typeStr, ns.scrape, scraperhelper.WithStart(ns.start))
scraper, err := scraperhelper.NewScraper(metadata.Type, ns.scrape, scraperhelper.WithStart(ns.start))
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions receiver/apachereceiver/internal/metadata/generated_config.go

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

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

2 changes: 1 addition & 1 deletion receiver/apachereceiver/metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type: apachereceiver
type: apache

status:
class: receiver
Expand Down

0 comments on commit fca3245

Please sign in to comment.