Repository: prometheus/statsd_exporter
Pull request #558 (2024-05-30 18:37:28)

Add DogStatsD extended aggregation support
This PR aims to add the ability for statsd exporter to receive [DogStatsD extended aggregation metrics](https://github.com/DataDog/datadog-go?tab=readme-ov-file#extended-aggregation). It is a feature I requested in Issue #557 and I wanted to try to implement it myself following the in-issue commented advice from @glightfoot. 

### Summary of Implementation

When DogStatsD has extended aggregation enabled, instead of sending:

```
my_distribution_metric:21|d|#all,my,tags
my_distribution_metric:43.2|d|#all,my,tags
my_distribution_metric:1657|d|#all,my,tags
```

it sends

```
my_distribution_metric:21:43.2:1657|d|#all,my,tags
```

This PR updates the `LineToEvents` function in the specific case of more than one `:` left of the initial `|`. If so, assume it is an extended aggregation line, convert it back into its multi-line non-aggregated form, then pass it onto the rest of the function as the samples. The logic enforces that this form of aggregation metrics must be only of the types of distribution, histogram, or timing.




Patch:
diff --git a/pkg/line/line.go b/pkg/line/line.go
index 98c70e3..949a5ea 100644
--- a/pkg/line/line.go
+++ b/pkg/line/line.go
@@ -217,18 +217,44 @@ func (p *Parser) LineToEvents(line string, sampleErrors prometheus.CounterVec, s
 
 	labels := map[string]string{}
 	metric := p.parseNameAndTags(elements[0], labels, tagErrors, logger)
-
-	var samples []string
-	if strings.Contains(elements[1], "|#") {
+	usingDogStatsDTags := strings.Contains(elements[1], "|#")
+	if usingDogStatsDTags && len(labels) > 0 {
 		// using DogStatsD tags
 
 		// don't allow mixed tagging styles
-		if len(labels) > 0 {
-			sampleErrors.WithLabelValues("mixed_tagging_styles").Inc()
-			level.Debug(logger).Log("msg", "Bad line (multiple tagging styles) from StatsD", "line", line)
-			return events
+		sampleErrors.WithLabelValues("mixed_tagging_styles").Inc()
+		level.Debug(logger).Log("msg", "Bad line (multiple tagging styles) from StatsD", "line", line)
+		return events
+	}
+
+	var samples []string
+	lineParts := strings.SplitN(elements[1], "|", 3)
+	if strings.Contains(lineParts[0], ":") {
+		// handle DogStatsD extended aggregation
+		isValidAggType := false
+		switch lineParts[1] {
+		case
+			"ms", // timer
+			"h",  // histogram
+			"d":  // distribution
+			isValidAggType = true
 		}
 
+		if isValidAggType {
+			aggValues := strings.Split(lineParts[0], ":")
+			aggLines := make([]string, len(aggValues))
+			_, aggLineSuffix, _ := strings.Cut(elements[1], "|")
+
+			for i, aggValue := range aggValues {
+				aggLines[i] = strings.Join([]string{aggValue, aggLineSuffix}, "|")
+			}
+			samples = aggLines
+		} else {
+			sampleErrors.WithLabelValues("invalid_extended_aggregate_type").Inc()
+			level.Debug(logger).Log("msg", "Bad line (invalid extended aggregate type) from StatsD", "line", line)
+			return events
+		}
+	} else if usingDogStatsDTags {
 		// disable multi-metrics
 		samples = elements[1:]
 	} else {


Test patch:
diff --git a/pkg/line/line_test.go b/pkg/line/line_test.go
index bd57c9b..970320c 100644
--- a/pkg/line/line_test.go
+++ b/pkg/line/line_test.go
@@ -403,19 +403,353 @@ func TestLineToEvents(t *testing.T) {
 		"datadog tag extension with both valid and invalid utf8 tag values": {
 			in: "foo:100|c|@0.1|#tag1:valid,tag2:\xc3\x28invalid",
 		},
+		"datadog timings with extended aggregation values": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values without tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values and sampling but without tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|@0.5",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values, sampling, and tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|@0.5|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog histogram with extended aggregation values and tags": {
+			in: "foo_histogram:0.5:120:3000:10:20000:0.01|h|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      0.5,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      3000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      10,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      20000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog distribution with extended aggregation values": {
+			in: "foo_distribution:0.5:120:3000:10:20000:0.01|d|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      0.5,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      3000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      10,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      20000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog counter with invalid extended aggregation values": {
+			in: "foo_counter:0.5:120:3000:10:20000:0.01|c|#tag1:bar,tag2:baz",
+		},
+		"datadog gauge with invalid extended aggregation values": {
+			in: "foo_gauge:0.5:120:3000:10:20000:0.01|g|#tag1:bar,tag2:baz",
+		},
+		"datadog timing with extended aggregation values and invalid signalfx tags": {
+			in: "foo.[tag1=bar,tag2=baz]test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"SignalFX counter with invalid Datadog style extended aggregation values": {
+			in: "foo.[tag1=bar,tag2=baz]test:0.5:120:3000:10:20000:0.01|c",
+		},
+		"SignalFX no tags counter with invalid Datadog style extended aggregation values": {
+			in: "foo.[]test:0.5:120:3000:10:20000:0.01|c",
+		},
+		"SignalFX no tags with invalid Datadog style extended aggregation values and timings type": {
+			in: "foo.[]test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"Influx no tags with invalid Datadog style extended aggregation values and timings type": {
+			in: "foo.test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"Influx no tags with invalid Datadog style extended aggregation values and histogram type": {
+			in: "foo.test:0.5:120:3000:10:20000:0.01|ms",
+		},
 		"timings with sampling factor": {
 			in: "foo.timing:0.5|ms|@0.1",
 			out: event.Events{
-				&event.ObserverEvent{OMetricName: "foo.timing", OValue: 0.0005, OLabels: map[string]string{}},
-				&event.ObserverEvent{OMetricName: "foo.timing", OValue: 0.0005, OLabels: map[string]string{}},
-				&event.ObserverEvent{OMetricName: "foo.timing", OValue: 0.0005, OLabels: map[string]string{}},
-				&event.ObserverEvent{OMetricName: "foo.timing", OValue: 0.0005, OLabels: map[string]string{}},
-				&event.ObserverEvent{OMetricName: "foo.timing", OValue: 0.0005, OLabels: map[string]string{}},
-				&event.ObserverEvent{OMetricName: "foo.timing", OValue: 0.0005, OLabels: map[string]string{}},
-				&event.ObserverEvent{OMetricName: "foo.timing", OValue: 0.0005, OLabels: map[string]string{}},
-				&event.ObserverEvent{OMetricName: "foo.timing", OValue: 0.0005, OLabels: map[string]string{}},
-				&event.ObserverEvent{OMetricName: "foo.timing", OValue: 0.0005, OLabels: map[string]string{}},
-				&event.ObserverEvent{OMetricName: "foo.timing", OValue: 0.0005, OLabels: map[string]string{}},
+				&event.ObserverEvent{
+					OMetricName: "foo.timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo.timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo.timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo.timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo.timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo.timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo.timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo.timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo.timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo.timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
 			},
 		},
 		"bad line": {
@@ -697,40 +1031,334 @@ func TestDisableParsingLineToEvents(t *testing.T) {
 				},
 			},
 		},
-		"librato/dogstatsd mixed tag styles without sampling": {
-			in:  "foo#tag1=foo,tag3=bing:100|c|#tag1:bar,#tag2:baz",
-			out: event.Events{},
-		},
-		"signalfx/dogstatsd mixed tag styles without sampling": {
-			in:  "foo[tag1=foo,tag3=bing]:100|c|#tag1:bar,#tag2:baz",
-			out: event.Events{},
-		},
-		"influxdb/dogstatsd mixed tag styles without sampling": {
-			in:  "foo,tag1=foo,tag3=bing:100|c|#tag1:bar,#tag2:baz",
-			out: event.Events{},
-		},
-		"mixed tag styles with sampling": {
-			in:  "foo#tag1=foo,tag3=bing:100|c|@0.1|#tag1:bar,#tag2:baz",
-			out: event.Events{},
-		},
-		"datadog tag extension with multiple colons": {
-			in: "foo:100|c|@0.1|#tag1:foo:bar",
+		"datadog timings with extended aggregation values": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|#tag1:bar,tag2:baz",
 			out: event.Events{
-				&event.CounterEvent{
-					CMetricName: "foo",
-					CValue:      1000,
-					CLabels:     map[string]string{},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
 				},
 			},
 		},
-		"datadog tag extension with invalid utf8 tag values": {
-			in: "foo:100|c|@0.1|#tag:\xc3\x28invalid",
-		},
-		"datadog tag extension with both valid and invalid utf8 tag values": {
-			in: "foo:100|c|@0.1|#tag1:valid,tag2:\xc3\x28invalid",
-		},
-	}
-
+		"datadog timings with extended aggregation values without tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values and sampling but without tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|@0.5",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values, sampling, and tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|@0.5|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog histogram with extended aggregation values and tags": {
+			in: "foo_histogram:0.5:120:3000:10:20000:0.01|h|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      0.5,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      3000,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      10,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      20000,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog distribution with extended aggregation values": {
+			in: "foo_distribution:0.5:120:3000:10:20000:0.01|d|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      0.5,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      3000,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      10,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      20000,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog counter with invalid extended aggregation values": {
+			in: "foo_counter:0.5:120:3000:10:20000:0.01|c|#tag1:bar,tag2:baz",
+		},
+		"datadog gauge with invalid extended aggregation values": {
+			in: "foo_gauge:0.5:120:3000:10:20000:0.01|g|#tag1:bar,tag2:baz",
+		},
+		"datadog timing with extended aggregation values and invalid signalfx tags": {
+			in: "foo.[tag1=bar,tag2=baz]test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"SignalFX counter with invalid Datadog style extended aggregation values": {
+			in: "foo.[tag1=bar,tag2=baz]test:0.5:120:3000:10:20000:0.01|c",
+		},
+		"SignalFX no tags counter with invalid Datadog style extended aggregation values": {
+			in: "foo.[]test:0.5:120:3000:10:20000:0.01|c",
+		},
+		"SignalFX no tags with invalid Datadog style extended aggregation values and timings type": {
+			in: "foo.[]test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"Influx no tags with invalid Datadog style extended aggregation values and timings type": {
+			in: "foo.test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"Influx no tags with invalid Datadog style extended aggregation values and histogram type": {
+			in: "foo.test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"librato/dogstatsd mixed tag styles without sampling": {
+			in:  "foo#tag1=foo,tag3=bing:100|c|#tag1:bar,#tag2:baz",
+			out: event.Events{},
+		},
+		"signalfx/dogstatsd mixed tag styles without sampling": {
+			in:  "foo[tag1=foo,tag3=bing]:100|c|#tag1:bar,#tag2:baz",
+			out: event.Events{},
+		},
+		"influxdb/dogstatsd mixed tag styles without sampling": {
+			in:  "foo,tag1=foo,tag3=bing:100|c|#tag1:bar,#tag2:baz",
+			out: event.Events{},
+		},
+		"mixed tag styles with sampling": {
+			in:  "foo#tag1=foo,tag3=bing:100|c|@0.1|#tag1:bar,#tag2:baz",
+			out: event.Events{},
+		},
+		"datadog tag extension with multiple colons": {
+			in: "foo:100|c|@0.1|#tag1:foo:bar",
+			out: event.Events{
+				&event.CounterEvent{
+					CMetricName: "foo",
+					CValue:      1000,
+					CLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog tag extension with invalid utf8 tag values": {
+			in: "foo:100|c|@0.1|#tag:\xc3\x28invalid",
+		},
+		"datadog tag extension with both valid and invalid utf8 tag values": {
+			in: "foo:100|c|@0.1|#tag1:valid,tag2:\xc3\x28invalid",
+		},
+	}
+
 	parser := NewParser()
 
 	for name, testCase := range testCases {
@@ -933,37 +1561,331 @@ func TestDisableParsingDogstatsdLineToEvents(t *testing.T) {
 				},
 			},
 		},
-		"librato/dogstatsd mixed tag styles without sampling": {
-			in:  "foo#tag1=foo,tag3=bing:100|c|#tag1:bar,#tag2:baz",
-			out: event.Events{},
-		},
-		"signalfx/dogstatsd mixed tag styles without sampling": {
-			in:  "foo[tag1=foo,tag3=bing]:100|c|#tag1:bar,#tag2:baz",
-			out: event.Events{},
-		},
-		"influxdb/dogstatsd mixed tag styles without sampling": {
-			in:  "foo,tag1=foo,tag3=bing:100|c|#tag1:bar,#tag2:baz",
-			out: event.Events{},
-		},
-		"mixed tag styles with sampling": {
-			in:  "foo#tag1=foo,tag3=bing:100|c|@0.1|#tag1:bar,#tag2:baz",
-			out: event.Events{},
-		},
-		"datadog tag extension with multiple colons": {
-			in: "foo:100|c|@0.1|#tag1:foo:bar",
+		"datadog timings with extended aggregation values": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|#tag1:bar,tag2:baz",
 			out: event.Events{
-				&event.CounterEvent{
-					CMetricName: "foo",
-					CValue:      1000,
-					CLabels:     map[string]string{},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
 				},
 			},
 		},
-		"datadog tag extension with invalid utf8 tag values": {
-			in: "foo:100|c|@0.1|#tag:\xc3\x28invalid",
-		},
-		"datadog tag extension with both valid and invalid utf8 tag values": {
-			in: "foo:100|c|@0.1|#tag1:valid,tag2:\xc3\x28invalid",
+		"datadog timings with extended aggregation values without tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values and sampling but without tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|@0.5",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values, sampling, and tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|@0.5|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog histogram with extended aggregation values and tags": {
+			in: "foo_histogram:0.5:120:3000:10:20000:0.01|h|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      0.5,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      3000,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      10,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      20000,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog distribution with extended aggregation values": {
+			in: "foo_distribution:0.5:120:3000:10:20000:0.01|d|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      0.5,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      3000,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      10,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      20000,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog counter with invalid extended aggregation values": {
+			in: "foo_counter:0.5:120:3000:10:20000:0.01|c|#tag1:bar,tag2:baz",
+		},
+		"datadog gauge with invalid extended aggregation values": {
+			in: "foo_gauge:0.5:120:3000:10:20000:0.01|g|#tag1:bar,tag2:baz",
+		},
+		"datadog timing with extended aggregation values and invalid signalfx tags": {
+			in: "foo.[tag1=bar,tag2=baz]test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"SignalFX counter with invalid Datadog style extended aggregation values": {
+			in: "foo.[tag1=bar,tag2=baz]test:0.5:120:3000:10:20000:0.01|c",
+		},
+		"SignalFX no tags counter with invalid Datadog style extended aggregation values": {
+			in: "foo.[]test:0.5:120:3000:10:20000:0.01|c",
+		},
+		"SignalFX no tags with invalid Datadog style extended aggregation values and timings type": {
+			in: "foo.[]test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"Influx no tags with invalid Datadog style extended aggregation values and timings type": {
+			in: "foo.test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"Influx no tags with invalid Datadog style extended aggregation values and histogram type": {
+			in: "foo.test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"librato/dogstatsd mixed tag styles without sampling": {
+			in:  "foo#tag1=foo,tag3=bing:100|c|#tag1:bar,#tag2:baz",
+			out: event.Events{},
+		},
+		"signalfx/dogstatsd mixed tag styles without sampling": {
+			in:  "foo[tag1=foo,tag3=bing]:100|c|#tag1:bar,#tag2:baz",
+			out: event.Events{},
+		},
+		"influxdb/dogstatsd mixed tag styles without sampling": {
+			in:  "foo,tag1=foo,tag3=bing:100|c|#tag1:bar,#tag2:baz",
+			out: event.Events{},
+		},
+		"mixed tag styles with sampling": {
+			in:  "foo#tag1=foo,tag3=bing:100|c|@0.1|#tag1:bar,#tag2:baz",
+			out: event.Events{},
+		},
+		"datadog tag extension with multiple colons": {
+			in: "foo:100|c|@0.1|#tag1:foo:bar",
+			out: event.Events{
+				&event.CounterEvent{
+					CMetricName: "foo",
+					CValue:      1000,
+					CLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog tag extension with invalid utf8 tag values": {
+			in: "foo:100|c|@0.1|#tag:\xc3\x28invalid",
+		},
+		"datadog tag extension with both valid and invalid utf8 tag values": {
+			in: "foo:100|c|@0.1|#tag1:valid,tag2:\xc3\x28invalid",
 		},
 	}
 
@@ -1102,76 +2024,370 @@ func TestDisableParsingInfluxdbLineToEvents(t *testing.T) {
 				},
 			},
 		},
-		"datadog tag extension": {
-			in: "foo:100|c|#tag1:bar,tag2:baz",
+		"datadog tag extension": {
+			in: "foo:100|c|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.CounterEvent{
+					CMetricName: "foo",
+					CValue:      100,
+					CLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog tag extension with # in all keys (as sent by datadog php client)": {
+			in: "foo:100|c|#tag1:bar,#tag2:baz",
+			out: event.Events{
+				&event.CounterEvent{
+					CMetricName: "foo",
+					CValue:      100,
+					CLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog tag extension with tag keys unsupported by prometheus": {
+			in: "foo:100|c|#09digits:0,tag.with.dots:1",
+			out: event.Events{
+				&event.CounterEvent{
+					CMetricName: "foo",
+					CValue:      100,
+					CLabels:     map[string]string{"_09digits": "0", "tag_with_dots": "1"},
+				},
+			},
+		},
+		"datadog tag extension with valueless tags: ignored": {
+			in: "foo:100|c|#tag_without_a_value",
+			out: event.Events{
+				&event.CounterEvent{
+					CMetricName: "foo",
+					CValue:      100,
+					CLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog tag extension with valueless tags (edge case)": {
+			in: "foo:100|c|#tag_without_a_value,tag:value",
+			out: event.Events{
+				&event.CounterEvent{
+					CMetricName: "foo",
+					CValue:      100,
+					CLabels:     map[string]string{"tag": "value"},
+				},
+			},
+		},
+		"datadog tag extension with empty tags (edge case)": {
+			in: "foo:100|c|#tag:value,,",
+			out: event.Events{
+				&event.CounterEvent{
+					CMetricName: "foo",
+					CValue:      100,
+					CLabels:     map[string]string{"tag": "value"},
+				},
+			},
+		},
+		"datadog tag extension with sampling": {
+			in: "foo:100|c|@0.1|#tag1:bar,#tag2:baz",
+			out: event.Events{
+				&event.CounterEvent{
+					CMetricName: "foo",
+					CValue:      1000,
+					CLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values without tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values and sampling but without tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|@0.5",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values, sampling, and tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|@0.5|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog histogram with extended aggregation values and tags": {
+			in: "foo_histogram:0.5:120:3000:10:20000:0.01|h|#tag1:bar,tag2:baz",
 			out: event.Events{
-				&event.CounterEvent{
-					CMetricName: "foo",
-					CValue:      100,
-					CLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      0.5,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
 				},
-			},
-		},
-		"datadog tag extension with # in all keys (as sent by datadog php client)": {
-			in: "foo:100|c|#tag1:bar,#tag2:baz",
-			out: event.Events{
-				&event.CounterEvent{
-					CMetricName: "foo",
-					CValue:      100,
-					CLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
 				},
-			},
-		},
-		"datadog tag extension with tag keys unsupported by prometheus": {
-			in: "foo:100|c|#09digits:0,tag.with.dots:1",
-			out: event.Events{
-				&event.CounterEvent{
-					CMetricName: "foo",
-					CValue:      100,
-					CLabels:     map[string]string{"_09digits": "0", "tag_with_dots": "1"},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      3000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
 				},
-			},
-		},
-		"datadog tag extension with valueless tags: ignored": {
-			in: "foo:100|c|#tag_without_a_value",
-			out: event.Events{
-				&event.CounterEvent{
-					CMetricName: "foo",
-					CValue:      100,
-					CLabels:     map[string]string{},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      10,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
 				},
-			},
-		},
-		"datadog tag extension with valueless tags (edge case)": {
-			in: "foo:100|c|#tag_without_a_value,tag:value",
-			out: event.Events{
-				&event.CounterEvent{
-					CMetricName: "foo",
-					CValue:      100,
-					CLabels:     map[string]string{"tag": "value"},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      20000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
 				},
-			},
-		},
-		"datadog tag extension with empty tags (edge case)": {
-			in: "foo:100|c|#tag:value,,",
-			out: event.Events{
-				&event.CounterEvent{
-					CMetricName: "foo",
-					CValue:      100,
-					CLabels:     map[string]string{"tag": "value"},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
 				},
 			},
 		},
-		"datadog tag extension with sampling": {
-			in: "foo:100|c|@0.1|#tag1:bar,#tag2:baz",
+		"datadog distribution with extended aggregation values": {
+			in: "foo_distribution:0.5:120:3000:10:20000:0.01|d|#tag1:bar,tag2:baz",
 			out: event.Events{
-				&event.CounterEvent{
-					CMetricName: "foo",
-					CValue:      1000,
-					CLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      0.5,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      3000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      10,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      20000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
 				},
 			},
 		},
+		"datadog counter with invalid extended aggregation values": {
+			in: "foo_counter:0.5:120:3000:10:20000:0.01|c|#tag1:bar,tag2:baz",
+		},
+		"datadog gauge with invalid extended aggregation values": {
+			in: "foo_gauge:0.5:120:3000:10:20000:0.01|g|#tag1:bar,tag2:baz",
+		},
+		"datadog timing with extended aggregation values and invalid signalfx tags": {
+			in: "foo.[tag1=bar,tag2=baz]test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"SignalFX counter with invalid Datadog style extended aggregation values": {
+			in: "foo.[tag1=bar,tag2=baz]test:0.5:120:3000:10:20000:0.01|c",
+		},
+		"SignalFX no tags counter with invalid Datadog style extended aggregation values": {
+			in: "foo.[]test:0.5:120:3000:10:20000:0.01|c",
+		},
+		"SignalFX no tags with invalid Datadog style extended aggregation values and timings type": {
+			in: "foo.[]test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"Influx no tags with invalid Datadog style extended aggregation values and timings type": {
+			in: "foo.test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"Influx no tags with invalid Datadog style extended aggregation values and histogram type": {
+			in: "foo.test:0.5:120:3000:10:20000:0.01|ms",
+		},
 		"librato/dogstatsd mixed tag styles without sampling": {
 			in:  "foo#tag1=foo,tag3=bing:100|c|#tag1:bar,#tag2:baz",
 			out: event.Events{},
@@ -1369,48 +2585,342 @@ func TestDisableParsingSignalfxLineToEvents(t *testing.T) {
 					CValue:      100,
 					CLabels:     map[string]string{"_09digits": "0", "tag_with_dots": "1"},
 				},
-			},
-		},
-		"datadog tag extension with valueless tags: ignored": {
-			in: "foo:100|c|#tag_without_a_value",
-			out: event.Events{
-				&event.CounterEvent{
-					CMetricName: "foo",
-					CValue:      100,
-					CLabels:     map[string]string{},
+			},
+		},
+		"datadog tag extension with valueless tags: ignored": {
+			in: "foo:100|c|#tag_without_a_value",
+			out: event.Events{
+				&event.CounterEvent{
+					CMetricName: "foo",
+					CValue:      100,
+					CLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog tag extension with valueless tags (edge case)": {
+			in: "foo:100|c|#tag_without_a_value,tag:value",
+			out: event.Events{
+				&event.CounterEvent{
+					CMetricName: "foo",
+					CValue:      100,
+					CLabels:     map[string]string{"tag": "value"},
+				},
+			},
+		},
+		"datadog tag extension with empty tags (edge case)": {
+			in: "foo:100|c|#tag:value,,",
+			out: event.Events{
+				&event.CounterEvent{
+					CMetricName: "foo",
+					CValue:      100,
+					CLabels:     map[string]string{"tag": "value"},
+				},
+			},
+		},
+		"datadog tag extension with sampling": {
+			in: "foo:100|c|@0.1|#tag1:bar,#tag2:baz",
+			out: event.Events{
+				&event.CounterEvent{
+					CMetricName: "foo",
+					CValue:      1000,
+					CLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values without tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values and sampling but without tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|@0.5",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values, sampling, and tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|@0.5|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
 				},
-			},
-		},
-		"datadog tag extension with valueless tags (edge case)": {
-			in: "foo:100|c|#tag_without_a_value,tag:value",
-			out: event.Events{
-				&event.CounterEvent{
-					CMetricName: "foo",
-					CValue:      100,
-					CLabels:     map[string]string{"tag": "value"},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
 				},
 			},
 		},
-		"datadog tag extension with empty tags (edge case)": {
-			in: "foo:100|c|#tag:value,,",
+		"datadog histogram with extended aggregation values and tags": {
+			in: "foo_histogram:0.5:120:3000:10:20000:0.01|h|#tag1:bar,tag2:baz",
 			out: event.Events{
-				&event.CounterEvent{
-					CMetricName: "foo",
-					CValue:      100,
-					CLabels:     map[string]string{"tag": "value"},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      0.5,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      3000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      10,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      20000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
 				},
 			},
 		},
-		"datadog tag extension with sampling": {
-			in: "foo:100|c|@0.1|#tag1:bar,#tag2:baz",
+		"datadog distribution with extended aggregation values": {
+			in: "foo_distribution:0.5:120:3000:10:20000:0.01|d|#tag1:bar,tag2:baz",
 			out: event.Events{
-				&event.CounterEvent{
-					CMetricName: "foo",
-					CValue:      1000,
-					CLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      0.5,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      3000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      10,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      20000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
 				},
 			},
 		},
+		"datadog counter with invalid extended aggregation values": {
+			in: "foo_counter:0.5:120:3000:10:20000:0.01|c|#tag1:bar,tag2:baz",
+		},
+		"datadog gauge with invalid extended aggregation values": {
+			in: "foo_gauge:0.5:120:3000:10:20000:0.01|g|#tag1:bar,tag2:baz",
+		},
+		"datadog timing with extended aggregation values and invalid signalfx tags": {
+			in: "foo.[tag1=bar,tag2=baz]test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"SignalFX counter with invalid Datadog style extended aggregation values": {
+			in: "foo.[tag1=bar,tag2=baz]test:0.5:120:3000:10:20000:0.01|c",
+		},
+		"SignalFX no tags counter with invalid Datadog style extended aggregation values": {
+			in: "foo.[]test:0.5:120:3000:10:20000:0.01|c",
+		},
+		"SignalFX no tags with invalid Datadog style extended aggregation values and timings type": {
+			in: "foo.[]test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"Influx no tags with invalid Datadog style extended aggregation values and timings type": {
+			in: "foo.test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"Influx no tags with invalid Datadog style extended aggregation values and histogram type": {
+			in: "foo.test:0.5:120:3000:10:20000:0.01|ms",
+		},
 		"librato/dogstatsd mixed tag styles without sampling": {
 			in:  "foo#tag1=foo,tag3=bing:100|c|#tag1:bar,#tag2:baz",
 			out: event.Events{},
@@ -1650,6 +3160,300 @@ func TestDisableParsingLibratoLineToEvents(t *testing.T) {
 				},
 			},
 		},
+		"datadog timings with extended aggregation values": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values without tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values and sampling but without tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|@0.5",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{},
+				},
+			},
+		},
+		"datadog timings with extended aggregation values, sampling, and tags": {
+			in: "foo_timing:0.5:120:3000:10:20000:0.01|ms|@0.5|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.0005,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      3,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      20,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_timing",
+					OValue:      0.00001,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog histogram with extended aggregation values and tags": {
+			in: "foo_histogram:0.5:120:3000:10:20000:0.01|h|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      0.5,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      3000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      10,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      20000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_histogram",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog distribution with extended aggregation values": {
+			in: "foo_distribution:0.5:120:3000:10:20000:0.01|d|#tag1:bar,tag2:baz",
+			out: event.Events{
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      0.5,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      120,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      3000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      10,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      20000,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+				&event.ObserverEvent{
+					OMetricName: "foo_distribution",
+					OValue:      0.01,
+					OLabels:     map[string]string{"tag1": "bar", "tag2": "baz"},
+				},
+			},
+		},
+		"datadog counter with invalid extended aggregation values": {
+			in: "foo_counter:0.5:120:3000:10:20000:0.01|c|#tag1:bar,tag2:baz",
+		},
+		"datadog gauge with invalid extended aggregation values": {
+			in: "foo_gauge:0.5:120:3000:10:20000:0.01|g|#tag1:bar,tag2:baz",
+		},
+		"datadog timing with extended aggregation values and invalid signalfx tags": {
+			in: "foo.[tag1=bar,tag2=baz]test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"SignalFX counter with invalid Datadog style extended aggregation values": {
+			in: "foo.[tag1=bar,tag2=baz]test:0.5:120:3000:10:20000:0.01|c",
+		},
+		"SignalFX no tags counter with invalid Datadog style extended aggregation values": {
+			in: "foo.[]test:0.5:120:3000:10:20000:0.01|c",
+		},
+		"SignalFX no tags with invalid Datadog style extended aggregation values and timings type": {
+			in: "foo.[]test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"Influx no tags with invalid Datadog style extended aggregation values and timings type": {
+			in: "foo.test:0.5:120:3000:10:20000:0.01|ms",
+		},
+		"Influx no tags with invalid Datadog style extended aggregation values and histogram type": {
+			in: "foo.test:0.5:120:3000:10:20000:0.01|ms",
+		},
 		"librato/dogstatsd mixed tag styles without sampling": {
 			in:  "foo#tag1=foo,tag3=bing:100|c|#tag1:bar,#tag2:baz",
 			out: event.Events{},