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/solace] create metadata #21688

Merged
merged 1 commit into from
May 10, 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
16 changes: 9 additions & 7 deletions receiver/solacereceiver/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Solace 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 -->

The Solace receiver receives trace data from a [Solace PubSub+ Event Broker](https://solace.com/products/event-broker/).

Expand Down Expand Up @@ -95,5 +99,3 @@ service:
receivers: [solace/primary,solace/backup]
```

[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/solacereceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configtls"
"go.opentelemetry.io/collector/confmap/confmaptest"

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

func TestLoadConfig(t *testing.T) {
Expand All @@ -38,7 +40,7 @@ func TestLoadConfig(t *testing.T) {
expectedErr error
}{
{
id: component.NewIDWithName(componentType, "primary"),
id: component.NewIDWithName(metadata.Type, "primary"),
expected: &Config{
Broker: []string{"myHost:5671"},
Auth: Authentication{
Expand All @@ -61,11 +63,11 @@ func TestLoadConfig(t *testing.T) {
},
},
{
id: component.NewIDWithName(componentType, "noauth"),
id: component.NewIDWithName(metadata.Type, "noauth"),
expectedErr: errMissingAuthDetails,
},
{
id: component.NewIDWithName(componentType, "noqueue"),
id: component.NewIDWithName(metadata.Type, "noqueue"),
expectedErr: errMissingQueueName,
},
}
Expand Down
2 changes: 2 additions & 0 deletions receiver/solacereceiver/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate mdatagen metadata.yaml

// Package solacereceiver receives traces from Solace broker using AMQP 1.0 protocol.
package solacereceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/solacereceiver"
10 changes: 4 additions & 6 deletions receiver/solacereceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ import (
"go.opentelemetry.io/collector/config/configtls"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/receiver"

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

const (
componentType component.Type = "solace"
// The stability level of the receiver.
stability = component.StabilityLevelDevelopment

// default value for max unaked messages
defaultMaxUnaked int32 = 1000
// default value for host
Expand All @@ -38,9 +36,9 @@ const (
// NewFactory creates a factory for Solace receiver.
func NewFactory() receiver.Factory {
return receiver.NewFactory(
componentType,
metadata.Type,
createDefaultConfig,
receiver.WithTraces(createTracesReceiver, stability),
receiver.WithTraces(createTracesReceiver, metadata.TracesStability),
)
}

Expand Down
6 changes: 4 additions & 2 deletions receiver/solacereceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import (
"go.opentelemetry.io/collector/confmap/confmaptest"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/receiver/receivertest"

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

func TestCreateTracesReceiver(t *testing.T) {
Expand All @@ -35,7 +37,7 @@ func TestCreateTracesReceiver(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()

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

Expand Down Expand Up @@ -98,7 +100,7 @@ func TestCreateTracesReceiverBadMetrics(t *testing.T) {
factory := NewFactory()
cfg := factory.CreateDefaultConfig()

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

Expand Down
12 changes: 12 additions & 0 deletions receiver/solacereceiver/internal/metadata/generated_status.go

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

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

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

4 changes: 3 additions & 1 deletion receiver/solacereceiver/observability.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (

"go.opencensus.io/stats"
"go.opencensus.io/stats/view"

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

const (
Expand Down Expand Up @@ -144,7 +146,7 @@ func fromMeasure(measure stats.Measure, agg *view.Aggregation) *view.View {
}

func buildReceiverCustomMetricName(metric string) string {
return receiverKey + nameSep + string(componentType) + nameSep + metric
return receiverKey + nameSep + string(metadata.Type) + nameSep + metric
}

// recordFailedReconnection increments the metric that records failed reconnection event.
Expand Down