[chore] remove unnecessary underscores (#9580)
As per feedback from my previous PR Signed-off-by: Alex Boten <aboten@lightstep.com>
This commit is contained in:
parent
9c199ef4fa
commit
062d0a7ffc
|
|
@ -15,7 +15,7 @@ func NewNopHost() component.Host {
|
||||||
return &nopHost{}
|
return &nopHost{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (nh *nopHost) GetFactory(_ component.Kind, _ component.Type) component.Factory {
|
func (nh *nopHost) GetFactory(component.Kind, component.Type) component.Factory {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ import (
|
||||||
// testBalancerBuilder facilitates testing validateBalancerName().
|
// testBalancerBuilder facilitates testing validateBalancerName().
|
||||||
type testBalancerBuilder struct{}
|
type testBalancerBuilder struct{}
|
||||||
|
|
||||||
func (testBalancerBuilder) Build(_ balancer.ClientConn, _ balancer.BuildOptions) balancer.Balancer {
|
func (testBalancerBuilder) Build(balancer.ClientConn, balancer.BuildOptions) balancer.Balancer {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -953,7 +953,7 @@ func TestDefaultUnaryInterceptorAuthFailure(t *testing.T) {
|
||||||
authCalled = true
|
authCalled = true
|
||||||
return context.Background(), expectedErr
|
return context.Background(), expectedErr
|
||||||
}
|
}
|
||||||
handler := func(_ context.Context, _ any) (any, error) {
|
handler := func(context.Context, any) (any, error) {
|
||||||
assert.FailNow(t, "the handler should not have been called on auth failure!")
|
assert.FailNow(t, "the handler should not have been called on auth failure!")
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
@ -974,7 +974,7 @@ func TestDefaultUnaryInterceptorMissingMetadata(t *testing.T) {
|
||||||
assert.FailNow(t, "the auth func should not have been called!")
|
assert.FailNow(t, "the auth func should not have been called!")
|
||||||
return context.Background(), nil
|
return context.Background(), nil
|
||||||
}
|
}
|
||||||
handler := func(_ context.Context, _ any) (any, error) {
|
handler := func(context.Context, any) (any, error) {
|
||||||
assert.FailNow(t, "the handler should not have been called!")
|
assert.FailNow(t, "the handler should not have been called!")
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
@ -1027,7 +1027,7 @@ func TestDefaultStreamInterceptorAuthFailure(t *testing.T) {
|
||||||
authCalled = true
|
authCalled = true
|
||||||
return context.Background(), expectedErr
|
return context.Background(), expectedErr
|
||||||
}
|
}
|
||||||
handler := func(_ any, _ grpc.ServerStream) error {
|
handler := func(any, grpc.ServerStream) error {
|
||||||
assert.FailNow(t, "the handler should not have been called on auth failure!")
|
assert.FailNow(t, "the handler should not have been called on auth failure!")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -1050,7 +1050,7 @@ func TestDefaultStreamInterceptorMissingMetadata(t *testing.T) {
|
||||||
assert.FailNow(t, "the auth func should not have been called!")
|
assert.FailNow(t, "the auth func should not have been called!")
|
||||||
return context.Background(), nil
|
return context.Background(), nil
|
||||||
}
|
}
|
||||||
handler := func(_ any, _ grpc.ServerStream) error {
|
handler := func(any, grpc.ServerStream) error {
|
||||||
assert.FailNow(t, "the handler should not have been called!")
|
assert.FailNow(t, "the handler should not have been called!")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ func httpContentDecompressor(h http.Handler, eh func(w http.ResponseWriter, r *h
|
||||||
errHandler: errHandler,
|
errHandler: errHandler,
|
||||||
base: h,
|
base: h,
|
||||||
decoders: map[string]func(body io.ReadCloser) (io.ReadCloser, error){
|
decoders: map[string]func(body io.ReadCloser) (io.ReadCloser, error){
|
||||||
"": func(_ io.ReadCloser) (io.ReadCloser, error) {
|
"": func(io.ReadCloser) (io.ReadCloser, error) {
|
||||||
// Not a compressed payload. Nothing to do.
|
// Not a compressed payload. Nothing to do.
|
||||||
return nil, nil
|
return nil, nil
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ func TestHTTPContentCompressionRequestWithNilBody(t *testing.T) {
|
||||||
type copyFailBody struct {
|
type copyFailBody struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*copyFailBody) Read(_ []byte) (n int, err error) {
|
func (*copyFailBody) Read([]byte) (n int, err error) {
|
||||||
return 0, fmt.Errorf("read failed")
|
return 0, fmt.Errorf("read failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ type customRoundTripper struct {
|
||||||
|
|
||||||
var _ http.RoundTripper = (*customRoundTripper)(nil)
|
var _ http.RoundTripper = (*customRoundTripper)(nil)
|
||||||
|
|
||||||
func (c *customRoundTripper) RoundTrip(_ *http.Request) (*http.Response, error) {
|
func (c *customRoundTripper) RoundTrip(*http.Request) (*http.Response, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -159,7 +159,7 @@ func TestAllHTTPClientSettings(t *testing.T) {
|
||||||
},
|
},
|
||||||
ReadBufferSize: 1024,
|
ReadBufferSize: 1024,
|
||||||
WriteBufferSize: 512,
|
WriteBufferSize: 512,
|
||||||
CustomRoundTripper: func(_ http.RoundTripper) (http.RoundTripper, error) { return nil, errors.New("error") },
|
CustomRoundTripper: func(http.RoundTripper) (http.RoundTripper, error) { return nil, errors.New("error") },
|
||||||
},
|
},
|
||||||
shouldError: true,
|
shouldError: true,
|
||||||
},
|
},
|
||||||
|
|
@ -856,7 +856,7 @@ func TestHttpCorsInvalidSettings(t *testing.T) {
|
||||||
s, err := hss.ToServer(
|
s, err := hss.ToServer(
|
||||||
componenttest.NewNopHost(),
|
componenttest.NewNopHost(),
|
||||||
componenttest.NewNopTelemetrySettings(),
|
componenttest.NewNopTelemetrySettings(),
|
||||||
http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {}))
|
http.HandlerFunc(func(http.ResponseWriter, *http.Request) {}))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NotNil(t, s)
|
require.NotNil(t, s)
|
||||||
require.NoError(t, s.Close())
|
require.NoError(t, s.Close())
|
||||||
|
|
@ -1186,7 +1186,7 @@ func TestServerAuth(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
handlerCalled := false
|
handlerCalled := false
|
||||||
handler := http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {
|
handler := http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
|
||||||
handlerCalled = true
|
handlerCalled = true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -1231,7 +1231,7 @@ func TestFailedServerAuth(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
srv, err := hss.ToServer(host, componenttest.NewNopTelemetrySettings(), http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {}))
|
srv, err := hss.ToServer(host, componenttest.NewNopTelemetrySettings(), http.HandlerFunc(func(http.ResponseWriter, *http.Request) {}))
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// test
|
// test
|
||||||
|
|
@ -1257,7 +1257,7 @@ func TestServerWithErrorHandler(t *testing.T) {
|
||||||
srv, err := hss.ToServer(
|
srv, err := hss.ToServer(
|
||||||
componenttest.NewNopHost(),
|
componenttest.NewNopHost(),
|
||||||
componenttest.NewNopTelemetrySettings(),
|
componenttest.NewNopTelemetrySettings(),
|
||||||
http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {}),
|
http.HandlerFunc(func(http.ResponseWriter, *http.Request) {}),
|
||||||
WithErrorHandler(eh),
|
WithErrorHandler(eh),
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
@ -1285,7 +1285,7 @@ func TestServerWithDecoder(t *testing.T) {
|
||||||
srv, err := hss.ToServer(
|
srv, err := hss.ToServer(
|
||||||
componenttest.NewNopHost(),
|
componenttest.NewNopHost(),
|
||||||
componenttest.NewNopTelemetrySettings(),
|
componenttest.NewNopTelemetrySettings(),
|
||||||
http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {}),
|
http.HandlerFunc(func(http.ResponseWriter, *http.Request) {}),
|
||||||
WithDecoder("something-else", decoder),
|
WithDecoder("something-else", decoder),
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
|
||||||
|
|
@ -169,8 +169,8 @@ func (c TLSSetting) loadTLSConfig() (*tls.Config, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to load TLS cert and key: %w", err)
|
return nil, fmt.Errorf("failed to load TLS cert and key: %w", err)
|
||||||
}
|
}
|
||||||
getCertificate = func(_ *tls.ClientHelloInfo) (*tls.Certificate, error) { return certReloader.GetCertificate() }
|
getCertificate = func(*tls.ClientHelloInfo) (*tls.Certificate, error) { return certReloader.GetCertificate() }
|
||||||
getClientCertificate = func(_ *tls.CertificateRequestInfo) (*tls.Certificate, error) { return certReloader.GetCertificate() }
|
getClientCertificate = func(*tls.CertificateRequestInfo) (*tls.Certificate, error) { return certReloader.GetCertificate() }
|
||||||
}
|
}
|
||||||
|
|
||||||
minTLS, err := convertVersion(c.MinVersion, defaultMinTLSVersion)
|
minTLS, err := convertVersion(c.MinVersion, defaultMinTLSVersion)
|
||||||
|
|
@ -342,7 +342,7 @@ func (c TLSServerSetting) LoadTLSConfig() (*tls.Config, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
tlsCfg.GetConfigForClient = func(_ *tls.ClientHelloInfo) (*tls.Config, error) { return reloader.getClientConfig(tlsCfg) }
|
tlsCfg.GetConfigForClient = func(*tls.ClientHelloInfo) (*tls.Config, error) { return reloader.getClientConfig(tlsCfg) }
|
||||||
}
|
}
|
||||||
tlsCfg.ClientCAs = reloader.certPool
|
tlsCfg.ClientCAs = reloader.certPool
|
||||||
tlsCfg.ClientAuth = tls.RequireAndVerifyClientCert
|
tlsCfg.ClientAuth = tls.RequireAndVerifyClientCert
|
||||||
|
|
|
||||||
|
|
@ -394,7 +394,7 @@ type errConfig struct {
|
||||||
Foo string `mapstructure:"foo"`
|
Foo string `mapstructure:"foo"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tc *errConfig) Unmarshal(_ *Conf) error {
|
func (tc *errConfig) Unmarshal(*Conf) error {
|
||||||
return errors.New("never works")
|
return errors.New("never works")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,6 @@ func (s schemeProvider) Scheme() string {
|
||||||
return s.scheme
|
return s.scheme
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s schemeProvider) Shutdown(_ context.Context) error {
|
func (s schemeProvider) Shutdown(context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ type converter struct{}
|
||||||
// New returns a confmap.Converter, that expands all environment variables for a given confmap.Conf.
|
// New returns a confmap.Converter, that expands all environment variables for a given confmap.Conf.
|
||||||
//
|
//
|
||||||
// Notice: This API is experimental.
|
// Notice: This API is experimental.
|
||||||
func New(_ confmap.ConverterSettings) confmap.Converter {
|
func New(confmap.ConverterSettings) confmap.Converter {
|
||||||
return converter{}
|
return converter{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ type provider struct{}
|
||||||
//
|
//
|
||||||
// This Provider supports "env" scheme, and can be called with a selector:
|
// This Provider supports "env" scheme, and can be called with a selector:
|
||||||
// `env:NAME_OF_ENVIRONMENT_VARIABLE`
|
// `env:NAME_OF_ENVIRONMENT_VARIABLE`
|
||||||
func NewWithSettings(_ confmap.ProviderSettings) confmap.Provider {
|
func NewWithSettings(confmap.ProviderSettings) confmap.Provider {
|
||||||
return &provider{}
|
return &provider{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ type provider struct{}
|
||||||
// `file:/path/to/file` - absolute path (unix, windows)
|
// `file:/path/to/file` - absolute path (unix, windows)
|
||||||
// `file:c:/path/to/file` - absolute path including drive-letter (windows)
|
// `file:c:/path/to/file` - absolute path including drive-letter (windows)
|
||||||
// `file:c:\path\to\file` - absolute path including drive-letter (windows)
|
// `file:c:\path\to\file` - absolute path including drive-letter (windows)
|
||||||
func NewWithSettings(_ confmap.ProviderSettings) confmap.Provider {
|
func NewWithSettings(confmap.ProviderSettings) confmap.Provider {
|
||||||
return &provider{}
|
return &provider{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ func TestEmptyURI(t *testing.T) {
|
||||||
|
|
||||||
func TestRetrieveFromShutdownServer(t *testing.T) {
|
func TestRetrieveFromShutdownServer(t *testing.T) {
|
||||||
fp := New(HTTPScheme, confmap.ProviderSettings{})
|
fp := New(HTTPScheme, confmap.ProviderSettings{})
|
||||||
ts := httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {}))
|
ts := httptest.NewServer(http.HandlerFunc(func(http.ResponseWriter, *http.Request) {}))
|
||||||
ts.Close()
|
ts.Close()
|
||||||
_, err := fp.Retrieve(context.Background(), ts.URL, nil)
|
_, err := fp.Retrieve(context.Background(), ts.URL, nil)
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ type provider struct{}
|
||||||
// Examples:
|
// Examples:
|
||||||
// `yaml:processors::batch::timeout: 2s`
|
// `yaml:processors::batch::timeout: 2s`
|
||||||
// `yaml:processors::batch/foo::timeout: 3s`
|
// `yaml:processors::batch/foo::timeout: 3s`
|
||||||
func NewWithSettings(_ confmap.ProviderSettings) confmap.Provider {
|
func NewWithSettings(confmap.ProviderSettings) confmap.Provider {
|
||||||
return &provider{}
|
return &provider{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ func TestResolverErrors(t *testing.T) {
|
||||||
locations: []string{"mock:", "err:"},
|
locations: []string{"mock:", "err:"},
|
||||||
providers: []Provider{
|
providers: []Provider{
|
||||||
&mockProvider{},
|
&mockProvider{},
|
||||||
&mockProvider{scheme: "err", retM: map[string]any{}, closeFunc: func(_ context.Context) error { return errors.New("close_err") }},
|
&mockProvider{scheme: "err", retM: map[string]any{}, closeFunc: func(context.Context) error { return errors.New("close_err") }},
|
||||||
},
|
},
|
||||||
expectCloseErr: true,
|
expectCloseErr: true,
|
||||||
},
|
},
|
||||||
|
|
@ -270,7 +270,7 @@ func TestResolver(t *testing.T) {
|
||||||
numCalls := atomic.Int32{}
|
numCalls := atomic.Int32{}
|
||||||
resolver, err := NewResolver(ResolverSettings{
|
resolver, err := NewResolver(ResolverSettings{
|
||||||
URIs: []string{"mock:"},
|
URIs: []string{"mock:"},
|
||||||
Providers: makeMapProvidersMap(&mockProvider{retM: map[string]any{}, closeFunc: func(_ context.Context) error {
|
Providers: makeMapProvidersMap(&mockProvider{retM: map[string]any{}, closeFunc: func(context.Context) error {
|
||||||
numCalls.Add(1)
|
numCalls.Add(1)
|
||||||
return nil
|
return nil
|
||||||
}}),
|
}}),
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ func TestBuilder(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "unknown",
|
name: "unknown",
|
||||||
id: component.MustNewID("unknown"),
|
id: component.MustNewID("unknown"),
|
||||||
err: func(_, _ component.DataType) string {
|
err: func(component.DataType, component.DataType) string {
|
||||||
return "connector factory not available for: \"unknown\""
|
return "connector factory not available for: \"unknown\""
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -257,14 +257,14 @@ func TestBuilder(t *testing.T) {
|
||||||
{
|
{
|
||||||
name: "all",
|
name: "all",
|
||||||
id: component.MustNewID("all"),
|
id: component.MustNewID("all"),
|
||||||
err: func(_, _ component.DataType) string {
|
err: func(component.DataType, component.DataType) string {
|
||||||
return ""
|
return ""
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "all/named",
|
name: "all/named",
|
||||||
id: component.MustNewIDWithName("all", "named"),
|
id: component.MustNewIDWithName("all", "named"),
|
||||||
err: func(_, _ component.DataType) string {
|
err: func(component.DataType, component.DataType) string {
|
||||||
return ""
|
return ""
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@ import (
|
||||||
// NewErr returns a Consumer that just drops all received data and returns the specified error to Consume* callers.
|
// NewErr returns a Consumer that just drops all received data and returns the specified error to Consume* callers.
|
||||||
func NewErr(err error) Consumer {
|
func NewErr(err error) Consumer {
|
||||||
return &baseConsumer{
|
return &baseConsumer{
|
||||||
ConsumeTracesFunc: func(_ context.Context, _ ptrace.Traces) error { return err },
|
ConsumeTracesFunc: func(context.Context, ptrace.Traces) error { return err },
|
||||||
ConsumeMetricsFunc: func(_ context.Context, _ pmetric.Metrics) error { return err },
|
ConsumeMetricsFunc: func(context.Context, pmetric.Metrics) error { return err },
|
||||||
ConsumeLogsFunc: func(_ context.Context, _ plog.Logs) error { return err },
|
ConsumeLogsFunc: func(context.Context, plog.Logs) error { return err },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,8 @@ import (
|
||||||
// NewNop returns a Consumer that just drops all received data and returns no error.
|
// NewNop returns a Consumer that just drops all received data and returns no error.
|
||||||
func NewNop() Consumer {
|
func NewNop() Consumer {
|
||||||
return &baseConsumer{
|
return &baseConsumer{
|
||||||
ConsumeTracesFunc: func(_ context.Context, _ ptrace.Traces) error { return nil },
|
ConsumeTracesFunc: func(context.Context, ptrace.Traces) error { return nil },
|
||||||
ConsumeMetricsFunc: func(_ context.Context, _ pmetric.Metrics) error { return nil },
|
ConsumeMetricsFunc: func(context.Context, pmetric.Metrics) error { return nil },
|
||||||
ConsumeLogsFunc: func(_ context.Context, _ plog.Logs) error { return nil },
|
ConsumeLogsFunc: func(context.Context, plog.Logs) error { return nil },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ var (
|
||||||
}()
|
}()
|
||||||
)
|
)
|
||||||
|
|
||||||
func newNoopObsrepSender(_ *ObsReport) requestSender {
|
func newNoopObsrepSender(*ObsReport) requestSender {
|
||||||
return &baseRequestSender{}
|
return &baseRequestSender{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,8 +50,8 @@ func TestBaseExporterWithOptions(t *testing.T) {
|
||||||
want := errors.New("my error")
|
want := errors.New("my error")
|
||||||
be, err := newBaseExporter(
|
be, err := newBaseExporter(
|
||||||
defaultSettings, defaultType, false, nil, nil, newNoopObsrepSender,
|
defaultSettings, defaultType, false, nil, nil, newNoopObsrepSender,
|
||||||
WithStart(func(_ context.Context, _ component.Host) error { return want }),
|
WithStart(func(context.Context, component.Host) error { return want }),
|
||||||
WithShutdown(func(_ context.Context) error { return want }),
|
WithShutdown(func(context.Context) error { return want }),
|
||||||
WithTimeout(NewDefaultTimeoutSettings()),
|
WithTimeout(NewDefaultTimeoutSettings()),
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ type fakeRequest struct {
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r fakeRequest) Export(_ context.Context) error {
|
func (r fakeRequest) Export(context.Context) error {
|
||||||
return r.err
|
return r.err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,12 +26,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func mockRequestUnmarshaler(mr Request) exporterqueue.Unmarshaler[Request] {
|
func mockRequestUnmarshaler(mr Request) exporterqueue.Unmarshaler[Request] {
|
||||||
return func(_ []byte) (Request, error) {
|
return func([]byte) (Request, error) {
|
||||||
return mr, nil
|
return mr, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func mockRequestMarshaler(_ Request) ([]byte, error) {
|
func mockRequestMarshaler(Request) ([]byte, error) {
|
||||||
return []byte("mockRequest"), nil
|
return []byte("mockRequest"), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -261,7 +261,7 @@ func TestQueueRetryWithDisabledRetires(t *testing.T) {
|
||||||
|
|
||||||
type mockErrorRequest struct{}
|
type mockErrorRequest struct{}
|
||||||
|
|
||||||
func (mer *mockErrorRequest) Export(_ context.Context) error {
|
func (mer *mockErrorRequest) Export(context.Context) error {
|
||||||
return errors.New("transient error")
|
return errors.New("transient error")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -330,7 +330,7 @@ type observabilityConsumerSender struct {
|
||||||
droppedItemsCount *atomic.Int64
|
droppedItemsCount *atomic.Int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func newObservabilityConsumerSender(_ *ObsReport) requestSender {
|
func newObservabilityConsumerSender(*ObsReport) requestSender {
|
||||||
return &observabilityConsumerSender{
|
return &observabilityConsumerSender{
|
||||||
waitGroup: new(sync.WaitGroup),
|
waitGroup: new(sync.WaitGroup),
|
||||||
droppedItemsCount: &atomic.Int64{},
|
droppedItemsCount: &atomic.Int64{},
|
||||||
|
|
|
||||||
|
|
@ -367,7 +367,7 @@ func TestTracesRequestExporter_WithShutdown_ReturnError(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTraceDataPusher(retError error) consumer.ConsumeTracesFunc {
|
func newTraceDataPusher(retError error) consumer.ConsumeTracesFunc {
|
||||||
return func(_ context.Context, _ ptrace.Traces) error {
|
return func(context.Context, ptrace.Traces) error {
|
||||||
return retError
|
return retError
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ func checkMetrics(t *testing.T, params CheckConsumeContractParams, mockReceiver
|
||||||
fmt.Printf("Number of permanent errors: %d\n", reqCounter.error.permanent)
|
fmt.Printf("Number of permanent errors: %d\n", reqCounter.error.permanent)
|
||||||
fmt.Printf("Number of non-permanent errors: %d\n", reqCounter.error.nonpermanent)
|
fmt.Printf("Number of non-permanent errors: %d\n", reqCounter.error.nonpermanent)
|
||||||
|
|
||||||
assert.EventuallyWithT(t, func(_ *assert.CollectT) {
|
assert.EventuallyWithT(t, func(*assert.CollectT) {
|
||||||
checkIfTestPassed(t, params.NumberOfTestElements, *reqCounter)
|
checkIfTestPassed(t, params.NumberOfTestElements, *reqCounter)
|
||||||
}, 2*time.Second, 100*time.Millisecond)
|
}, 2*time.Second, 100*time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
@ -181,7 +181,7 @@ func checkTraces(t *testing.T, params CheckConsumeContractParams, mockReceiver c
|
||||||
fmt.Printf("Number of permanent errors: %d\n", reqCounter.error.permanent)
|
fmt.Printf("Number of permanent errors: %d\n", reqCounter.error.permanent)
|
||||||
fmt.Printf("Number of non-permanent errors: %d\n", reqCounter.error.nonpermanent)
|
fmt.Printf("Number of non-permanent errors: %d\n", reqCounter.error.nonpermanent)
|
||||||
|
|
||||||
assert.EventuallyWithT(t, func(_ *assert.CollectT) {
|
assert.EventuallyWithT(t, func(*assert.CollectT) {
|
||||||
checkIfTestPassed(t, params.NumberOfTestElements, *reqCounter)
|
checkIfTestPassed(t, params.NumberOfTestElements, *reqCounter)
|
||||||
}, 2*time.Second, 100*time.Millisecond)
|
}, 2*time.Second, 100*time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
@ -220,7 +220,7 @@ func checkLogs(t *testing.T, params CheckConsumeContractParams, mockReceiver com
|
||||||
fmt.Printf("Number of permanent errors: %d\n", reqCounter.error.permanent)
|
fmt.Printf("Number of permanent errors: %d\n", reqCounter.error.permanent)
|
||||||
fmt.Printf("Number of non-permanent errors: %d\n", reqCounter.error.nonpermanent)
|
fmt.Printf("Number of non-permanent errors: %d\n", reqCounter.error.nonpermanent)
|
||||||
|
|
||||||
assert.EventuallyWithT(t, func(_ *assert.CollectT) {
|
assert.EventuallyWithT(t, func(*assert.CollectT) {
|
||||||
checkIfTestPassed(t, params.NumberOfTestElements, *reqCounter)
|
checkIfTestPassed(t, params.NumberOfTestElements, *reqCounter)
|
||||||
}, 2*time.Second, 100*time.Millisecond)
|
}, 2*time.Second, 100*time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ type mockStorageExtension struct {
|
||||||
getClientError error
|
getClientError error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockStorageExtension) GetClient(_ context.Context, _ component.Kind, _ component.ID, _ string) (storage.Client, error) {
|
func (m *mockStorageExtension) GetClient(context.Context, component.Kind, component.ID, string) (storage.Client, error) {
|
||||||
if m.getClientError != nil {
|
if m.getClientError != nil {
|
||||||
return nil, m.getClientError
|
return nil, m.getClientError
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +52,7 @@ func (m *mockStorageClient) Delete(ctx context.Context, s string) error {
|
||||||
return m.Batch(ctx, storage.DeleteOperation(s))
|
return m.Batch(ctx, storage.DeleteOperation(s))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockStorageClient) Close(_ context.Context) error {
|
func (m *mockStorageClient) Close(context.Context) error {
|
||||||
m.closed.Store(true)
|
m.closed.Store(true)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -120,7 +120,7 @@ func (m *fakeBoundedStorageClient) Delete(ctx context.Context, key string) error
|
||||||
return m.Batch(ctx, storage.DeleteOperation(key))
|
return m.Batch(ctx, storage.DeleteOperation(key))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *fakeBoundedStorageClient) Close(_ context.Context) error {
|
func (m *fakeBoundedStorageClient) Close(context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,11 +221,11 @@ func (m *fakeStorageClientWithErrors) Delete(ctx context.Context, key string) er
|
||||||
return m.Batch(ctx, storage.DeleteOperation(key))
|
return m.Batch(ctx, storage.DeleteOperation(key))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *fakeStorageClientWithErrors) Close(_ context.Context) error {
|
func (m *fakeStorageClientWithErrors) Close(context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *fakeStorageClientWithErrors) Batch(_ context.Context, _ ...storage.Operation) error {
|
func (m *fakeStorageClientWithErrors) Batch(context.Context, ...storage.Operation) error {
|
||||||
m.mux.Lock()
|
m.mux.Lock()
|
||||||
defer m.mux.Unlock()
|
defer m.mux.Unlock()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -410,7 +410,7 @@ func TestPersistentQueue_CorruptedData(t *testing.T) {
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
assert.Equal(t, 3, ps.Size())
|
assert.Equal(t, 3, ps.Size())
|
||||||
require.True(t, ps.Consume(func(_ context.Context, _ tracesRequest) error {
|
require.True(t, ps.Consume(func(context.Context, tracesRequest) error {
|
||||||
return NewShutdownErr(nil)
|
return NewShutdownErr(nil)
|
||||||
}))
|
}))
|
||||||
assert.Equal(t, 2, ps.Size())
|
assert.Equal(t, 2, ps.Size())
|
||||||
|
|
@ -519,7 +519,7 @@ func TestPersistentQueueStartWithNonDispatched(t *testing.T) {
|
||||||
|
|
||||||
// get one item out, but don't mark it as processed
|
// get one item out, but don't mark it as processed
|
||||||
<-ps.putChan
|
<-ps.putChan
|
||||||
require.True(t, ps.Consume(func(_ context.Context, _ tracesRequest) error {
|
require.True(t, ps.Consume(func(context.Context, tracesRequest) error {
|
||||||
// put one more item in
|
// put one more item in
|
||||||
require.NoError(t, ps.Offer(context.Background(), req))
|
require.NoError(t, ps.Offer(context.Background(), req))
|
||||||
require.Equal(t, 5, ps.Size())
|
require.Equal(t, 5, ps.Size())
|
||||||
|
|
@ -625,7 +625,7 @@ func TestItemIndexMarshaling(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
t.Run(fmt.Sprintf("#elements:%v", c.in), func(_ *testing.T) {
|
t.Run(fmt.Sprintf("#elements:%v", c.in), func(*testing.T) {
|
||||||
buf := itemIndexToBytes(c.in)
|
buf := itemIndexToBytes(c.in)
|
||||||
out, err := bytesToItemIndex(buf)
|
out, err := bytesToItemIndex(buf)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
|
||||||
|
|
@ -27,18 +27,18 @@ type MockClient struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start for the MockClient does nothing
|
// Start for the MockClient does nothing
|
||||||
func (m *MockClient) Start(_ context.Context, _ component.Host) error {
|
func (m *MockClient) Start(context.Context, component.Host) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown for the MockClient does nothing
|
// Shutdown for the MockClient does nothing
|
||||||
func (m *MockClient) Shutdown(_ context.Context) error {
|
func (m *MockClient) Shutdown(context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RoundTripper for the MockClient either returns error if the mock authenticator is forced to or
|
// RoundTripper for the MockClient either returns error if the mock authenticator is forced to or
|
||||||
// returns the supplied resultRoundTripper.
|
// returns the supplied resultRoundTripper.
|
||||||
func (m *MockClient) RoundTripper(_ http.RoundTripper) (http.RoundTripper, error) {
|
func (m *MockClient) RoundTripper(http.RoundTripper) (http.RoundTripper, error) {
|
||||||
if m.MustError {
|
if m.MustError {
|
||||||
return nil, errMockError
|
return nil, errMockError
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ func TestNilStartAndShutdown(t *testing.T) {
|
||||||
|
|
||||||
type customRoundTripper struct{}
|
type customRoundTripper struct{}
|
||||||
|
|
||||||
func (c *customRoundTripper) RoundTrip(_ *http.Request) (*http.Response, error) {
|
func (c *customRoundTripper) RoundTrip(*http.Request) (*http.Response, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ func TestClientDefaultValues(t *testing.T) {
|
||||||
|
|
||||||
func TestWithClientStart(t *testing.T) {
|
func TestWithClientStart(t *testing.T) {
|
||||||
called := false
|
called := false
|
||||||
e := NewClient(WithClientStart(func(_ context.Context, _ component.Host) error {
|
e := NewClient(WithClientStart(func(context.Context, component.Host) error {
|
||||||
called = true
|
called = true
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
|
|
@ -60,7 +60,7 @@ func TestWithClientStart(t *testing.T) {
|
||||||
|
|
||||||
func TestWithClientShutdown(t *testing.T) {
|
func TestWithClientShutdown(t *testing.T) {
|
||||||
called := false
|
called := false
|
||||||
e := NewClient(WithClientShutdown(func(_ context.Context) error {
|
e := NewClient(WithClientShutdown(func(context.Context) error {
|
||||||
called = true
|
called = true
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ func TestWithServerAuthenticateFunc(t *testing.T) {
|
||||||
|
|
||||||
func TestWithServerStart(t *testing.T) {
|
func TestWithServerStart(t *testing.T) {
|
||||||
called := false
|
called := false
|
||||||
e := NewServer(WithServerStart(func(_ context.Context, _ component.Host) error {
|
e := NewServer(WithServerStart(func(context.Context, component.Host) error {
|
||||||
called = true
|
called = true
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
|
|
@ -70,7 +70,7 @@ func TestWithServerStart(t *testing.T) {
|
||||||
|
|
||||||
func TestWithServerShutdown(t *testing.T) {
|
func TestWithServerShutdown(t *testing.T) {
|
||||||
called := false
|
called := false
|
||||||
e := NewServer(WithServerShutdown(func(_ context.Context) error {
|
e := NewServer(WithServerShutdown(func(context.Context) error {
|
||||||
called = true
|
called = true
|
||||||
return nil
|
return nil
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ type memoryBallast struct {
|
||||||
getTotalMem func() (uint64, error)
|
getTotalMem func() (uint64, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *memoryBallast) Start(_ context.Context, _ component.Host) error {
|
func (m *memoryBallast) Start(context.Context, component.Host) error {
|
||||||
// absolute value supersedes percentage setting
|
// absolute value supersedes percentage setting
|
||||||
if m.cfg.SizeMiB > 0 {
|
if m.cfg.SizeMiB > 0 {
|
||||||
m.ballastSizeBytes = m.cfg.SizeMiB * megaBytes
|
m.ballastSizeBytes = m.cfg.SizeMiB * megaBytes
|
||||||
|
|
@ -43,7 +43,7 @@ func (m *memoryBallast) Start(_ context.Context, _ component.Host) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *memoryBallast) Shutdown(_ context.Context) error {
|
func (m *memoryBallast) Shutdown(context.Context) error {
|
||||||
m.ballast = nil
|
m.ballast = nil
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ func TestNewFactory(t *testing.T) {
|
||||||
factory := NewFactory(
|
factory := NewFactory(
|
||||||
testType,
|
testType,
|
||||||
func() component.Config { return &defaultCfg },
|
func() component.Config { return &defaultCfg },
|
||||||
func(_ context.Context, _ CreateSettings, _ component.Config) (Extension, error) {
|
func(context.Context, CreateSettings, component.Config) (Extension, error) {
|
||||||
return nopExtensionInstance, nil
|
return nopExtensionInstance, nil
|
||||||
},
|
},
|
||||||
component.StabilityLevelDevelopment)
|
component.StabilityLevelDevelopment)
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ func newZPagesHost() *zpagesHost {
|
||||||
return &zpagesHost{Host: componenttest.NewNopHost()}
|
return &zpagesHost{Host: componenttest.NewNopHost()}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*zpagesHost) RegisterZPages(_ *http.ServeMux, _ string) {}
|
func (*zpagesHost) RegisterZPages(*http.ServeMux, string) {}
|
||||||
|
|
||||||
var _ registerableTracerProvider = (*registerableProvider)(nil)
|
var _ registerableTracerProvider = (*registerableProvider)(nil)
|
||||||
var _ registerableTracerProvider = sdktrace.NewTracerProvider()
|
var _ registerableTracerProvider = sdktrace.NewTracerProvider()
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ func TestGlobalRegistry(t *testing.T) {
|
||||||
func TestRegistry(t *testing.T) {
|
func TestRegistry(t *testing.T) {
|
||||||
r := NewRegistry()
|
r := NewRegistry()
|
||||||
// Expect that no gates to visit.
|
// Expect that no gates to visit.
|
||||||
r.VisitAll(func(_ *Gate) {
|
r.VisitAll(func(*Gate) {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -469,7 +469,7 @@ func newFailureProvider() confmap.Provider {
|
||||||
return &failureProvider{}
|
return &failureProvider{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fmp *failureProvider) Retrieve(_ context.Context, _ string, _ confmap.WatcherFunc) (*confmap.Retrieved, error) {
|
func (fmp *failureProvider) Retrieve(context.Context, string, confmap.WatcherFunc) (*confmap.Retrieved, error) {
|
||||||
return nil, errors.New("a failure occurred during configuration retrieval")
|
return nil, errors.New("a failure occurred during configuration retrieval")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,7 @@ func (sf *sliceField) GenerateSetWithTestValue(ms *messageValueStruct) string {
|
||||||
return sb.String()
|
return sb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sf *sliceField) GenerateCopyToValue(_ *messageValueStruct) string {
|
func (sf *sliceField) GenerateCopyToValue(*messageValueStruct) string {
|
||||||
return "\tms." + sf.fieldName + "().CopyTo(dest." + sf.fieldName + "())"
|
return "\tms." + sf.fieldName + "().CopyTo(dest." + sf.fieldName + "())"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -341,7 +341,7 @@ func (mf *messageValueField) GenerateSetWithTestValue(ms *messageValueStruct) st
|
||||||
return sb.String()
|
return sb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mf *messageValueField) GenerateCopyToValue(_ *messageValueStruct) string {
|
func (mf *messageValueField) GenerateCopyToValue(*messageValueStruct) string {
|
||||||
return "\tms." + mf.fieldName + "().CopyTo(dest." + mf.fieldName + "())"
|
return "\tms." + mf.fieldName + "().CopyTo(dest." + mf.fieldName + "())"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -390,11 +390,11 @@ func (pf *primitiveField) GenerateAccessorsTest(ms *messageValueStruct) string {
|
||||||
return sb.String()
|
return sb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pf *primitiveField) GenerateSetWithTestValue(_ *messageValueStruct) string {
|
func (pf *primitiveField) GenerateSetWithTestValue(*messageValueStruct) string {
|
||||||
return "\ttv.orig." + pf.fieldName + " = " + pf.testVal
|
return "\ttv.orig." + pf.fieldName + " = " + pf.testVal
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pf *primitiveField) GenerateCopyToValue(_ *messageValueStruct) string {
|
func (pf *primitiveField) GenerateCopyToValue(*messageValueStruct) string {
|
||||||
return "\tdest.Set" + pf.fieldName + "(ms." + pf.fieldName + "())"
|
return "\tdest.Set" + pf.fieldName + "(ms." + pf.fieldName + "())"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -448,7 +448,7 @@ func (ptf *primitiveTypedField) GenerateAccessorsTest(ms *messageValueStruct) st
|
||||||
return sb.String()
|
return sb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ptf *primitiveTypedField) GenerateSetWithTestValue(_ *messageValueStruct) string {
|
func (ptf *primitiveTypedField) GenerateSetWithTestValue(*messageValueStruct) string {
|
||||||
originFieldName := ptf.fieldName
|
originFieldName := ptf.fieldName
|
||||||
if ptf.originFieldName != "" {
|
if ptf.originFieldName != "" {
|
||||||
originFieldName = ptf.originFieldName
|
originFieldName = ptf.originFieldName
|
||||||
|
|
@ -456,7 +456,7 @@ func (ptf *primitiveTypedField) GenerateSetWithTestValue(_ *messageValueStruct)
|
||||||
return "\ttv.orig." + originFieldName + " = " + ptf.returnType.testVal
|
return "\ttv.orig." + originFieldName + " = " + ptf.returnType.testVal
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ptf *primitiveTypedField) GenerateCopyToValue(_ *messageValueStruct) string {
|
func (ptf *primitiveTypedField) GenerateCopyToValue(*messageValueStruct) string {
|
||||||
return "\tdest.Set" + ptf.fieldName + "(ms." + ptf.fieldName + "())"
|
return "\tdest.Set" + ptf.fieldName + "(ms." + ptf.fieldName + "())"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -514,11 +514,11 @@ func (psf *primitiveSliceField) GenerateAccessorsTest(ms *messageValueStruct) st
|
||||||
return sb.String()
|
return sb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (psf *primitiveSliceField) GenerateSetWithTestValue(_ *messageValueStruct) string {
|
func (psf *primitiveSliceField) GenerateSetWithTestValue(*messageValueStruct) string {
|
||||||
return "\ttv.orig." + psf.fieldName + " = " + psf.testVal
|
return "\ttv.orig." + psf.fieldName + " = " + psf.testVal
|
||||||
}
|
}
|
||||||
|
|
||||||
func (psf *primitiveSliceField) GenerateCopyToValue(_ *messageValueStruct) string {
|
func (psf *primitiveSliceField) GenerateCopyToValue(*messageValueStruct) string {
|
||||||
return "\tms." + psf.fieldName + "().CopyTo(dest." + psf.fieldName + "())"
|
return "\tms." + psf.fieldName + "().CopyTo(dest." + psf.fieldName + "())"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -777,7 +777,7 @@ func (opv *optionalPrimitiveValue) GenerateSetWithTestValue(ms *messageValueStru
|
||||||
return "\ttv.orig." + opv.fieldName + "_ = &" + ms.originFullName + "_" + opv.fieldName + "{" + opv.fieldName + ":" + opv.testVal + "}"
|
return "\ttv.orig." + opv.fieldName + "_ = &" + ms.originFullName + "_" + opv.fieldName + "{" + opv.fieldName + ":" + opv.testVal + "}"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opv *optionalPrimitiveValue) GenerateCopyToValue(_ *messageValueStruct) string {
|
func (opv *optionalPrimitiveValue) GenerateCopyToValue(*messageValueStruct) string {
|
||||||
return "if ms.Has" + opv.fieldName + "(){\n" +
|
return "if ms.Has" + opv.fieldName + "(){\n" +
|
||||||
"\tdest.Set" + opv.fieldName + "(ms." + opv.fieldName + "())\n" +
|
"\tdest.Set" + opv.fieldName + "(ms." + opv.fieldName + "())\n" +
|
||||||
"}\n"
|
"}\n"
|
||||||
|
|
|
||||||
|
|
@ -350,7 +350,7 @@ func (ss *sliceOfPtrs) templateFields() map[string]any {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ss *sliceOfPtrs) generateInternal(_ *bytes.Buffer) {}
|
func (ss *sliceOfPtrs) generateInternal(*bytes.Buffer) {}
|
||||||
|
|
||||||
var _ baseStruct = (*sliceOfPtrs)(nil)
|
var _ baseStruct = (*sliceOfPtrs)(nil)
|
||||||
|
|
||||||
|
|
@ -402,6 +402,6 @@ func (ss *sliceOfValues) templateFields() map[string]any {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ss *sliceOfValues) generateInternal(_ *bytes.Buffer) {}
|
func (ss *sliceOfValues) generateInternal(*bytes.Buffer) {}
|
||||||
|
|
||||||
var _ baseStruct = (*sliceOfValues)(nil)
|
var _ baseStruct = (*sliceOfValues)(nil)
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ func TestMapReadOnly(t *testing.T) {
|
||||||
assert.Panics(t, func() { m.PutEmptyMap("k2") })
|
assert.Panics(t, func() { m.PutEmptyMap("k2") })
|
||||||
assert.Panics(t, func() { m.PutEmptySlice("k2") })
|
assert.Panics(t, func() { m.PutEmptySlice("k2") })
|
||||||
assert.Panics(t, func() { m.Remove("k1") })
|
assert.Panics(t, func() { m.Remove("k1") })
|
||||||
assert.Panics(t, func() { m.RemoveIf(func(_ string, _ Value) bool { return true }) })
|
assert.Panics(t, func() { m.RemoveIf(func(string, Value) bool { return true }) })
|
||||||
assert.Panics(t, func() { m.EnsureCapacity(2) })
|
assert.Panics(t, func() { m.EnsureCapacity(2) })
|
||||||
|
|
||||||
m2 := NewMap()
|
m2 := NewMap()
|
||||||
|
|
@ -289,7 +289,7 @@ func TestMapWithEmpty(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMapIterationNil(t *testing.T) {
|
func TestMapIterationNil(t *testing.T) {
|
||||||
NewMap().Range(func(_ string, _ Value) bool {
|
NewMap().Range(func(string, Value) bool {
|
||||||
// Fail if any element is returned
|
// Fail if any element is returned
|
||||||
t.Fail()
|
t.Fail()
|
||||||
return true
|
return true
|
||||||
|
|
@ -309,7 +309,7 @@ func TestMap_Range(t *testing.T) {
|
||||||
assert.Equal(t, 5, am.Len())
|
assert.Equal(t, 5, am.Len())
|
||||||
|
|
||||||
calls := 0
|
calls := 0
|
||||||
am.Range(func(_ string, _ Value) bool {
|
am.Range(func(string, Value) bool {
|
||||||
calls++
|
calls++
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
@ -523,7 +523,7 @@ func generateTestBytesMap(t *testing.T) Map {
|
||||||
func TestInvalidMap(t *testing.T) {
|
func TestInvalidMap(t *testing.T) {
|
||||||
v := Map{}
|
v := Map{}
|
||||||
|
|
||||||
testFunc := func(_ string, _ Value) bool {
|
testFunc := func(string, Value) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ func TestSliceReadOnly(t *testing.T) {
|
||||||
assert.Panics(t, func() { es.MoveAndAppendTo(es2) })
|
assert.Panics(t, func() { es.MoveAndAppendTo(es2) })
|
||||||
assert.Panics(t, func() { es2.MoveAndAppendTo(es) })
|
assert.Panics(t, func() { es2.MoveAndAppendTo(es) })
|
||||||
|
|
||||||
assert.Panics(t, func() { es.RemoveIf(func(_ Value) bool { return false }) })
|
assert.Panics(t, func() { es.RemoveIf(func(Value) bool { return false }) })
|
||||||
|
|
||||||
assert.Equal(t, []any{int64(3)}, es.AsRaw())
|
assert.Equal(t, []any{int64(3)}, es.AsRaw())
|
||||||
assert.Panics(t, func() { _ = es.FromRaw([]any{3}) })
|
assert.Panics(t, func() { _ = es.FromRaw([]any{3}) })
|
||||||
|
|
@ -122,7 +122,7 @@ func TestSlice_MoveAndAppendTo(t *testing.T) {
|
||||||
func TestSlice_RemoveIf(t *testing.T) {
|
func TestSlice_RemoveIf(t *testing.T) {
|
||||||
// Test RemoveIf on empty slice
|
// Test RemoveIf on empty slice
|
||||||
emptySlice := NewSlice()
|
emptySlice := NewSlice()
|
||||||
emptySlice.RemoveIf(func(_ Value) bool {
|
emptySlice.RemoveIf(func(Value) bool {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
@ -130,7 +130,7 @@ func TestSlice_RemoveIf(t *testing.T) {
|
||||||
// Test RemoveIf
|
// Test RemoveIf
|
||||||
filtered := Slice(internal.GenerateTestSlice())
|
filtered := Slice(internal.GenerateTestSlice())
|
||||||
pos := 0
|
pos := 0
|
||||||
filtered.RemoveIf(func(_ Value) bool {
|
filtered.RemoveIf(func(Value) bool {
|
||||||
pos++
|
pos++
|
||||||
return pos%3 == 0
|
return pos%3 == 0
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ func (ms Logs) unmarshalJsoniter(iter *jsoniter.Iterator) {
|
||||||
iter.ReadObjectCB(func(iter *jsoniter.Iterator, f string) bool {
|
iter.ReadObjectCB(func(iter *jsoniter.Iterator, f string) bool {
|
||||||
switch f {
|
switch f {
|
||||||
case "resource_logs", "resourceLogs":
|
case "resource_logs", "resourceLogs":
|
||||||
iter.ReadArrayCB(func(_ *jsoniter.Iterator) bool {
|
iter.ReadArrayCB(func(*jsoniter.Iterator) bool {
|
||||||
ms.ResourceLogs().AppendEmpty().unmarshalJsoniter(iter)
|
ms.ResourceLogs().AppendEmpty().unmarshalJsoniter(iter)
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ func (ms Metrics) unmarshalJsoniter(iter *jsoniter.Iterator) {
|
||||||
iter.ReadObjectCB(func(iter *jsoniter.Iterator, f string) bool {
|
iter.ReadObjectCB(func(iter *jsoniter.Iterator, f string) bool {
|
||||||
switch f {
|
switch f {
|
||||||
case "resource_metrics", "resourceMetrics":
|
case "resource_metrics", "resourceMetrics":
|
||||||
iter.ReadArrayCB(func(_ *jsoniter.Iterator) bool {
|
iter.ReadArrayCB(func(*jsoniter.Iterator) bool {
|
||||||
ms.ResourceMetrics().AppendEmpty().unmarshalJsoniter(iter)
|
ms.ResourceMetrics().AppendEmpty().unmarshalJsoniter(iter)
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ func TestSplitLogs_noop(t *testing.T) {
|
||||||
assert.Equal(t, td, split)
|
assert.Equal(t, td, split)
|
||||||
|
|
||||||
i := 0
|
i := 0
|
||||||
td.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().RemoveIf(func(_ plog.LogRecord) bool {
|
td.ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().RemoveIf(func(plog.LogRecord) bool {
|
||||||
i++
|
i++
|
||||||
return i > 5
|
return i > 5
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ func TestSplitMetrics_noop(t *testing.T) {
|
||||||
assert.Equal(t, td, split)
|
assert.Equal(t, td, split)
|
||||||
|
|
||||||
i := 0
|
i := 0
|
||||||
td.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().RemoveIf(func(_ pmetric.Metric) bool {
|
td.ResourceMetrics().At(0).ScopeMetrics().At(0).Metrics().RemoveIf(func(pmetric.Metric) bool {
|
||||||
i++
|
i++
|
||||||
return i > 5
|
return i > 5
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ func TestSplitTraces_noop(t *testing.T) {
|
||||||
assert.Equal(t, td, split)
|
assert.Equal(t, td, split)
|
||||||
|
|
||||||
i := 0
|
i := 0
|
||||||
td.ResourceSpans().At(0).ScopeSpans().At(0).Spans().RemoveIf(func(_ ptrace.Span) bool {
|
td.ResourceSpans().At(0).ScopeSpans().At(0).Spans().RemoveIf(func(ptrace.Span) bool {
|
||||||
i++
|
i++
|
||||||
return i > 5
|
return i > 5
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -60,11 +60,11 @@ type passthroughProcessor struct {
|
||||||
nextTraces consumer.Traces
|
nextTraces consumer.Traces
|
||||||
}
|
}
|
||||||
|
|
||||||
func (passthroughProcessor) Start(_ context.Context, _ component.Host) error {
|
func (passthroughProcessor) Start(context.Context, component.Host) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (passthroughProcessor) Shutdown(_ context.Context) error {
|
func (passthroughProcessor) Shutdown(context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ type unhealthyProcessor struct {
|
||||||
telemetry component.TelemetrySettings
|
telemetry component.TelemetrySettings
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p unhealthyProcessor) Start(_ context.Context, _ component.Host) error {
|
func (p unhealthyProcessor) Start(context.Context, component.Host) error {
|
||||||
go func() {
|
go func() {
|
||||||
p.telemetry.ReportStatus(component.NewStatusEvent(component.StatusRecoverableError))
|
p.telemetry.ReportStatus(component.NewStatusEvent(component.StatusRecoverableError))
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ func CheckConsumeContract(params CheckConsumeContractParams) {
|
||||||
{
|
{
|
||||||
name: "always_succeed",
|
name: "always_succeed",
|
||||||
// Always succeed. We expect all data to be delivered as is.
|
// Always succeed. We expect all data to be delivered as is.
|
||||||
decisionFunc: func(_ idSet) error { return nil },
|
decisionFunc: func(idSet) error { return nil },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "random_non_permanent_error",
|
name: "random_non_permanent_error",
|
||||||
|
|
@ -96,7 +96,7 @@ func CheckConsumeContract(params CheckConsumeContractParams) {
|
||||||
|
|
||||||
for _, scenario := range scenarios {
|
for _, scenario := range scenarios {
|
||||||
params.T.Run(
|
params.T.Run(
|
||||||
scenario.name, func(_ *testing.T) {
|
scenario.name, func(*testing.T) {
|
||||||
checkConsumeContractScenario(params, scenario.decisionFunc)
|
checkConsumeContractScenario(params, scenario.decisionFunc)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
@ -282,7 +282,7 @@ var errPermanent = errors.New("permanent error")
|
||||||
|
|
||||||
// randomNonPermanentErrorConsumeDecision is a decision function that succeeds approximately
|
// randomNonPermanentErrorConsumeDecision is a decision function that succeeds approximately
|
||||||
// half of the time and fails with a non-permanent error the rest of the time.
|
// half of the time and fails with a non-permanent error the rest of the time.
|
||||||
func randomNonPermanentErrorConsumeDecision(_ idSet) error {
|
func randomNonPermanentErrorConsumeDecision(idSet) error {
|
||||||
if rand.Float32() < 0.5 {
|
if rand.Float32() < 0.5 {
|
||||||
return errNonPermanent
|
return errNonPermanent
|
||||||
}
|
}
|
||||||
|
|
@ -291,7 +291,7 @@ func randomNonPermanentErrorConsumeDecision(_ idSet) error {
|
||||||
|
|
||||||
// randomPermanentErrorConsumeDecision is a decision function that succeeds approximately
|
// randomPermanentErrorConsumeDecision is a decision function that succeeds approximately
|
||||||
// half of the time and fails with a permanent error the rest of the time.
|
// half of the time and fails with a permanent error the rest of the time.
|
||||||
func randomPermanentErrorConsumeDecision(_ idSet) error {
|
func randomPermanentErrorConsumeDecision(idSet) error {
|
||||||
if rand.Float32() < 0.5 {
|
if rand.Float32() < 0.5 {
|
||||||
return consumererror.NewPermanent(errPermanent)
|
return consumererror.NewPermanent(errPermanent)
|
||||||
}
|
}
|
||||||
|
|
@ -301,7 +301,7 @@ func randomPermanentErrorConsumeDecision(_ idSet) error {
|
||||||
// randomErrorsConsumeDecision is a decision function that succeeds approximately
|
// randomErrorsConsumeDecision is a decision function that succeeds approximately
|
||||||
// a third of the time, fails with a permanent error the third of the time and fails with
|
// a third of the time, fails with a permanent error the third of the time and fails with
|
||||||
// a non-permanent error the rest of the time.
|
// a non-permanent error the rest of the time.
|
||||||
func randomErrorsConsumeDecision(_ idSet) error {
|
func randomErrorsConsumeDecision(idSet) error {
|
||||||
r := rand.Float64()
|
r := rand.Float64()
|
||||||
third := 1.0 / 3.0
|
third := 1.0 / 3.0
|
||||||
if r < third {
|
if r < third {
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,11 @@ type exampleReceiver struct {
|
||||||
nextConsumer consumer.Logs
|
nextConsumer consumer.Logs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *exampleReceiver) Start(_ context.Context, _ component.Host) error {
|
func (s *exampleReceiver) Start(context.Context, component.Host) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *exampleReceiver) Shutdown(_ context.Context) error {
|
func (s *exampleReceiver) Shutdown(context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ type testScrapeMetrics struct {
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ts *testScrapeMetrics) scrape(_ context.Context) (pmetric.Metrics, error) {
|
func (ts *testScrapeMetrics) scrape(context.Context) (pmetric.Metrics, error) {
|
||||||
ts.timesScrapeCalled++
|
ts.timesScrapeCalled++
|
||||||
ts.ch <- ts.timesScrapeCalled
|
ts.ch <- ts.timesScrapeCalled
|
||||||
|
|
||||||
|
|
@ -415,7 +415,7 @@ func TestScrapeControllerInitialDelay(t *testing.T) {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
scp, err := NewScraper("timed", func(_ context.Context) (pmetric.Metrics, error) {
|
scp, err := NewScraper("timed", func(context.Context) (pmetric.Metrics, error) {
|
||||||
elapsed <- time.Now()
|
elapsed <- time.Now()
|
||||||
return pmetric.NewMetrics(), nil
|
return pmetric.NewMetrics(), nil
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -299,15 +299,15 @@ type configWatcherExtension struct {
|
||||||
fn func() error
|
fn func() error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (comp *configWatcherExtension) Start(_ context.Context, _ component.Host) error {
|
func (comp *configWatcherExtension) Start(context.Context, component.Host) error {
|
||||||
return comp.fn()
|
return comp.fn()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (comp *configWatcherExtension) Shutdown(_ context.Context) error {
|
func (comp *configWatcherExtension) Shutdown(context.Context) error {
|
||||||
return comp.fn()
|
return comp.fn()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (comp *configWatcherExtension) NotifyConfig(_ context.Context, _ *confmap.Conf) error {
|
func (comp *configWatcherExtension) NotifyConfig(context.Context, *confmap.Conf) error {
|
||||||
return comp.fn()
|
return comp.fn()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -326,7 +326,7 @@ func newConfigWatcherExtensionFactory(name component.Type, fn func() error) exte
|
||||||
func() component.Config {
|
func() component.Config {
|
||||||
return &struct{}{}
|
return &struct{}{}
|
||||||
},
|
},
|
||||||
func(_ context.Context, _ extension.CreateSettings, _ component.Config) (extension.Extension, error) {
|
func(context.Context, extension.CreateSettings, component.Config) (extension.Extension, error) {
|
||||||
return newConfigWatcherExtension(fn), nil
|
return newConfigWatcherExtension(fn), nil
|
||||||
},
|
},
|
||||||
component.StabilityLevelDevelopment,
|
component.StabilityLevelDevelopment,
|
||||||
|
|
@ -339,7 +339,7 @@ func newBadExtensionFactory() extension.Factory {
|
||||||
func() component.Config {
|
func() component.Config {
|
||||||
return &struct{}{}
|
return &struct{}{}
|
||||||
},
|
},
|
||||||
func(_ context.Context, _ extension.CreateSettings, _ component.Config) (extension.Extension, error) {
|
func(context.Context, extension.CreateSettings, component.Config) (extension.Extension, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
},
|
},
|
||||||
component.StabilityLevelDevelopment,
|
component.StabilityLevelDevelopment,
|
||||||
|
|
@ -352,7 +352,7 @@ func newCreateErrorExtensionFactory() extension.Factory {
|
||||||
func() component.Config {
|
func() component.Config {
|
||||||
return &struct{}{}
|
return &struct{}{}
|
||||||
},
|
},
|
||||||
func(_ context.Context, _ extension.CreateSettings, _ component.Config) (extension.Extension, error) {
|
func(context.Context, extension.CreateSettings, component.Config) (extension.Extension, error) {
|
||||||
return nil, errors.New("cannot create \"err\" extension type")
|
return nil, errors.New("cannot create \"err\" extension type")
|
||||||
},
|
},
|
||||||
component.StabilityLevelDevelopment,
|
component.StabilityLevelDevelopment,
|
||||||
|
|
@ -455,11 +455,11 @@ type statusTestExtension struct {
|
||||||
shutdownErr error
|
shutdownErr error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ext *statusTestExtension) Start(_ context.Context, _ component.Host) error {
|
func (ext *statusTestExtension) Start(context.Context, component.Host) error {
|
||||||
return ext.startErr
|
return ext.startErr
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ext *statusTestExtension) Shutdown(_ context.Context) error {
|
func (ext *statusTestExtension) Shutdown(context.Context) error {
|
||||||
return ext.shutdownErr
|
return ext.shutdownErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -476,7 +476,7 @@ func newStatusTestExtensionFactory(name component.Type, startErr, shutdownErr er
|
||||||
func() component.Config {
|
func() component.Config {
|
||||||
return &struct{}{}
|
return &struct{}{}
|
||||||
},
|
},
|
||||||
func(_ context.Context, _ extension.CreateSettings, _ component.Config) (extension.Extension, error) {
|
func(context.Context, extension.CreateSettings, component.Config) (extension.Extension, error) {
|
||||||
return newStatusTestExtension(startErr, shutdownErr), nil
|
return newStatusTestExtension(startErr, shutdownErr), nil
|
||||||
},
|
},
|
||||||
component.StabilityLevelDevelopment,
|
component.StabilityLevelDevelopment,
|
||||||
|
|
@ -529,6 +529,6 @@ func (ext *recordingExtension) Start(_ context.Context, host component.Host) err
|
||||||
return ext.startCallback(ext.createSettings, host)
|
return ext.startCallback(ext.createSettings, host)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ext *recordingExtension) Shutdown(_ context.Context) error {
|
func (ext *recordingExtension) Shutdown(context.Context) error {
|
||||||
return ext.shutdownCallback(ext.createSettings)
|
return ext.shutdownCallback(ext.createSettings)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2337,7 +2337,7 @@ func TestStatusReportedOnStartupShutdown(t *testing.T) {
|
||||||
actualStatuses := make(map[*component.InstanceID][]*component.StatusEvent)
|
actualStatuses := make(map[*component.InstanceID][]*component.StatusEvent)
|
||||||
rep := status.NewReporter(func(id *component.InstanceID, ev *component.StatusEvent) {
|
rep := status.NewReporter(func(id *component.InstanceID, ev *component.StatusEvent) {
|
||||||
actualStatuses[id] = append(actualStatuses[id], ev)
|
actualStatuses[id] = append(actualStatuses[id], ev)
|
||||||
}, func(_ error) {
|
}, func(error) {
|
||||||
})
|
})
|
||||||
|
|
||||||
pg.telemetry.Status = rep
|
pg.telemetry.Status = rep
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,6 @@ func NewNopTelemetrySettings() TelemetrySettings {
|
||||||
MeterProvider: noopmetric.NewMeterProvider(),
|
MeterProvider: noopmetric.NewMeterProvider(),
|
||||||
MetricsLevel: configtelemetry.LevelNone,
|
MetricsLevel: configtelemetry.LevelNone,
|
||||||
Resource: pcommon.NewResource(),
|
Resource: pcommon.NewResource(),
|
||||||
Status: status.NewReporter(func(*component.InstanceID, *component.StatusEvent) {}, func(_ error) {}),
|
Status: status.NewReporter(func(*component.InstanceID, *component.StatusEvent) {}, func(error) {}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,7 @@ func TestStatusFuncs(t *testing.T) {
|
||||||
func TestStatusFuncsConcurrent(t *testing.T) {
|
func TestStatusFuncsConcurrent(t *testing.T) {
|
||||||
ids := []*component.InstanceID{{}, {}, {}, {}}
|
ids := []*component.InstanceID{{}, {}, {}, {}}
|
||||||
count := 0
|
count := 0
|
||||||
statusFunc := func(_ *component.InstanceID, _ *component.StatusEvent) {
|
statusFunc := func(*component.InstanceID, *component.StatusEvent) {
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
rep := NewReporter(statusFunc,
|
rep := NewReporter(statusFunc,
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,12 @@ func (cs *componentState) Stopped() bool {
|
||||||
return cs.stopped
|
return cs.stopped
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *componentState) Start(_ context.Context, _ component.Host) error {
|
func (cs *componentState) Start(context.Context, component.Host) error {
|
||||||
cs.started = true
|
cs.started = true
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs *componentState) Shutdown(_ context.Context) error {
|
func (cs *componentState) Shutdown(context.Context) error {
|
||||||
cs.stopped = true
|
cs.stopped = true
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,7 @@ func TestServiceTelemetry(t *testing.T) {
|
||||||
func testCollectorStartHelper(t *testing.T, tc ownMetricsTestCase) {
|
func testCollectorStartHelper(t *testing.T, tc ownMetricsTestCase) {
|
||||||
var once sync.Once
|
var once sync.Once
|
||||||
loggingHookCalled := false
|
loggingHookCalled := false
|
||||||
hook := func(_ zapcore.Entry) error {
|
hook := func(zapcore.Entry) error {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
loggingHookCalled = true
|
loggingHookCalled = true
|
||||||
})
|
})
|
||||||
|
|
@ -581,15 +581,15 @@ func newNopConfigPipelineConfigs(pipelineCfgs pipelines.Config) Config {
|
||||||
|
|
||||||
type configWatcherExtension struct{}
|
type configWatcherExtension struct{}
|
||||||
|
|
||||||
func (comp *configWatcherExtension) Start(_ context.Context, _ component.Host) error {
|
func (comp *configWatcherExtension) Start(context.Context, component.Host) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (comp *configWatcherExtension) Shutdown(_ context.Context) error {
|
func (comp *configWatcherExtension) Shutdown(context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (comp *configWatcherExtension) NotifyConfig(_ context.Context, _ *confmap.Conf) error {
|
func (comp *configWatcherExtension) NotifyConfig(context.Context, *confmap.Conf) error {
|
||||||
return errors.New("Failed to resolve config")
|
return errors.New("Failed to resolve config")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -599,7 +599,7 @@ func newConfigWatcherExtensionFactory(name component.Type) extension.Factory {
|
||||||
func() component.Config {
|
func() component.Config {
|
||||||
return &struct{}{}
|
return &struct{}{}
|
||||||
},
|
},
|
||||||
func(_ context.Context, _ extension.CreateSettings, _ component.Config) (extension.Extension, error) {
|
func(context.Context, extension.CreateSettings, component.Config) (extension.Extension, error) {
|
||||||
return &configWatcherExtension{}, nil
|
return &configWatcherExtension{}, nil
|
||||||
},
|
},
|
||||||
component.StabilityLevelDevelopment,
|
component.StabilityLevelDevelopment,
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import (
|
||||||
|
|
||||||
type recordSampler struct{}
|
type recordSampler struct{}
|
||||||
|
|
||||||
func (r recordSampler) ShouldSample(_ sdktrace.SamplingParameters) sdktrace.SamplingResult {
|
func (r recordSampler) ShouldSample(sdktrace.SamplingParameters) sdktrace.SamplingResult {
|
||||||
return sdktrace.SamplingResult{Decision: sdktrace.RecordOnly}
|
return sdktrace.SamplingResult{Decision: sdktrace.RecordOnly}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue