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

Add export timestamps; distinguish Accumulation vs. Record (#835)

* Introduce Accumulation

* Refactor export structs

* FTB exporters

* Test timestamps

* Test no-start case

* From feedback

* Apply suggestions from code review

(Thanks @MrAlias!)

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

* Comments in sdk/metric/integrator/test

* Fix build

* Comments and feedback

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
Joshua MacDonald
2020-06-18 10:16:33 -07:00
committed by GitHub
parent c36fcd2dc4
commit 4e4271791f
25 changed files with 513 additions and 197 deletions

View File

@ -44,9 +44,9 @@ func TestPullNoCache(t *testing.T) {
counter.Add(ctx, 10, kv.String("A", "B"))
puller.Collect(ctx)
require.NoError(t, puller.Collect(ctx))
records := test.NewOutput(label.DefaultEncoder())
_ = puller.ForEach(records.AddTo)
require.NoError(t, puller.ForEach(records.AddRecord))
require.EqualValues(t, map[string]float64{
"counter/A=B/": 10,
@ -54,9 +54,9 @@ func TestPullNoCache(t *testing.T) {
counter.Add(ctx, 10, kv.String("A", "B"))
puller.Collect(ctx)
require.NoError(t, puller.Collect(ctx))
records = test.NewOutput(label.DefaultEncoder())
_ = puller.ForEach(records.AddTo)
require.NoError(t, puller.ForEach(records.AddRecord))
require.EqualValues(t, map[string]float64{
"counter/A=B/": 20,
@ -78,9 +78,9 @@ func TestPullWithCache(t *testing.T) {
counter.Add(ctx, 10, kv.String("A", "B"))
puller.Collect(ctx)
require.NoError(t, puller.Collect(ctx))
records := test.NewOutput(label.DefaultEncoder())
_ = puller.ForEach(records.AddTo)
require.NoError(t, puller.ForEach(records.AddRecord))
require.EqualValues(t, map[string]float64{
"counter/A=B/": 10,
@ -89,9 +89,9 @@ func TestPullWithCache(t *testing.T) {
counter.Add(ctx, 10, kv.String("A", "B"))
// Cached value!
puller.Collect(ctx)
require.NoError(t, puller.Collect(ctx))
records = test.NewOutput(label.DefaultEncoder())
_ = puller.ForEach(records.AddTo)
require.NoError(t, puller.ForEach(records.AddRecord))
require.EqualValues(t, map[string]float64{
"counter/A=B/": 10,
@ -101,9 +101,9 @@ func TestPullWithCache(t *testing.T) {
runtime.Gosched()
// Re-computed value!
puller.Collect(ctx)
require.NoError(t, puller.Collect(ctx))
records = test.NewOutput(label.DefaultEncoder())
_ = puller.ForEach(records.AddTo)
require.NoError(t, puller.ForEach(records.AddRecord))
require.EqualValues(t, map[string]float64{
"counter/A=B/": 20,