code: public synchronized byte[] serializeRecord(T record) {
  
      try {
        this.byteArrayOutputStream.reset();
        // Write schema versioning information.
        this.schemaVersionWriter.writeSchemaVersioningInformation(record.getSchema(), this.out);
        // Now write the record itself.
        this.writer.write(record, this.encoder);
        this.encoder.flush();
        return this.byteArrayOutputStream.toByteArray();
      } catch (IOException exception) {
        LOGGER.warn("Could not serialize Avro record for Kafka Metrics.", exception);
        return null;
      }
    }
docs: Converts a {@link org.apache.gobblin.metrics.MetricReport} to bytes to send through Kafka.
  
  <p>
  Actual serialized record will be prepended with a schema version generated by {@link #schemaVersionWriter}.
  </p>
  
  @param record MetricReport to serialize.
  @return Serialized bytes.