Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SimpleLogRecordProcessor, SimpleSpanProcessor call export concurrently, but shouldn't #6681

Open
jack-berg opened this issue Sep 3, 2024 · 1 comment
Labels
Bug Something isn't working

Comments

@jack-berg
Copy link
Member

SpanExporter#export, LogRecordExporter#export should not be called concurrently, but SimpleSpanProcessor, SimpleLogRecordExporter don't have any synchronization:

@Override
public void onEnd(ReadableSpan span) {
if (span != null && (exportUnsampledSpans || span.getSpanContext().isSampled())) {
try {
List<SpanData> spans = Collections.singletonList(span.toSpanData());
CompletableResultCode result = spanExporter.export(spans);
pendingExports.add(result);
result.whenComplete(
() -> {
pendingExports.remove(result);
if (!result.isSuccess()) {
logger.log(Level.FINE, "Exporter failed");
}
});
} catch (RuntimeException e) {
logger.log(Level.WARNING, "Exporter threw an Exception", e);
}
}
}

@Override
public void onEmit(Context context, ReadWriteLogRecord logRecord) {
try {
List<LogRecordData> logs = Collections.singletonList(logRecord.toLogRecordData());
CompletableResultCode result = logRecordExporter.export(logs);
pendingExports.add(result);
result.whenComplete(
() -> {
pendingExports.remove(result);
if (!result.isSuccess()) {
logger.log(Level.FINE, "Exporter failed");
}
});
} catch (RuntimeException e) {
logger.log(Level.WARNING, "Exporter threw an Exception", e);
}
}

Noted by @pellared in open-telemetry/opentelemetry-specification#4134 (comment)

@jack-berg jack-berg added the Bug Something isn't working label Sep 3, 2024
@pellared
Copy link
Member

pellared commented Sep 3, 2024

Credits go to @cijothomas (not me 😉)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants