code: func (e Event) Encode(tags ...string) (string, error) {
  	err := e.Check()
  	if err != nil {
  		return "", err
  	}
  	text := e.escapedText()
  
  	var buffer bytes.Buffer
  	buffer.WriteString("_e{")
  	buffer.WriteString(strconv.FormatInt(int64(len(e.Title)), 10))
  	buffer.WriteRune(',')
  	buffer.WriteString(strconv.FormatInt(int64(len(text)), 10))
  	buffer.WriteString("}:")
  	buffer.WriteString(e.Title)
  	buffer.WriteRune('|')
  	buffer.WriteString(text)
  
  	if !e.Timestamp.IsZero() {
  		buffer.WriteString("|d:")
  		buffer.WriteString(strconv.FormatInt(int64(e.Timestamp.Unix()), 10))
  	}
  
  	if len(e.Hostname) != 0 {
  		buffer.WriteString("|h:")
  		buffer.WriteString(e.Hostname)
  	}
  
  	if len(e.AggregationKey) != 0 {
  		buffer.WriteString("|k:")
  		buffer.WriteString(e.AggregationKey)
  
  	}
  
  	if len(e.Priority) != 0 {
  		buffer.WriteString("|p:")
  		buffer.WriteString(string(e.Priority))
  	}
  
  	if len(e.SourceTypeName) != 0 {
  		buffer.WriteString("|s:")
  		buffer.WriteString(e.SourceTypeName)
  	}
  
  	if len(e.AlertType) != 0 {
  		buffer.WriteString("|t:")
  		buffer.WriteString(string(e.AlertType))
  	}
  
  	writeTagString(&buffer, tags, e.Tags)
  
  	return buffer.String(), nil
  }
docs: // Encode returns the dogstatsd wire protocol representation for an event.
  // Tags may be passed which will be added to the encoded output but not to
  // the Event's list of tags, eg. for default tags.