1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-07-15 01:04:25 +02:00

Support configurable AggregationTemporality in exporters; add OTLP missing sum point temporality/monotonic fields (#1296)

* Restructure ExportKindSelector helpers; eliminate PassThroughExportKind; add StatelessExportKindSelector()

* WithExportKindSelector(); Additional testing

* Changelog update

* Test the new selectors

* From review feedback

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
Joshua MacDonald
2020-11-10 07:44:42 -08:00
committed by GitHub
parent 3a06b393b9
commit f9984f2d4e
19 changed files with 341 additions and 168 deletions

View File

@ -36,7 +36,7 @@ func TestPullNoCache(t *testing.T) {
puller := pull.New(
basic.New(
selector.NewWithExactDistribution(),
export.CumulativeExporter,
export.CumulativeExportKindSelector(),
basic.WithMemory(true),
),
pull.WithCachePeriod(0),
@ -50,7 +50,7 @@ func TestPullNoCache(t *testing.T) {
require.NoError(t, puller.Collect(ctx))
records := processortest.NewOutput(label.DefaultEncoder())
require.NoError(t, puller.ForEach(export.CumulativeExporter, records.AddRecord))
require.NoError(t, puller.ForEach(export.CumulativeExportKindSelector(), records.AddRecord))
require.EqualValues(t, map[string]float64{
"counter.sum/A=B/": 10,
@ -60,7 +60,7 @@ func TestPullNoCache(t *testing.T) {
require.NoError(t, puller.Collect(ctx))
records = processortest.NewOutput(label.DefaultEncoder())
require.NoError(t, puller.ForEach(export.CumulativeExporter, records.AddRecord))
require.NoError(t, puller.ForEach(export.CumulativeExportKindSelector(), records.AddRecord))
require.EqualValues(t, map[string]float64{
"counter.sum/A=B/": 20,
@ -71,7 +71,7 @@ func TestPullWithCache(t *testing.T) {
puller := pull.New(
basic.New(
selector.NewWithExactDistribution(),
export.CumulativeExporter,
export.CumulativeExportKindSelector(),
basic.WithMemory(true),
),
pull.WithCachePeriod(time.Second),
@ -87,7 +87,7 @@ func TestPullWithCache(t *testing.T) {
require.NoError(t, puller.Collect(ctx))
records := processortest.NewOutput(label.DefaultEncoder())
require.NoError(t, puller.ForEach(export.CumulativeExporter, records.AddRecord))
require.NoError(t, puller.ForEach(export.CumulativeExportKindSelector(), records.AddRecord))
require.EqualValues(t, map[string]float64{
"counter.sum/A=B/": 10,
@ -98,7 +98,7 @@ func TestPullWithCache(t *testing.T) {
// Cached value!
require.NoError(t, puller.Collect(ctx))
records = processortest.NewOutput(label.DefaultEncoder())
require.NoError(t, puller.ForEach(export.CumulativeExporter, records.AddRecord))
require.NoError(t, puller.ForEach(export.CumulativeExportKindSelector(), records.AddRecord))
require.EqualValues(t, map[string]float64{
"counter.sum/A=B/": 10,
@ -110,7 +110,7 @@ func TestPullWithCache(t *testing.T) {
// Re-computed value!
require.NoError(t, puller.Collect(ctx))
records = processortest.NewOutput(label.DefaultEncoder())
require.NoError(t, puller.ForEach(export.CumulativeExporter, records.AddRecord))
require.NoError(t, puller.ForEach(export.CumulativeExportKindSelector(), records.AddRecord))
require.EqualValues(t, map[string]float64{
"counter.sum/A=B/": 20,