traceEvent(event, payload) {
    if (!this.flowtrace) {
      return;
    }
    if (this.flowtraceName && this.flowtraceName !== this.flowtrace.mainGraph) {
      // Let main graph log all events from subgraphs
      return;
    }
    switch (event) {
      case 'ip': {
        let type = 'data';
        if (payload.type === 'openBracket') {
          type = 'begingroup';
        } else if (payload.type === 'closeBracket') {
          type = 'endgroup';
        }
        const src = payload.socket.from ? {
          node: payload.socket.from.process.id,
          port: payload.socket.from.port,
        } : null;
        const tgt = payload.socket.to ? {
          node: payload.socket.to.process.id,
          port: payload.socket.to.port,
        } : null;
        this.flowtrace.addNetworkPacket(
          `network:${type}`,
          src,
          tgt,
          this.flowtraceName,
          {
            subgraph: payload.subgraph,
            group: payload.group,
            datatype: payload.datatype,
            schema: payload.schema,
            data: payload.data,
          },
        );
        break;
      }
      case 'start': {
        this.flowtrace.addNetworkStarted(this.flowtraceName);
        break;
      }
      case 'end': {
        this.flowtrace.addNetworkStopped(this.flowtraceName);
        break;
      }
      case 'error': {
        this.flowtrace.addNetworkError(this.flowtraceName, payload);
        break;
      }
      default: {
        // No default handler
      }
    }
  }
@param {string} event
@param {any} payload
@private