Skip to content

Commit

Permalink
[chore] use mdatagen for otlp receiver
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Boten <aboten@lightstep.com>
  • Loading branch information
Alex Boten committed Dec 22, 2023
1 parent 4b340ca commit 3813e4f
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 14 deletions.
20 changes: 13 additions & 7 deletions receiver/otlpreceiver/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# OTLP Receiver

| Status | |
| ------------------------ | --------------------- |
| Stability | traces [stable] |
| | metrics [stable] |
| | logs [beta] |
| Supported pipeline types | traces, metrics, logs |
| Distributions | [core], [contrib] |
<!-- status autogenerated section -->
| Status | |
| ------------- |-----------|
| Stability | [beta]: logs |
| | [stable]: traces, metrics |
| Distributions | [core], [contrib] |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Fotlp%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Fotlp) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Fotlp%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Fotlp) |

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

Receives data via gRPC or HTTP using [OTLP](
https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md)
Expand Down
2 changes: 2 additions & 0 deletions receiver/otlpreceiver/doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

//go:generate mdatagen metadata.yaml

// Package otlpreceiver receives data in OTLP format.
package otlpreceiver // import "go.opentelemetry.io/collector/receiver/otlpreceiver"
12 changes: 6 additions & 6 deletions receiver/otlpreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ import (
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/internal/sharedcomponent"
"go.opentelemetry.io/collector/receiver"
"go.opentelemetry.io/collector/receiver/otlpreceiver/internal/metadata"
)

const (
typeStr = "otlp"

defaultGRPCEndpoint = "0.0.0.0:4317"
defaultHTTPEndpoint = "0.0.0.0:4318"

Expand All @@ -29,11 +28,12 @@ const (
// NewFactory creates a new OTLP receiver factory.
func NewFactory() receiver.Factory {
return receiver.NewFactory(
typeStr,
metadata.Type,
createDefaultConfig,
receiver.WithTraces(createTraces, component.StabilityLevelStable),
receiver.WithMetrics(createMetrics, component.StabilityLevelStable),
receiver.WithLogs(createLog, component.StabilityLevelBeta))
receiver.WithTraces(createTraces, metadata.TracesStability),
receiver.WithMetrics(createMetrics, metadata.MetricsStability),
receiver.WithLogs(createLog, metadata.LogsStability),
)
}

// createDefaultConfig creates the default configuration for receiver.
Expand Down
25 changes: 25 additions & 0 deletions receiver/otlpreceiver/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/otlpreceiver/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type: otlp

status:
class: receiver
stability:
stable: [traces, metrics]
beta: [logs]
distributions: [core, contrib]
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import (

const otlpReceiverName = "receiver_test"

var otlpReceiverID = component.NewIDWithName(typeStr, otlpReceiverName)
var otlpReceiverID = component.NewIDWithName("otlp", otlpReceiverName)

var traceJSON = []byte(`
{
Expand Down

0 comments on commit 3813e4f

Please sign in to comment.