open-telemetry / open-telemetry/opentelemetry-ruby

Document/add concurrency-safety to Console and OTLP exporters' `ForceFlush`/`Shutdown`

Open
#2,353 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug logs spec-compliance spec:stable
Dominant language
Ruby
Stars
606
Forks
301
Avg merge
3d 19h
Merged PRs (30d)
42

Description

Spec requirement

Each LogRecordExporter implementation MUST document its concurrency characteristics (sdk.md:612-613 (permalink)); ForceFlush and Shutdown MUST be safe for concurrent calls (sdk.md:712-713 (permalink)).

Current behavior

logs_sdk/lib/opentelemetry/sdk/logs/export/console_log_record_exporter.rb:27-34 (permalink) (#force_flush/#shutdown) mutate @stopped with no synchronization. exporter/otlp-logs/lib/opentelemetry/exporter/otlp/logs/logs_exporter.rb:108-112 (permalink) (#shutdown) mutates @shutdown and calls @http.finish with no mutex either. Only InMemoryLogRecordExporter (export/in_memory_log_record_exporter.rb:83-99) (permalink) guards this with @mutex.

Suggested fix

Add a mutex around @stopped/@shutdown mutation (and any shared @http access) in both ConsoleLogRecordExporter and the OTLP LogsExporter, and document the concurrency guarantee in each class's description.

Related rows in SPEC_COMPLIANCE_LOGS.md

SDK-42, SDK-50

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with logs_sdk/lib/opentelemetry/sdk/logs/export/console_log_record_exporter.rb and exporter/otlp-logs/lib/opentelemetry/exporter/otlp/logs/logs_exporter.rb, then compare the mutex usage in export/in_memory_log_record_exporter.rb. Review ForceFlush and Shutdown, including shared @http access in the OTLP exporter. Done means both exporters synchronize the relevant state and document their concurrency guarantees.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
observability-sre
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.