Skip to content

Instantly share code, notes, and snippets.

@remeh
Created June 20, 2023 07:22
Show Gist options
  • Save remeh/a046e761f7cd7b40ab89c489484c1c41 to your computer and use it in GitHub Desktop.
Save remeh/a046e761f7cd7b40ab89c489484c1c41 to your computer and use it in GitHub Desktop.
DogStatsD no-aggregation and normal traffic
package main
import (
"log"
"strconv"
"time"
"github.com/DataDog/datadog-go/v5/statsd"
)
func main() {
// configure your socket here
client, err := statsd.New("unix:///Users/remy.mathieu/statsd.sock",
statsd.WithTags([]string{"env:test", "service:agent-qa"}),
statsd.WithoutClientSideAggregation(),
)
if err != nil {
log.Fatal(err)
}
for i := 0; i < 50000000; i++ {
m := int(i % 100)
client.CountWithTimestamp("dogstatsd.metric.with_ts.qa"+strconv.Itoa(m), int64(100+m), []string{"dev:agent", "team:agent-metrics-logs"}, 1.0, time.Now())
}
client.Close()
}
package main
import (
"log"
"strconv"
"github.com/DataDog/datadog-go/v5/statsd"
)
func main() {
// configure your socket here
client, err := statsd.New("unix:///Users/remy.mathieu/statsd.sock",
statsd.WithTags([]string{"env:test", "service:agent-qa"}),
statsd.WithoutClientSideAggregation(),
)
if err != nil {
log.Fatal(err)
}
for i := 0; i < 50000000; i++ {
m := int(i % 100)
client.Distribution("dogstatsd.metric.dist.qa" + strconv.Itoa(m), float64(100), []string{"dev:agent", "team:agent-metrics-logs"}, 1.0)
}
client.Close()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment