<commit_before>// definitions and functions for interacting with backends
package statsdproxy

import (
	"log"
	"net"
	"fmt"
  "time"
)

const (
  PING_CHECK_INTERVAL = 10
)

type StatsDBackend struct {
	Host string
	Port int
	ManagementPort int
	conn net.Conn
	RingID HashRingID
	Status struct {
	  Alive bool
	  LastPingTime int64
  }
}

func NewStatsDBackend(host string, port int) *StatsDBackend {
	client := StatsDBackend{Host: host, Port: port}
  client.RingID, _ = GetHashRingPosition(fmt.Sprintf("%s:%s", host, port))
	client.Open()
	return &client
}

// Method to open udp connection, called by default client factory
func (client *StatsDBackend) Open() {
	connectionString := fmt.Sprintf("%s:%d", client.Host, client.Port)
	conn, err := net.Dial("udp", connectionString)
	if err != nil {
		log.Println(err)
	}
	client.conn = conn
}

// Method to close udp connection
func (client *StatsDBackend) Close() {
	client.conn.Close()
}

func (client *StatsDBackend) Send(data string) {
		update_string := fmt.Sprintf(data)
		_, err := fmt.Fprintf(client.conn, update_string)
		if err != nil {
			log.Println(err)
		}
}<commit_msg>create StatsdBackends with the ManagementPort set<commit_after>// definitions and functions for interacting with backends
package statsdproxy

import (
	"log"
	"net"
	"fmt"
  "time"
)

const (
  PING_CHECK_INTERVAL = 10
)

type StatsDBackend struct {
	Host string
	Port int
	ManagementPort int
	conn net.Conn
	RingID HashRingID
	Status struct {
	  Alive bool
	  LastPingTime int64
  }
}

func NewStatsDBackend(host string, port int, managementPort int) *StatsDBackend {
  client := StatsDBackend{Host: host, Port: port, ManagementPort:
  managementPort}
  client.RingID, _ = GetHashRingPosition(fmt.Sprintf("%s:%s", host, port))
	client.Open()
	return &client
}

// Method to open udp connection, called by default client factory
func (client *StatsDBackend) Open() {
	connectionString := fmt.Sprintf("%s:%d", client.Host, client.Port)
	conn, err := net.Dial("udp", connectionString)
	if err != nil {
		log.Println(err)
	}
	client.conn = conn
}

// Method to close udp connection
func (client *StatsDBackend) Close() {
	client.conn.Close()
}

func (client *StatsDBackend) Send(data string) {
		update_string := fmt.Sprintf(data)
		_, err := fmt.Fprintf(client.conn, update_string)
		if err != nil {
			log.Println(err)
		}
}
{'fraction_non_alphanumeric': 0.1175222740772168, 'fraction_numerical': 0.0033941450997030122, 'mean_word_length': 4.346938775510204, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4866642', 'n_tokens_mistral': 849, 'n_tokens_neox': 806, 'n_words': 223}