Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Commit

Permalink
[chore] [exporter/awsxrayexporter] add metadata.yaml (open-telemetry#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bryan-aguilar committed May 17, 2023
1 parent 5f9fabe commit 75eff05
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 18 deletions.
15 changes: 10 additions & 5 deletions exporter/awsxrayexporter/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# AWS X-Ray Tracing Exporter for OpenTelemetry Collector

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

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

This exporter converts OpenTelemetry spans to
[AWS X-Ray Segment Documents](https://docs.aws.amazon.com/xray/latest/devguide/xray-api-segmentdocuments.html)
Expand Down
5 changes: 3 additions & 2 deletions exporter/awsxrayexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/confmap/confmaptest"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil"
)

Expand All @@ -37,11 +38,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{
AWSSessionSettings: awsutil.AWSSessionSettings{
NumberOfWorkers: 8,
Expand Down
1 change: 1 addition & 0 deletions exporter/awsxrayexporter/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// 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 awsxrayexporter implements an OpenTelemetry Collector exporter that sends trace data to
// AWS X-Ray in the region the collector is running in using the PutTraceSegments API.
Expand Down
12 changes: 3 additions & 9 deletions exporter/awsxrayexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,17 @@ import (
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/exporter"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray/telemetry"
)

const (
// The value of "type" key in configuration.
typeStr = "awsxray"
// The stability level of the exporter.
stability = component.StabilityLevelBeta
)

// NewFactory creates a factory for AWS-Xray exporter.
func NewFactory() exporter.Factory {
return exporter.NewFactory(
typeStr,
metadata.Type,
createDefaultConfig,
exporter.WithTraces(createTracesExporter, stability))
exporter.WithTraces(createTracesExporter, metadata.TracesStability))
}

func createDefaultConfig() component.Config {
Expand Down
5 changes: 3 additions & 2 deletions exporter/awsxrayexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"go.opentelemetry.io/collector/confmap/confmaptest"
"go.opentelemetry.io/collector/exporter/exportertest"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil"
)

Expand Down Expand Up @@ -55,7 +56,7 @@ func TestCreateTracesExporter(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 All @@ -71,7 +72,7 @@ func TestCreateMetricsExporter(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
12 changes: 12 additions & 0 deletions exporter/awsxrayexporter/internal/metadata/generated_status.go

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

7 changes: 7 additions & 0 deletions exporter/awsxrayexporter/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: awsxray

status:
class: exporter
stability:
beta: [traces]
distributions: [contrib, aws]

0 comments on commit 75eff05

Please sign in to comment.