public async accept()

in src/sinks/AgentSink.ts [91:110]


  public async accept(context: MetricsContext): Promise<void> {
    if (this.logGroupName) {
      context.meta.LogGroupName = this.logGroupName;
    }

    if (this.logStreamName) {
      context.meta.LogStreamName = this.logStreamName;
    }

    const events = this.serializer.serialize(context);
    
    LOG(`Sending {} events to socket.`, events.length);

    for (let index = 0; index < events.length; index++) {
      const event = events[index];
      const message = event + '\n';
      const bytes = Buffer.from(message);
      await this.socketClient.sendMessage(bytes);
    }
  }