private sendToShipper()

in src/client/src/analytics_client/analytics_client.ts [250:274]


  private sendToShipper(eventType: EventType, events: Event[]) {
    let sentToShipper = false;
    this.shippersRegistry.getShippersForEventType(eventType).forEach((shipper, shipperName) => {
      const isShipperOptedIn = this.optInConfig$.value?.isShipperOptedIn(shipperName, eventType);

      // Only send it to the non-explicitly opted-out shippers
      if (isShipperOptedIn) {
        sentToShipper = true;
        try {
          shipper.reportEvents(events);
        } catch (err) {
          this.initContext.logger.warn(`Failed to report event "${eventType}" via shipper "${shipperName}"`, err);
        }
      }
    });
    if (sentToShipper) {
      this.internalTelemetryCounter$.next({
        type: 'sent_to_shipper',
        source: 'client',
        event_type: eventType,
        code: 'OK',
        count: events.length,
      });
    }
  }