Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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`.
Comment thread
saluja-ji marked this conversation as resolved.
Outdated

### Deprecated

Expand Down
14 changes: 14 additions & 0 deletions exporters/otlp/otlplog/otlploggrpc/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ type logClient interface {
// Exporter is an OpenTelemetry log exporter. It transports log data encoded as
// OTLP protobufs using gRPC.
// All Exporter values must be created with [New].
//
// Export must not be called concurrently with itself on the same Exporter.
// Shutdown and ForceFlush are safe to call concurrently with themselves,
// each other, and Export.
Comment thread
pellared marked this conversation as resolved.
Outdated
type Exporter struct {
// Ensure synchronous access to the client across all functionality.
clientMu sync.Mutex
Expand Down Expand Up @@ -58,6 +62,9 @@ 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.
//
// Export must not be called concurrently with other Export calls.
Comment thread
pellared marked this conversation as resolved.
Outdated
// It is safe to call concurrently with Shutdown and ForceFlush.
func (e *Exporter) Export(ctx context.Context, records []log.Record) error {
if e.stopped.Load() {
return log.ErrExporterShutdown
Expand All @@ -79,6 +86,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 with itself and with other methods.
func (e *Exporter) Shutdown(ctx context.Context) error {
if e.stopped.Swap(true) {
return nil
Expand All @@ -93,6 +105,8 @@ func (e *Exporter) Shutdown(ctx context.Context) error {
}

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