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

[chore][receiver/skywalking] create metadata #21712

Merged
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
16 changes: 9 additions & 7 deletions receiver/skywalkingreceiver/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Skywalking Receiver

| Status | |
| ------------------------ |---------------|
| Stability | [beta] |
| Supported pipeline types | traces |
| Distributions | [contrib] |
<!-- status autogenerated section -->
| Status | |
| ------------- |-----------|
| Stability | [beta]: traces |
| Distributions | [contrib] |

[beta]: https://github.com/open-telemetry/opentelemetry-collector#beta
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
<!-- end autogenerated section -->

Receives trace data in [Skywalking](https://skywalking.apache.org/) format.

Expand Down Expand Up @@ -35,5 +39,3 @@ service:
receivers: [skywalking]
```

[beta]: https://github.com/open-telemetry/opentelemetry-collector#beta
[contrib]: https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
8 changes: 5 additions & 3 deletions receiver/skywalkingreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/skywalkingreceiver/internal/metadata"
)

func TestLoadConfig(t *testing.T) {
Expand All @@ -38,11 +40,11 @@ func TestLoadConfig(t *testing.T) {
expected component.Config
}{
{
id: component.NewIDWithName(typeStr, ""),
id: component.NewIDWithName(metadata.Type, ""),
expected: createDefaultConfig(),
},
{
id: component.NewIDWithName(typeStr, "customname"),
id: component.NewIDWithName(metadata.Type, "customname"),
expected: &Config{
Protocols: Protocols{
HTTP: &confighttp.HTTPServerSettings{
Expand All @@ -52,7 +54,7 @@ func TestLoadConfig(t *testing.T) {
},
},
{
id: component.NewIDWithName(typeStr, "defaults"),
id: component.NewIDWithName(metadata.Type, "defaults"),
expected: &Config{
Protocols: Protocols{
GRPC: &configgrpc.GRPCServerSettings{
Expand Down
17 changes: 17 additions & 0 deletions receiver/skywalkingreceiver/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http:https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate mdatagen metadata.yaml

package skywalkingreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/skywalkingreceiver"
9 changes: 4 additions & 5 deletions receiver/skywalkingreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ import (
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/receiver"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/skywalkingreceiver/internal/metadata"
)

const (
typeStr = "skywalking"
stability = component.StabilityLevelBeta

// Protocol values.
protoGRPC = "grpc"
protoHTTP = "http"
Expand All @@ -46,9 +45,9 @@ const (
// NewFactory creates a new Skywalking receiver factory.
func NewFactory() receiver.Factory {
return receiver.NewFactory(
typeStr,
metadata.Type,
createDefaultConfig,
receiver.WithTraces(createTracesReceiver, stability))
receiver.WithTraces(createTracesReceiver, metadata.TracesStability))
}

// CreateDefaultConfig creates the default configuration for Skywalking receiver.
Expand Down
4 changes: 3 additions & 1 deletion receiver/skywalkingreceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import (
"go.opentelemetry.io/collector/config/configtls"
"go.opentelemetry.io/collector/confmap/confmaptest"
"go.opentelemetry.io/collector/receiver/receivertest"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/skywalkingreceiver/internal/metadata"
)

func TestTypeStr(t *testing.T) {
Expand Down Expand Up @@ -70,7 +72,7 @@ func TestCreateReceiverGeneralConfig(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()

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

Expand Down

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

8 changes: 8 additions & 0 deletions receiver/skywalkingreceiver/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type: skywalking

status:
class: receiver
stability:
beta: [traces]
distributions: [contrib]

Loading