SonarSource/sonarqube · warning
Failed to publish telemetry events
Error message
Failed to publish {} telemetry events What it means
AnalyticsEventPublisher.publishAll sends a batch of telemetry events (one Event per payload) asynchronously via publishCrossDomainEvents. Sync RuntimeExceptions from the client and async failures surfaced in whenComplete are logged with this warning and swallowed — batching is best-effort.
Solutions
- Check the logged throwable for the root cause
- Verify egress/proxy configuration for the telemetry endpoint and any request size limits
- Retry with fewer payloads to rule out batch-size issues
- Set sonar.telemetry.enable=false if telemetry connectivity cannot be fixed
Defensive patterns
Strategy: try-catch
Validate before calling
if (!publisher.isTelemetryEnabled() || payloads.isEmpty()) return;
Try / catch
try {
client.publishCrossDomainEvents(events)
.whenComplete((ignored, t) -> { if (t != null) log.warn("batch publish failed", t); });
} catch (RuntimeException e) {
log.warn("batch publish failed (sync)", e);
} Prevention
- Keep batches modest in size to avoid transport limits
- Validate endpoint reachability before enabling batched telemetry
- Log the throwable to distinguish size errors from network errors
When it happens
Trigger: publishAll(type, payloads) called with a non-empty payload list; publishCrossDomainEvents throws synchronously or its CompletableFuture completes exceptionally.
Common situations: Batch too large for the transport/endpoint; telemetry endpoint unreachable; client shut down while batch publish in flight; proxy blocking bulk HTTPS requests.
Related errors
- Failed to publish telemetry event
- Address in property is not a valid address
- Bad filename
- Can not resolve host [
- Can not resolve host [
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/55716ceae6aaf178.
Report an issue: GitHub.
Appendix: source
Thrown at server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/event/AnalyticsEventPublisher.java:88
}
}
/**
* Publishes each payload as its own event, in a single batch. No-op on empty input or when
* telemetry is disabled.
*/
public void publishAll(AnalyticsEventType type, Collection<?> payloads) {
if (payloads.isEmpty() || !isTelemetryEnabled()) {
return;
}
try {
List<Event<?>> events = payloads.stream()
.<Event<?>>map(payload -> toEvent(type, payload))
.toList();
eventAsyncClient.publishCrossDomainEvents(events)
.whenComplete((ignored, throwable) -> {
if (throwable != null) {
LOG.warn("Failed to publish {} telemetry events", type.eventType(), throwable);
}
});
} catch (RuntimeException e) {
LOG.warn("Failed to publish {} telemetry events", type.eventType(), e);
}
}
public boolean isTelemetryEnabled() {
return configuration.getBoolean(SONAR_TELEMETRY_ENABLE.getKey()).orElse(false);
}
private Event<?> toEvent(AnalyticsEventType type, Object payload) {
return new BaseEvent<>(
new EventMetadata(
eventSourceBuilder.build(type.sourceDomain(), type.sourceService()),
type.eventType(),
type.eventVersion()),
payload);View on GitHub (pinned to 184c821202)