You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-07-13 01:00:22 +02:00
Combine the Push and Pull metric controllers (#1378)
* Push->basic * Repackage * Rename away from push * Make exporter optional; export from a separate goroutine * Move pull_test into controller_test * Precommit pass * New OTLP/Prom example * Precommit * Fix the example * Shorten the example * Test starting controller w/o exporter * Test export timeout * Remove ancient example & lint * go.mod revert & tidy * Comments * Tidy a diff * Tidy a diff * Move export kind selector in the new example * Split this test into its original parts * Reduce diff size * Changelog * Remove extra Add/Done pair * Remove unused stopCh param; document the Stop behavior * Typo * Use ctx * Missed v0.15 * Apply PR feedback * Precommit pass * 0.14 -> 0.15 in new file * Remove diff chunk markers * Fix OTLP example * Upstream * dashpole comments * aneurysm9 feedback * Tidy go.sum
This commit is contained in:
37
sdk/metric/controller/basic/config_test.go
Normal file
37
sdk/metric/controller/basic/config_test.go
Normal file
@ -0,0 +1,37 @@
|
||||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package basic
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"go.opentelemetry.io/otel/label"
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
)
|
||||
|
||||
func TestWithResource(t *testing.T) {
|
||||
r := resource.NewWithAttributes(label.String("A", "a"))
|
||||
|
||||
c := &Config{}
|
||||
WithResource(r).Apply(c)
|
||||
assert.Equal(t, r.Equivalent(), c.Resource.Equivalent())
|
||||
|
||||
// Ensure overwriting works.
|
||||
c = &Config{Resource: &resource.Resource{}}
|
||||
WithResource(r).Apply(c)
|
||||
assert.Equal(t, r.Equivalent(), c.Resource.Equivalent())
|
||||
}
|
Reference in New Issue
Block a user