From fd64737fd7564232af48571653fd05a3c7aeb7c1 Mon Sep 17 00:00:00 2001 From: Katarzyna Kujawa Date: Fri, 5 May 2023 09:14:50 +0200 Subject: [PATCH] [exporter/syslog] Update to use generated status --- .chloggen/add-syslog-exporter.yaml | 2 +- exporter/syslogexporter/README.md | 13 ++++++++----- exporter/syslogexporter/doc.go | 17 +++++++++++++++++ exporter/syslogexporter/factory.go | 10 +++------- .../internal/metadata/generated_status.go | 12 ++++++++++++ exporter/syslogexporter/metadata.yaml | 6 ++++++ 6 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 exporter/syslogexporter/doc.go create mode 100644 exporter/syslogexporter/internal/metadata/generated_status.go create mode 100644 exporter/syslogexporter/metadata.yaml diff --git a/.chloggen/add-syslog-exporter.yaml b/.chloggen/add-syslog-exporter.yaml index 5bd7b96ea371..5940e383cf55 100755 --- a/.chloggen/add-syslog-exporter.yaml +++ b/.chloggen/add-syslog-exporter.yaml @@ -5,7 +5,7 @@ change_type: new_component component: syslogexporter # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: Add syslogexporter for sending logs to syslog server +note: Add syslogexporter for sending logs to syslog server # One or more tracking issues related to the change issues: [17982] diff --git a/exporter/syslogexporter/README.md b/exporter/syslogexporter/README.md index 6a13ebcc6cb8..ffc17e84954c 100644 --- a/exporter/syslogexporter/README.md +++ b/exporter/syslogexporter/README.md @@ -1,10 +1,13 @@ # Syslog Exporter -| Status | | -|--------------------------|---------------| -| Stability | [development] | -| Supported pipeline types | logs | -| Distributions | | + +| Status | | +| ------------- |-----------| +| Stability | [development]: logs | +| Distributions | [] | + +[development]: https://github.com/open-telemetry/opentelemetry-collector#development + The syslog exporter supports sending messages to a remote syslog server. diff --git a/exporter/syslogexporter/doc.go b/exporter/syslogexporter/doc.go new file mode 100644 index 000000000000..f231f64a5040 --- /dev/null +++ b/exporter/syslogexporter/doc.go @@ -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://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 syslogexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/syslogexporter" diff --git a/exporter/syslogexporter/factory.go b/exporter/syslogexporter/factory.go index 47b13e0700b9..6d9c3980904e 100644 --- a/exporter/syslogexporter/factory.go +++ b/exporter/syslogexporter/factory.go @@ -21,20 +21,16 @@ import ( "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/exporter" "go.opentelemetry.io/collector/exporter/exporterhelper" -) -const ( - // The value of "type" key in configuration. - typeStr = "syslog" - stabilityLevel = component.StabilityLevelDevelopment + "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/syslogexporter/internal/metadata" ) // NewFactory returns a new factory for the syslog exporter. func NewFactory() exporter.Factory { return exporter.NewFactory( - typeStr, + metadata.Type, createDefaultConfig, - exporter.WithLogs(createLogsExporter, stabilityLevel), + exporter.WithLogs(createLogsExporter, metadata.LogsStability), ) } diff --git a/exporter/syslogexporter/internal/metadata/generated_status.go b/exporter/syslogexporter/internal/metadata/generated_status.go new file mode 100644 index 000000000000..656746c269d2 --- /dev/null +++ b/exporter/syslogexporter/internal/metadata/generated_status.go @@ -0,0 +1,12 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "go.opentelemetry.io/collector/component" +) + +const ( + Type = "syslog" + LogsStability = component.StabilityLevelDevelopment +) diff --git a/exporter/syslogexporter/metadata.yaml b/exporter/syslogexporter/metadata.yaml new file mode 100644 index 000000000000..d4f1293e2546 --- /dev/null +++ b/exporter/syslogexporter/metadata.yaml @@ -0,0 +1,6 @@ +type: syslog + +status: + class: exporter + stability: + development: [logs]