-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[exporter/sematext] New component: Sematext Exporter (#37161)
#### Description First PR of New component: Sematext Exporter. <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue #36465 --------- Co-authored-by: Andrzej Stencel <[email protected]>
- Loading branch information
1 parent
94415c9
commit 24dd011
Showing
20 changed files
with
596 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Use this changelog template to create an entry for release notes. | ||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: new_component | ||
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) | ||
component: exporter/sematext | ||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: "Add a new component for exporting metrics and logs to Sematext" | ||
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. | ||
issues: [36465] | ||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: | ||
# If your change doesn't affect end users or the exported elements of any package, | ||
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. | ||
# Optional: The change log or logs in which this entry should be included. | ||
# e.g. '[user]' or '[user, api]' | ||
# Include 'user' if the change is relevant to end users. | ||
# Include 'api' if there is a change to a library API. | ||
# Default: '[user]' | ||
change_logs: [user] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
abhishek-at-cloudwerx | ||
AkhigbeEromo | ||
Caleb-Hurshman | ||
cemdk | ||
dlopes7 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../../Makefile.Common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Sematext Exporter | ||
<!-- status autogenerated section --> | ||
| Status | | | ||
| ------------- |-----------| | ||
| Stability | [development]: metrics, logs | | ||
| Distributions | [] | | ||
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Fsematext%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Fsematext) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Fsematext%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Fsematext) | | ||
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@AkhigbeEromo](https://www.github.com/AkhigbeEromo) | | ||
|
||
[development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development | ||
<!-- end autogenerated section --> | ||
|
||
This exporter supports sending metrics to [Sematext Cloud](https://sematext.com/) in Influx line protocol format and logs using the Bulk Index Api format. | ||
|
||
## Configuration | ||
|
||
The following configuration options are supported: | ||
* `timeout` (default = 5s) Timeout for requests | ||
* `region` Region specifies the Sematext region the user is operating in; must be one of: | ||
* `US` | ||
* `EU` | ||
* `retry_on_failure` [details here](https://github.com/open-telemetry/opentelemetry-collector/blob/v0.25.0/exporter/exporterhelper/README.md#configuration) | ||
* `enabled` (default = true) | ||
* `initial_interval` (default = 5s) Time to wait after the first failure before retrying | ||
* `max_interval` (default = 30s) Upper bound on backoff interval | ||
* `max_elapsed_time` (default = 120s) Maximum amount of time (including retries) spent trying to send a request/batch | ||
* `metrics.app_token` specifies the token of the Sematext Monitoring App to which metrics data will be sent. It must be a valid UUID string in the format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`. For example: `2046e37c-4fac-45f6-831d-922d43fde759`. | ||
* `logs.app_token` specifies the token of the Sematext Logs App to which logs data will be sent. It must be a valid UUID string in the format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`. For example: `9604e37c-49ac-49f6-831d-922d43fde759`. | ||
* `metrics.payload_max_lines` (default = 1_000) Maximum number of lines allowed per HTTP POST request | ||
* `metrics.payload_max_bytes` (default = 300_000) Maximum number of bytes allowed per HTTP POST request | ||
* `metrics.metrics_schema` (default = telegraf-prometheus-v2) The chosen metrics schema to write | ||
* `metrics.sending_queue` [details here](https://github.com/open-telemetry/opentelemetry-collector/blob/v0.25.0/exporter/exporterhelper/README.md#configuration) | ||
* `enabled` (default = true) | ||
* `num_consumers` (default = 10) The number of consumers from the queue | ||
* `queue_size` (default = 1000) Maximum number of batches allowed in queue at a given time | ||
|
||
|
||
The full list of settings exposed for this exporter are documented in [config.go](config.go). | ||
|
||
Example: | ||
```yaml | ||
timeout: 500ms | ||
region: US | ||
retry_on_failure: | ||
enabled: true | ||
initial_interval: 1s | ||
max_interval: 3s | ||
max_elapsed_time: 10s | ||
metrics: | ||
app_token: 2064e37c-4fac-45f6-831d-922d43fde759 | ||
sending_queue: | ||
enabled: true | ||
num_consumers: 3 | ||
queue_size: 10 | ||
payload_max_lines: 100 | ||
payload_max_bytes: 1000 | ||
logs: | ||
app_token: 9064e37c-4gac-49f6-831d-922l43fse759 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package sematextexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sematextexporter" | ||
|
||
type Config struct{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//go:generate mdatagen metadata.yaml | ||
|
||
// Package sematextexporter sends metrics and logs to sematext cloud. | ||
package sematextexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sematextexporter" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//go:generate mdatagen metadata.yaml | ||
|
||
package sematextexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sematextexporter" | ||
|
||
import ( | ||
"context" | ||
|
||
"go.opentelemetry.io/collector/component" | ||
"go.opentelemetry.io/collector/exporter" | ||
"go.opentelemetry.io/collector/exporter/exporterhelper" | ||
"go.opentelemetry.io/collector/pdata/plog" | ||
"go.opentelemetry.io/collector/pdata/pmetric" | ||
|
||
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sematextexporter/internal/metadata" | ||
) | ||
|
||
// NewFactory creates a factory for the Sematext metrics exporter. | ||
func NewFactory() exporter.Factory { | ||
return exporter.NewFactory( | ||
metadata.Type, | ||
createDefaultConfig, | ||
exporter.WithMetrics(createMetricsExporter, metadata.MetricsStability), | ||
exporter.WithLogs(createLogsExporter, metadata.LogsStability), | ||
) | ||
} | ||
|
||
func createDefaultConfig() component.Config { | ||
cfg := &Config{} | ||
return cfg | ||
} | ||
|
||
func createMetricsExporter( | ||
ctx context.Context, | ||
set exporter.Settings, | ||
config component.Config, | ||
) (exporter.Metrics, error) { | ||
cfg := config.(*Config) | ||
|
||
return exporterhelper.NewMetrics( | ||
ctx, | ||
set, | ||
cfg, | ||
func(_ context.Context, _ pmetric.Metrics) error { | ||
return nil | ||
}, | ||
) | ||
} | ||
|
||
func createLogsExporter( | ||
ctx context.Context, | ||
set exporter.Settings, | ||
config component.Config, | ||
) (exporter.Logs, error) { | ||
cfg := config.(*Config) | ||
|
||
return exporterhelper.NewLogs( | ||
ctx, | ||
set, | ||
cfg, | ||
func(_ context.Context, _ plog.Logs) error { | ||
return nil | ||
}, | ||
) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.