SonarSource/sonarqube · warning

Failed to publish telemetry event

Error message

Failed to publish {} telemetry event

What it means

AnalyticsEventPublisher.publish sends a single cross-domain telemetry event asynchronously via the event async client. Failures — whether a RuntimeException thrown synchronously by the client or a throwable completing the future — are logged with this warning and swallowed: telemetry is best-effort and never impacts the product.

Solutions

  1. Check outbound network access/HTTPS proxy settings from the SonarQube host to the telemetry endpoint
  2. Verify telemetry configuration (SONAR_TELEMETRY_ENABLE and related URL settings) is correct
  3. Inspect the attached throwable in the log for the root cause and fix (DNS, TLS, proxy auth)
  4. If telemetry must be disabled, set SONAR_TELEMETRY_ENABLE=false to stop publish attempts

Example fix

# sonar.properties
# before (default, publish failing due to blocked egress)
# after: allow egress to telemetry.sonarsource.com:443 or disable
sonar.telemetry.enable=false
Defensive patterns

Strategy: try-catch

Validate before calling

if (!publisher.isTelemetryEnabled()) return; // skip publish entirely

Try / catch

try {
  client.publishCrossDomainEvent(event)
    .whenComplete((ignored, throwable) -> {
      if (throwable != null) log.warn("Telemetry publish failed: {}", throwable.toString());
    });
} catch (RuntimeException e) {
  log.warn("Telemetry publish failed synchronously: {}", e.toString());
}

Prevention

When it happens

Trigger: publish(type, payload) is called when eventAsyncClient.publishCrossDomainEvent throws (sync, e.g. client misconfigured/closed) or its returned CompletableFuture completes exceptionally (async network/transport failure).

Common situations: Telemetry endpoint unreachable or blocked by firewall/proxy; telemetry client initialization failed; expired TLS certificates; server offline during background telemetry publish.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/c132b13dd954292a. Report an issue: GitHub.

Appendix: source

Thrown at server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/event/AnalyticsEventPublisher.java:65

  public AnalyticsEventPublisher(EventAsyncClient eventAsyncClient, EventSourceBuilder eventSourceBuilder, Configuration configuration) {
    this.eventAsyncClient = eventAsyncClient;
    this.eventSourceBuilder = eventSourceBuilder;
    this.configuration = configuration;
  }

  /**
   * Publishes a single event. No-op when telemetry is disabled.
   */
  public void publish(AnalyticsEventType type, Object payload) {
    if (!isTelemetryEnabled()) {
      return;
    }
    try {
      eventAsyncClient.publishCrossDomainEvent(toEvent(type, payload))
        .whenComplete((ignored, throwable) -> {
          if (throwable != null) {
            LOG.warn("Failed to publish {} telemetry event", type.eventType(), throwable);
          }
        });
    } catch (RuntimeException e) {
      LOG.warn("Failed to publish {} telemetry event", type.eventType(), e);
    }
  }

  /**
   * 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))

View on GitHub (pinned to 184c821202)