Skip to content

Commit

Permalink
[exporter/stefexporter] Add basic STEF exporter implementation
Browse files Browse the repository at this point in the history
#### Description

Added STEF exporter implementation for metrics, sending data over gRPC stream.
For now only queuing and retry exporter helpers are used. We will need to
decide later if other helpers are needed for this exporter.

#### Testing

Unit tests that verify connecting, reconnecting, sending, acking of data
are included.

#### Documentation

Added to README.

#### Future Work

More extensive test coverage is desirable and will likely be added
in the future.

We likely want to implement STEF receiver and add STEF as a tested protocol
to our testbed.
  • Loading branch information
tigrannajaryan committed Jan 29, 2025
1 parent c7921b5 commit dcbdb78
Show file tree
Hide file tree
Showing 7 changed files with 747 additions and 14 deletions.
43 changes: 43 additions & 0 deletions exporter/stefexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,46 @@

Export data via gRPC using
[Otel/STEF format](https://github.com/splunk/stef/tree/main/go/otel) format.

## Getting Started

The following settings are required:

- `endpoint` (no default): host:port to which the exporter is going to send STEF metric data,
using the STEF/gRPC protocol. The valid syntax is described
[here](https://github.com/grpc/grpc/blob/master/doc/naming.md).
If a scheme of `https` is used then client transport security is enabled and overrides the `insecure` setting.
- `tls`: see [TLS Configuration Settings](../../config/configtls/README.md) for the full set of available options.

Example:

```yaml
exporters:
stef:
endpoint: otelcol2:4317
tls:
cert_file: file.cert
key_file: file.key
stef/2:
endpoint: otelcol2:4317
tls:
insecure: true
```
By default, no compression is enabled. The only supported compression method is zstd.
To enable, configure as follows:
```yaml
exporters:
otlp:
...
compression: zstd
```
## Advanced Configuration
Several helper files are leveraged to provide additional capabilities automatically:
- [gRPC settings](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configgrpc/README.md)
- [TLS and mTLS settings](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configtls/README.md)
- [Queuing and retry settings](https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/exporterhelper/README.md)
18 changes: 17 additions & 1 deletion exporter/stefexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@ import (
"regexp"
"strconv"
"strings"
"time"

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configgrpc"
"go.opentelemetry.io/collector/config/configretry"
"go.opentelemetry.io/collector/exporter/exporterhelper"
)

// Config defines configuration for logging exporter.
type Config struct {
configgrpc.ClientConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
exporterhelper.QueueConfig `mapstructure:"sending_queue"`
RetryConfig configretry.BackOffConfig `mapstructure:"retry_on_failure"`
configgrpc.ClientConfig `mapstructure:",squash"`

// For testing purposes we shorten this time to make tests faster.
// TODO: decide if this needs to be end-user configurable too.
maxAckWaitTime time.Duration
}

var _ component.Config = (*Config)(nil)
Expand All @@ -38,6 +47,13 @@ func (c *Config) Validate() error {
return fmt.Errorf(`invalid port "%s"`, port)
}

switch c.Compression {
case "":
case "zstd":
default:
return fmt.Errorf("unsupported compression method %q", c.Compression)
}

return nil
}

Expand Down
Loading

0 comments on commit dcbdb78

Please sign in to comment.