1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-25 22:41:46 +02:00

Add Exemplar to metricdata package (#3849)

* Add Exemplar to metricdata pkg

* Update histogram Aggregator

* Update opencensus bridge

* Update prometheus exporter

* Update OTLP exporter

* Update stdoutmetric exporter

* Add changes to changelog

* Update fail tests

* Add tests for IgnoreExemplars

* Fix merge
This commit is contained in:
Tyler Yahn
2023-03-14 07:56:18 -07:00
committed by GitHub
parent b62eb2ca88
commit 01b8f15a72
16 changed files with 550 additions and 143 deletions

View File

@@ -38,15 +38,19 @@ func TestFailAssertEqual(t *testing.T) {
t.Run("ResourceMetrics", testFailDatatype(resourceMetricsA, resourceMetricsB))
t.Run("ScopeMetrics", testFailDatatype(scopeMetricsA, scopeMetricsB))
t.Run("Metrics", testFailDatatype(metricsA, metricsB))
t.Run("Histogram", testFailDatatype(histogramA, histogramB))
t.Run("HistogramInt64", testFailDatatype(histogramInt64A, histogramInt64B))
t.Run("HistogramFloat64", testFailDatatype(histogramFloat64A, histogramFloat64B))
t.Run("SumInt64", testFailDatatype(sumInt64A, sumInt64B))
t.Run("SumFloat64", testFailDatatype(sumFloat64A, sumFloat64B))
t.Run("GaugeInt64", testFailDatatype(gaugeInt64A, gaugeInt64B))
t.Run("GaugeFloat64", testFailDatatype(gaugeFloat64A, gaugeFloat64B))
t.Run("HistogramDataPoint", testFailDatatype(histogramDataPointA, histogramDataPointB))
t.Run("HistogramDataPointInt64", testFailDatatype(histogramDataPointInt64A, histogramDataPointInt64B))
t.Run("HistogramDataPointFloat64", testFailDatatype(histogramDataPointFloat64A, histogramDataPointFloat64B))
t.Run("DataPointInt64", testFailDatatype(dataPointInt64A, dataPointInt64B))
t.Run("DataPointFloat64", testFailDatatype(dataPointFloat64A, dataPointFloat64B))
t.Run("ExemplarInt64", testFailDatatype(exemplarInt64A, exemplarInt64B))
t.Run("ExemplarFloat64", testFailDatatype(exemplarFloat64A, exemplarFloat64B))
t.Run("Extrema", testFailDatatype(minA, minB))
}
func TestFailAssertAggregationsEqual(t *testing.T) {
@@ -57,20 +61,23 @@ func TestFailAssertAggregationsEqual(t *testing.T) {
AssertAggregationsEqual(t, sumFloat64A, sumFloat64B)
AssertAggregationsEqual(t, gaugeInt64A, gaugeInt64B)
AssertAggregationsEqual(t, gaugeFloat64A, gaugeFloat64B)
AssertAggregationsEqual(t, histogramA, histogramB)
AssertAggregationsEqual(t, histogramInt64A, histogramInt64B)
AssertAggregationsEqual(t, histogramFloat64A, histogramFloat64B)
}
func TestFailAssertAttribute(t *testing.T) {
AssertHasAttributes(t, exemplarInt64A, attribute.Bool("A", false))
AssertHasAttributes(t, exemplarFloat64A, attribute.Bool("B", true))
AssertHasAttributes(t, dataPointInt64A, attribute.Bool("A", false))
AssertHasAttributes(t, dataPointFloat64A, attribute.Bool("B", true))
AssertHasAttributes(t, gaugeInt64A, attribute.Bool("A", false))
AssertHasAttributes(t, gaugeFloat64A, attribute.Bool("B", true))
AssertHasAttributes(t, sumInt64A, attribute.Bool("A", false))
AssertHasAttributes(t, sumFloat64A, attribute.Bool("B", true))
AssertHasAttributes(t, histogramDataPointA, attribute.Bool("A", false))
AssertHasAttributes(t, histogramDataPointA, attribute.Bool("B", true))
AssertHasAttributes(t, histogramA, attribute.Bool("A", false))
AssertHasAttributes(t, histogramA, attribute.Bool("B", true))
AssertHasAttributes(t, histogramDataPointInt64A, attribute.Bool("A", false))
AssertHasAttributes(t, histogramDataPointFloat64A, attribute.Bool("B", true))
AssertHasAttributes(t, histogramInt64A, attribute.Bool("A", false))
AssertHasAttributes(t, histogramFloat64A, attribute.Bool("B", true))
AssertHasAttributes(t, metricsA, attribute.Bool("A", false))
AssertHasAttributes(t, metricsA, attribute.Bool("B", true))
AssertHasAttributes(t, resourceMetricsA, attribute.Bool("A", false))