Skip to content

Commit

Permalink
[chore] lokiexporter update to use use generated status (#21083)
Browse files Browse the repository at this point in the history
 Updates lokiexporter to use new generated status header. There are no warnings to list.
  • Loading branch information
mar4uk committed Apr 24, 2023
1 parent 8268905 commit 106a221
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
11 changes: 6 additions & 5 deletions exporter/lokiexporter/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Loki Exporter

<!-- status autogenerated section -->
| Status | |
| ------------------------ |-----------|
| Stability | [beta] |
| Supported pipeline types | logs |
| Stability | [beta] |
| Supported pipeline types | logs |
| 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 -->
Exports data via HTTP to [Loki](https://grafana.com/docs/loki/latest/).

## Getting Started
Expand Down Expand Up @@ -129,6 +133,3 @@ Several helper files are leveraged to provide additional capabilities automatica

- [HTTP settings](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/confighttp/README.md)
- [Queuing and retry settings](https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/exporterhelper/README.md)

[beta]:https://github.com/open-telemetry/opentelemetry-collector#beta
[contrib]:https://github.com/open-telemetry/opentelemetry-collector-releases/tree/main/distributions/otelcol-contrib
4 changes: 3 additions & 1 deletion exporter/lokiexporter/config_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/exporter/exporterhelper"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/lokiexporter/internal/metadata"
)

func TestLoadConfigNewExporter(t *testing.T) {
Expand All @@ -42,7 +44,7 @@ func TestLoadConfigNewExporter(t *testing.T) {
expected component.Config
}{
{
id: component.NewIDWithName(typeStr, "allsettings"),
id: component.NewIDWithName(metadata.Type, "allsettings"),
expected: &Config{
HTTPClientSettings: confighttp.HTTPClientSettings{
Headers: map[string]configopaque.String{
Expand Down
12 changes: 5 additions & 7 deletions exporter/lokiexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate mdatagen metadata.yaml

package lokiexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/lokiexporter"

import (
Expand All @@ -23,20 +25,16 @@ import (
"go.opentelemetry.io/collector/config/configopaque"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/exporter/exporterhelper"
)

const (
typeStr = "loki"
// The stability level of the exporter.
stability = component.StabilityLevelBeta
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/lokiexporter/internal/metadata"
)

// NewFactory creates a factory for the legacy Loki exporter.
func NewFactory() exporter.Factory {
return exporter.NewFactory(
typeStr,
metadata.Type,
createDefaultConfig,
exporter.WithLogs(createLogsExporter, stability),
exporter.WithLogs(createLogsExporter, metadata.Stability),
)
}

Expand Down
12 changes: 12 additions & 0 deletions exporter/lokiexporter/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/lokiexporter/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: loki

status:
class: exporter
stability: beta
pipelines: [logs]
distributions: [contrib]

0 comments on commit 106a221

Please sign in to comment.