mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
#### Description Alternative to #14162, where we make the map of extensions a mandatory positional parameter to replace `host` instead of an option. #### Link to tracking issue Fixes #13640 #### Testing Existing tests make extensive use of the modified functions #### Documentation Added line in ToServer/ToClient(Conn) documentation describing the intended use of the extensions parameter. --------- Co-authored-by: Pablo Baeyens <[email protected]> Co-authored-by: Pablo Baeyens <[email protected]>
26 lines
746 B
Go
26 lines
746 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package componenttest // import "go.opentelemetry.io/collector/component/componenttest"
|
|
|
|
import (
|
|
"go.opentelemetry.io/collector/component"
|
|
)
|
|
|
|
var _ component.Host = (*nopHost)(nil)
|
|
|
|
// nopHost mocks a [component.Host] for testing purposes.
|
|
type nopHost struct{}
|
|
|
|
// NewNopHost returns a [component.Host] that returns empty values
|
|
// from method calls. This host is intended to be used in tests
|
|
// where a bare-minimum host is desired.
|
|
func NewNopHost() component.Host {
|
|
return &nopHost{}
|
|
}
|
|
|
|
// GetExtensions returns an empty extensions map.
|
|
func (nh *nopHost) GetExtensions() map[component.ID]component.Component {
|
|
return map[component.ID]component.Component{}
|
|
}
|