Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Document a compatibility regression introduced in `go.opentelemetry.io/otel` v1.47.0 that breaks compilation with `go.opentelemetry.io/otel/bridge/opentracing` v1.46.0 and earlier.
Include instructions for upgrading the bridge to v1.47.0.
See the [bridge version compatibility documentation](bridge/opentracing/README.md#version-compatibility). (#9209)
- Document the concurrency guarantees of the `Exporter` in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#9244)

### Deprecated

Expand Down
9 changes: 9 additions & 0 deletions exporters/otlp/otlplog/otlploggrpc/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ var transformResourceLogs = transform.ResourceLogs
//
// This method returns [log.ErrExporterShutdown] if called after Shutdown.
// This method returns an error if the method is canceled by the passed context.
//
// This method is safe to call concurrently.
func (e *Exporter) Export(ctx context.Context, records []log.Record) error {
if e.stopped.Load() {
return log.ErrExporterShutdown
Expand All @@ -79,6 +81,11 @@ func (e *Exporter) Export(ctx context.Context, records []log.Record) error {

// Shutdown shuts down the Exporter. Calls to Export after Shutdown return
// [log.ErrExporterShutdown]. Calls to ForceFlush perform no operation.
//
// Calling Shutdown more than once is safe: subsequent calls do nothing and
// return nil.
//
// This method is safe to call concurrently.
func (e *Exporter) Shutdown(ctx context.Context) error {
if e.stopped.Swap(true) {
return nil
Expand All @@ -93,6 +100,8 @@ func (e *Exporter) Shutdown(ctx context.Context) error {
}

// ForceFlush does nothing. The Exporter holds no state.
//
// This method is safe to call concurrently.
func (*Exporter) ForceFlush(context.Context) error {
return nil
}
10 changes: 10 additions & 0 deletions exporters/otlp/otlplog/otlploghttp/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ var transformResourceLogs = transform.ResourceLogs

// Export transforms and transmits log records to an OTLP receiver. It returns
// [log.ErrExporterShutdown] if called after Shutdown.
//
// This method is safe to call concurrently.
func (e *Exporter) Export(ctx context.Context, records []log.Record) error {
if e.stopped.Load() {
return log.ErrExporterShutdown
Expand All @@ -64,6 +66,12 @@ func (e *Exporter) Export(ctx context.Context, records []log.Record) error {

// Shutdown shuts down the Exporter. Calls to Export after Shutdown return
// [log.ErrExporterShutdown]. Calls to ForceFlush perform no operation.
//
// Shutdown does not wait for or cancel in-flight Export calls.
Comment thread
pellared marked this conversation as resolved.
Outdated
// Calling Shutdown more than once is safe: subsequent calls do nothing and
// return nil.
//
// This method is safe to call concurrently.
func (e *Exporter) Shutdown(context.Context) error {
if e.stopped.Swap(true) {
return nil
Expand All @@ -74,6 +82,8 @@ func (e *Exporter) Shutdown(context.Context) error {
}

// ForceFlush does nothing. The Exporter holds no state.
//
// This method is safe to call concurrently.
func (*Exporter) ForceFlush(context.Context) error {
return nil
}
Loading