You've already forked opentelemetry-go
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:
@ -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,
|
||||
|
Reference in New Issue
Block a user