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 · 2 comments · May be fixed by #6885
Open

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

jack-berg opened this issue Sep 3, 2024 · 2 comments · May be fixed by #6885
Assignees
Labels
Bug Something isn't working contribfest

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 😉)

@slodha
Copy link

slodha commented Nov 15, 2024

i'm working on this issue.

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