From a81681c74b37f312fdd7e7454a1224cb6a6f5ac0 Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Thu, 5 Dec 2024 20:01:48 +0000 Subject: [PATCH 01/12] Add framework for libhoney receiver --- receiver/libhoneyreceiver/Makefile | 2 + receiver/libhoneyreceiver/README.md | 67 +++++++ receiver/libhoneyreceiver/config.go | 93 ++++++++++ receiver/libhoneyreceiver/doc.go | 6 + receiver/libhoneyreceiver/factory.go | 110 +++++++++++ .../generated_component_test.go | 76 ++++++++ .../generated_package_test.go | 12 ++ receiver/libhoneyreceiver/go.mod | 76 ++++++++ receiver/libhoneyreceiver/go.sum | 174 ++++++++++++++++++ .../internal/metadata/generated_status.go | 17 ++ .../sharedcomponent/sharedcomponent.go | 170 +++++++++++++++++ receiver/libhoneyreceiver/libhoney.go | 124 +++++++++++++ receiver/libhoneyreceiver/metadata.yaml | 8 + 13 files changed, 935 insertions(+) create mode 100644 receiver/libhoneyreceiver/Makefile create mode 100644 receiver/libhoneyreceiver/README.md create mode 100644 receiver/libhoneyreceiver/config.go create mode 100644 receiver/libhoneyreceiver/doc.go create mode 100644 receiver/libhoneyreceiver/factory.go create mode 100644 receiver/libhoneyreceiver/generated_component_test.go create mode 100644 receiver/libhoneyreceiver/generated_package_test.go create mode 100644 receiver/libhoneyreceiver/go.mod create mode 100644 receiver/libhoneyreceiver/go.sum create mode 100644 receiver/libhoneyreceiver/internal/metadata/generated_status.go create mode 100644 receiver/libhoneyreceiver/internal/sharedcomponent/sharedcomponent.go create mode 100644 receiver/libhoneyreceiver/libhoney.go create mode 100644 receiver/libhoneyreceiver/metadata.yaml diff --git a/receiver/libhoneyreceiver/Makefile b/receiver/libhoneyreceiver/Makefile new file mode 100644 index 000000000000..84677bc7e9cb --- /dev/null +++ b/receiver/libhoneyreceiver/Makefile @@ -0,0 +1,2 @@ +include ../../Makefile.Common + diff --git a/receiver/libhoneyreceiver/README.md b/receiver/libhoneyreceiver/README.md new file mode 100644 index 000000000000..a0821b13e9a1 --- /dev/null +++ b/receiver/libhoneyreceiver/README.md @@ -0,0 +1,67 @@ +# Libhoney Receiver + +### The purpose and use-cases of the new component + +The Libhoney receiver will accept data for either Trace or Logs signals that are emitted from applications that were instrumented using Libhoney libraries. + + +## Configuration + +The configuration has 2 parts, One is the HTTP receiver configuration and the rest is about mapping attributes from the freeform libhoney format into the more structured OpenTelemetry objects. + +### Example configuration for the component + +The following settings are required: + +- `http` + - `endpoint` must set an endpoint. Defaults to `127.0.0.1:8080` +- `resources`: if the `service.name` field is different, map it here. +- `scopes`: to get the `library.name` and `library.version` set in the scope section, set them here. +- `attributes`: if the other trace-related data have different keys, map them here, defautls are otlp-like field names. + +The following setting is required for refinery traffic since: + +- `auth_api`: should be set to `https://api.honeycomb.io` or a proxy that forwards to that host. + Some libhoney software checks `/1/auth` to get environment names so it needs to be passed through. + + +```yaml + libhoney: + http: + endpoint: 0.0.0.0:8088 + traces_url_paths: + - "/1/events" + - "/1/batch" + include_metadata: true + auth_api: https://api.honeycomb.io + resources: + service_name: service_name + scopes: + library_name: library.name + library_version: library.version + attributes: + trace_id: trace_id + parent_id: parent_id + span_id: span_id + name: name + error: error + spankind: span.kind + durationFields: + - duration_ms +``` + +### Telemetry data types supported + +It will subscribe to the Traces and Logs signals but accept traffic destined for either pipeline using one http receiver component. Libhoney does not differentiate between the two so the receiver will identify which pipeline to deliver the spans or log records to. + +No support for metrics since they'd look just like logs. + +### Code Owner(s) + +Tyler Helmuth, Mike Terhar + +### Sponsor (optional) + +Tyler Helmuth + +### Additional context \ No newline at end of file diff --git a/receiver/libhoneyreceiver/config.go b/receiver/libhoneyreceiver/config.go new file mode 100644 index 000000000000..9c39b5f86c85 --- /dev/null +++ b/receiver/libhoneyreceiver/config.go @@ -0,0 +1,93 @@ +package libhoneyreceiver + +import ( + "errors" + "fmt" + "net/url" + "path" + + "go.opentelemetry.io/collector/config/confighttp" + "go.opentelemetry.io/collector/confmap" +) + +// Config represents the receiver config settings within the collector's config.yaml +type Config struct { + HTTP *HTTPConfig `mapstructure:"http"` + AuthApi string `mapstructure:"auth_api"` + Wrapper string `mapstructure:"wrapper"` + Resources ResourcesConfig `mapstructure:"resources"` + Scopes ScopesConfig `mapstructure:"scopes"` + Attributes AttributesConfig `mapstructure:"attributes"` +} + +type HTTPConfig struct { + *confighttp.ServerConfig `mapstructure:",squash"` + + // The URL path to receive traces on. If omitted "/" will be used. + TracesURLPaths []string `mapstructure:"traces_url_paths,omitempty"` +} + +type ResourcesConfig struct { + ServiceName string `mapstructure:"service_name"` +} + +type ScopesConfig struct { + LibraryName string `mapstructure:"library_name"` + LibraryVersion string `mapstructure:"library_version"` +} + +type AttributesConfig struct { + TraceId string `mapstructure:"trace_id"` + ParentId string `mapstructure:"parent_id"` + SpanId string `mapstructure:"span_id"` + Name string `mapstructure:"name"` + Error string `mapstructure:"error"` + SpanKind string `mapstructure:"spankind"` + DurationFields []string `mapstructure:"durationFields"` +} + +func (cfg *Config) Validate() error { + if cfg.HTTP == nil { + return errors.New("must specify at least one protocol when using the arbitrary JSON receiver") + } + return nil +} + +func (cfg *Config) Unmarshal(conf *confmap.Conf) error { + // first load the config normally + err := conf.Unmarshal(cfg) + if err != nil { + return err + } + + if !conf.IsSet("http") { + cfg.HTTP = nil + } else { + var err error + + for idx := range cfg.HTTP.TracesURLPaths { + if cfg.HTTP.TracesURLPaths[idx], err = sanitizeURLPath(cfg.HTTP.TracesURLPaths[idx]); err != nil { + return err + } + } + } + if cleanUrl, err := url.Parse(cfg.AuthApi); err != nil { + cfg.AuthApi = cleanUrl.String() + } else { + return err + } + + return nil +} + +func sanitizeURLPath(urlPath string) (string, error) { + u, err := url.Parse(urlPath) + if err != nil { + return "", fmt.Errorf("invalid HTTP URL path set for signal: %w", err) + } + + if !path.IsAbs(u.Path) { + u.Path = "/" + u.Path + } + return u.Path, nil +} diff --git a/receiver/libhoneyreceiver/doc.go b/receiver/libhoneyreceiver/doc.go new file mode 100644 index 000000000000..087590c1a4da --- /dev/null +++ b/receiver/libhoneyreceiver/doc.go @@ -0,0 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:generate mdatagen metadata.yaml + +package libhoneyreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver" diff --git a/receiver/libhoneyreceiver/factory.go b/receiver/libhoneyreceiver/factory.go new file mode 100644 index 000000000000..367a9e03cd5d --- /dev/null +++ b/receiver/libhoneyreceiver/factory.go @@ -0,0 +1,110 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package libhoneyreceiver // import "go.opentelemetry.io/collector/receiver/otlpreceiver" + +import ( + "context" + "fmt" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/config/confighttp" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/receiver" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver/internal/metadata" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver/internal/sharedcomponent" +) + +const ( + httpPort = 8080 +) + +var defaultTracesURLPaths = []string{"/events", "/event", "/batch"} + +// NewFactory creates a new OTLP receiver factory. +func NewFactory() receiver.Factory { + return receiver.NewFactory( + metadata.Type, + createDefaultConfig, + receiver.WithTraces(createTraces, metadata.TracesStability), + receiver.WithLogs(createLogs, metadata.LogsStability), + ) +} + +// createDefaultConfig creates the default configuration for receiver. +func createDefaultConfig() component.Config { + durationFieldsArr := []string{"duration_ms"} + endpointStr := fmt.Sprintf("localhost:%d", httpPort) + return &Config{ + HTTP: &HTTPConfig{ + ServerConfig: &confighttp.ServerConfig{ + Endpoint: endpointStr, + }, + TracesURLPaths: defaultTracesURLPaths, + }, + AuthApi: "", + Resources: ResourcesConfig{ + ServiceName: "service.name", + }, + Scopes: ScopesConfig{ + LibraryName: "library.name", + LibraryVersion: "library.version", + }, + Attributes: AttributesConfig{ + TraceId: "trace.trace_id", + SpanId: "trace.span_id", + ParentId: "trace.parent_id", + Name: "name", + Error: "error", + SpanKind: "span.kind", + DurationFields: durationFieldsArr, + }, + } +} + +func createLogs( + _ context.Context, + set receiver.Settings, + cfg component.Config, + nextConsumer consumer.Logs, +) (receiver.Logs, error) { + oCfg := cfg.(*Config) + r, err := receivers.LoadOrStore( + oCfg, + func() (*libhoneyReceiver, error) { + return newLibhoneyReceiver(oCfg, &set) + }, + ) + if err != nil { + return nil, err + } + + r.Unwrap().registerLogConsumer(nextConsumer) + return r, nil +} + +// createTraces creates a trace receiver based on provided config. +func createTraces( + _ context.Context, + set receiver.Settings, + cfg component.Config, + nextConsumer consumer.Traces, +) (receiver.Traces, error) { + oCfg := cfg.(*Config) + r, err := receivers.LoadOrStore( + oCfg, + func() (*libhoneyReceiver, error) { + return newLibhoneyReceiver(oCfg, &set) + }, + ) + if err != nil { + return nil, err + } + + r.Unwrap().registerTraceConsumer(nextConsumer) + return r, nil +} + +// Used the same pattern as the OTLP receiver. Requires sharedcomponent.go from core collector repo +var receivers = sharedcomponent.NewMap[*Config, *libhoneyReceiver]() diff --git a/receiver/libhoneyreceiver/generated_component_test.go b/receiver/libhoneyreceiver/generated_component_test.go new file mode 100644 index 000000000000..f220dbec36b7 --- /dev/null +++ b/receiver/libhoneyreceiver/generated_component_test.go @@ -0,0 +1,76 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package libhoneyreceiver + +import ( + "context" + "testing" + + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/confmap/confmaptest" + "go.opentelemetry.io/collector/consumer/consumertest" + "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/receiver/receivertest" +) + +func TestComponentFactoryType(t *testing.T) { + require.Equal(t, "libhoney", NewFactory().Type().String()) +} + +func TestComponentConfigStruct(t *testing.T) { + require.NoError(t, componenttest.CheckConfigStruct(NewFactory().CreateDefaultConfig())) +} + +func TestComponentLifecycle(t *testing.T) { + factory := NewFactory() + + tests := []struct { + name string + createFn func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) + }{ + + { + name: "logs", + createFn: func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) { + return factory.CreateLogs(ctx, set, cfg, consumertest.NewNop()) + }, + }, + + { + name: "traces", + createFn: func(ctx context.Context, set receiver.Settings, cfg component.Config) (component.Component, error) { + return factory.CreateTraces(ctx, set, cfg, consumertest.NewNop()) + }, + }, + } + + cm, err := confmaptest.LoadConf("metadata.yaml") + require.NoError(t, err) + cfg := factory.CreateDefaultConfig() + sub, err := cm.Sub("tests::config") + require.NoError(t, err) + require.NoError(t, sub.Unmarshal(&cfg)) + + for _, tt := range tests { + t.Run(tt.name+"-shutdown", func(t *testing.T) { + c, err := tt.createFn(context.Background(), receivertest.NewNopSettings(), cfg) + require.NoError(t, err) + err = c.Shutdown(context.Background()) + require.NoError(t, err) + }) + t.Run(tt.name+"-lifecycle", func(t *testing.T) { + firstRcvr, err := tt.createFn(context.Background(), receivertest.NewNopSettings(), cfg) + require.NoError(t, err) + host := componenttest.NewNopHost() + require.NoError(t, err) + require.NoError(t, firstRcvr.Start(context.Background(), host)) + require.NoError(t, firstRcvr.Shutdown(context.Background())) + secondRcvr, err := tt.createFn(context.Background(), receivertest.NewNopSettings(), cfg) + require.NoError(t, err) + require.NoError(t, secondRcvr.Start(context.Background(), host)) + require.NoError(t, secondRcvr.Shutdown(context.Background())) + }) + } +} diff --git a/receiver/libhoneyreceiver/generated_package_test.go b/receiver/libhoneyreceiver/generated_package_test.go new file mode 100644 index 000000000000..32eb7ac89562 --- /dev/null +++ b/receiver/libhoneyreceiver/generated_package_test.go @@ -0,0 +1,12 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package libhoneyreceiver + +import ( + "go.uber.org/goleak" + "testing" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/receiver/libhoneyreceiver/go.mod b/receiver/libhoneyreceiver/go.mod new file mode 100644 index 000000000000..57104b46820e --- /dev/null +++ b/receiver/libhoneyreceiver/go.mod @@ -0,0 +1,76 @@ +module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver + +go 1.22.0 + +require ( + github.com/stretchr/testify v1.10.0 + go.opentelemetry.io/collector/component/componenttest v0.115.0 + go.opentelemetry.io/collector/config/confighttp v0.115.0 + go.opentelemetry.io/collector/confmap v1.21.0 + go.opentelemetry.io/collector/consumer v1.21.0 + go.opentelemetry.io/collector/consumer/consumertest v0.115.0 + go.opentelemetry.io/collector/receiver/receivertest v0.115.0 + go.uber.org/goleak v1.3.0 +) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/pierrec/lz4/v4 v4.1.21 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/collector/client v1.21.0 // indirect + go.opentelemetry.io/collector/consumer/consumererror v0.115.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.0 // indirect + go.opentelemetry.io/collector/pdata v1.21.0 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.115.0 // indirect + go.opentelemetry.io/collector/pipeline v0.115.0 // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.115.0 // indirect + go.opentelemetry.io/otel v1.32.0 // indirect + go.opentelemetry.io/otel/sdk v1.32.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect + go.opentelemetry.io/otel/trace v1.32.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect + google.golang.org/grpc v1.67.1 // indirect +) + +require ( + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/fsnotify/fsnotify v1.8.0 // indirect + github.com/go-logr/logr v1.4.2 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-viper/mapstructure/v2 v2.2.1 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.17.11 // indirect + github.com/knadh/koanf/maps v0.1.1 // indirect + github.com/knadh/koanf/providers/confmap v0.1.0 // indirect + github.com/knadh/koanf/v2 v2.1.2 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/rs/cors v1.11.1 // indirect + go.opentelemetry.io/collector/component v0.115.0 + go.opentelemetry.io/collector/component/componentstatus v0.115.0 + go.opentelemetry.io/collector/config/configauth v0.115.0 // indirect + go.opentelemetry.io/collector/config/configcompression v1.21.0 // indirect + go.opentelemetry.io/collector/config/configopaque v1.21.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.115.0 // indirect + go.opentelemetry.io/collector/config/configtls v1.21.0 // indirect + go.opentelemetry.io/collector/config/internal v0.115.0 // indirect + go.opentelemetry.io/collector/extension v0.115.0 // indirect + go.opentelemetry.io/collector/extension/auth v0.115.0 // indirect + go.opentelemetry.io/collector/receiver v0.115.0 + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect + go.opentelemetry.io/otel/metric v1.32.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.27.0 + golang.org/x/net v0.31.0 // indirect + golang.org/x/sys v0.27.0 // indirect + golang.org/x/text v0.20.0 // indirect + google.golang.org/protobuf v1.35.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + +replace google.golang.org/genproto => google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 diff --git a/receiver/libhoneyreceiver/go.sum b/receiver/libhoneyreceiver/go.sum new file mode 100644 index 000000000000..5df325fbcd3d --- /dev/null +++ b/receiver/libhoneyreceiver/go.sum @@ -0,0 +1,174 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= +github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= +github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= +github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs= +github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI= +github.com/knadh/koanf/providers/confmap v0.1.0 h1:gOkxhHkemwG4LezxxN8DMOFopOPghxRVp7JbIvdvqzU= +github.com/knadh/koanf/providers/confmap v0.1.0/go.mod h1:2uLhxQzJnyHKfxG927awZC7+fyHFdQkd697K4MdLnIU= +github.com/knadh/koanf/v2 v2.1.2 h1:I2rtLRqXRy1p01m/utEtpZSSA6dcJbgGVuE27kW2PzQ= +github.com/knadh/koanf/v2 v2.1.2/go.mod h1:Gphfaen0q1Fc1HTgJgSTC4oRX9R2R5ErYMZJy8fLJBo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= +github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/collector/client v1.21.0 h1:3Kes8lOFMYVxoxeAmX+DTEAkuS1iTA3NkSfqzGmygJA= +go.opentelemetry.io/collector/client v1.21.0/go.mod h1:jYJGiL0UA975OOyHmjbQSokNWt1OiviI5KjPOMUMGwc= +go.opentelemetry.io/collector/component v0.115.0 h1:iLte1oCiXzjiCnaOBKdsXacfFiECecpWxW3/LeriMoo= +go.opentelemetry.io/collector/component v0.115.0/go.mod h1:oIUFiH7w1eOimdeYhFI+gAIxYSiLDocKVJ0PTvX7d6s= +go.opentelemetry.io/collector/component/componentstatus v0.115.0 h1:pbpUIL+uKDfEiSgKK+S5nuSL6MDIIQYsp4b65ZGVb9M= +go.opentelemetry.io/collector/component/componentstatus v0.115.0/go.mod h1:36A+9XSiOz0Cdhq+UwwPRlEr5CYuSkEnVO9om4BH7d0= +go.opentelemetry.io/collector/component/componenttest v0.115.0 h1:9URDJ9VyP6tuij+YHjp/kSSMecnZOd7oGvzu+rw9SJY= +go.opentelemetry.io/collector/component/componenttest v0.115.0/go.mod h1:PzXvNqKLCiSADZGZFKH+IOHMkaQ0GTHuzysfVbTPKYY= +go.opentelemetry.io/collector/config/configauth v0.115.0 h1:xa+ALdyPgva3rZnLBh1H2oS5MsHP6JxSqMtQmcELnys= +go.opentelemetry.io/collector/config/configauth v0.115.0/go.mod h1:C7anpb3Rf4KswMT+dgOzkW9UX0z/65PLORpUw3p0VYc= +go.opentelemetry.io/collector/config/configcompression v1.21.0 h1:0zbPdZAgPFMAarwJEC4gaR6f/JBP686A3TYSgb3oa+E= +go.opentelemetry.io/collector/config/configcompression v1.21.0/go.mod h1:LvYG00tbPTv0NOLoZN0wXq1F5thcxvukO8INq7xyfWU= +go.opentelemetry.io/collector/config/confighttp v0.115.0 h1:BIy394oNXnqySJwrCqgAJu4gWgAV5aQUDD6k1hy6C8o= +go.opentelemetry.io/collector/config/confighttp v0.115.0/go.mod h1:Wr50ut12NmCEAl4bWLJryw2EjUmJTtYRg89560Q51wc= +go.opentelemetry.io/collector/config/configopaque v1.21.0 h1:PcvRGkBk4Px8BQM7tX+kw4i3jBsfAHGoGQbtZg6Ox7U= +go.opentelemetry.io/collector/config/configopaque v1.21.0/go.mod h1:sW0t0iI/VfRL9VYX7Ik6XzVgPcR+Y5kejTLsYcMyDWs= +go.opentelemetry.io/collector/config/configtelemetry v0.115.0 h1:U07FinCDop+r2RjWQ3aP9ZWONC7r7kQIp1GkXQi6nsI= +go.opentelemetry.io/collector/config/configtelemetry v0.115.0/go.mod h1:SlBEwQg0qly75rXZ6W1Ig8jN25KBVBkFIIAUI1GiAAE= +go.opentelemetry.io/collector/config/configtls v1.21.0 h1:ZfrlAYgBD8lzp04W0GxwiDmUbrvKsvDYJi+wkyiXlpA= +go.opentelemetry.io/collector/config/configtls v1.21.0/go.mod h1:5EsNefPfVCMOTlOrr3wyj7LrsOgY7V8iqRl8oFZEqtw= +go.opentelemetry.io/collector/config/internal v0.115.0 h1:eVk57iufZpUXyPJFKTb1Ebx5tmcCyroIlt427r5pxS8= +go.opentelemetry.io/collector/config/internal v0.115.0/go.mod h1:OVkadRWlKAoWjHslqjWtBLAne8ceQm8WYT71ZcBWLFc= +go.opentelemetry.io/collector/confmap v1.21.0 h1:1tIcx2/Suwg8VhuPmQw87ba0ludPmumpFCFRZZa6RXA= +go.opentelemetry.io/collector/confmap v1.21.0/go.mod h1:Rrhs+MWoaP6AswZp+ReQ2VO9dfOfcUjdjiSHBsG+nec= +go.opentelemetry.io/collector/consumer v1.21.0 h1:THKZ2Vbi6GkamjTBI2hFq5Dc4kINZTWGwQNa8d/Ty9g= +go.opentelemetry.io/collector/consumer v1.21.0/go.mod h1:FQcC4ThMtRYY41dv+IPNK8POLLhAFY3r1YR5fuP7iiY= +go.opentelemetry.io/collector/consumer/consumererror v0.115.0 h1:yli//xBCQMPZKXNgNlXemo4dvqhnFrAmCZ11DvQgmcY= +go.opentelemetry.io/collector/consumer/consumererror v0.115.0/go.mod h1:LwVzAvQ6ZVNG7mbOvurbAo+W/rKws0IcjOwriuZXqPE= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.0 h1:H3fDuyQW1t2HWHkz96WMBQJKUevypOCjBqnqtaAWyoA= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.0/go.mod h1:IzEmZ91Tp7TBxVDq8Cc9xvLsmO7H08njr6Pu9P5d9ns= +go.opentelemetry.io/collector/consumer/consumertest v0.115.0 h1:hru0I2447y0TluCdwlKYFFtgcpyCnlM+LiOK1JZyA70= +go.opentelemetry.io/collector/consumer/consumertest v0.115.0/go.mod h1:ybjALRJWR6aKNOzEMy1T1ruCULVDEjj4omtOJMrH/kU= +go.opentelemetry.io/collector/extension v0.115.0 h1:/cBb8AUdD0KMWC6V3lvCC16eP9Fg0wd1Upcp5rgvuGI= +go.opentelemetry.io/collector/extension v0.115.0/go.mod h1:HI7Ak6loyi6ZrZPsQJW1OO1wbaAW8OqXLFNQlTZnreQ= +go.opentelemetry.io/collector/extension/auth v0.115.0 h1:TTMokbBsSHZRFH48PvGSJmgSS8F3Rkr9MWGHZn8eJDk= +go.opentelemetry.io/collector/extension/auth v0.115.0/go.mod h1:3w+2mzeb2OYNOO4Bi41TUo4jr32ap2y7AOq64IDpxQo= +go.opentelemetry.io/collector/extension/auth/authtest v0.115.0 h1:OZe7dKbZ01qodSpZU0ZYzI6zpmmzJ3UvfdBSFAbSgDw= +go.opentelemetry.io/collector/extension/auth/authtest v0.115.0/go.mod h1:fk9WCXP0x91Q64Z8HZKWTHh9PWtgoWE1KXe3n2Bff3U= +go.opentelemetry.io/collector/pdata v1.21.0 h1:PG+UbiFMJ35X/WcAR7Rf/PWmWtRdW0aHlOidsR6c5MA= +go.opentelemetry.io/collector/pdata v1.21.0/go.mod h1:GKb1/zocKJMvxKbS+sl0W85lxhYBTFJ6h6I1tphVyDU= +go.opentelemetry.io/collector/pdata/pprofile v0.115.0 h1:NI89hy13vNDw7EOnQf7Jtitks4HJFO0SUWznTssmP94= +go.opentelemetry.io/collector/pdata/pprofile v0.115.0/go.mod h1:jGzdNfO0XTtfLjXCL/uCC1livg1LlfR+ix2WE/z3RpQ= +go.opentelemetry.io/collector/pdata/testdata v0.115.0 h1:Rblz+AKXdo3fG626jS+KSd0OSA4uMXcTQfpwed6P8LI= +go.opentelemetry.io/collector/pdata/testdata v0.115.0/go.mod h1:inNnRt6S2Nn260EfCBEcjesjlKOSsr0jPwkPqpBkt4s= +go.opentelemetry.io/collector/pipeline v0.115.0 h1:bmACBqb0e8U9ag+vGGHUP7kCfAO7HHROdtzIEg8ulus= +go.opentelemetry.io/collector/pipeline v0.115.0/go.mod h1:qE3DmoB05AW0C3lmPvdxZqd/H4po84NPzd5MrqgtL74= +go.opentelemetry.io/collector/receiver v0.115.0 h1:55Q3Jvj6zHCIA1psKqi/3kEMJO4OqUF5tNAEYNdB1U8= +go.opentelemetry.io/collector/receiver v0.115.0/go.mod h1:nBSCh2O/WUcfgpJ+Jpz+B0z0Hn5jHeRvF2WmLij5EIY= +go.opentelemetry.io/collector/receiver/receiverprofiles v0.115.0 h1:R9JLaj2Al93smIPUkbJshAkb/cY0H5JBOxIx+Zu0NG4= +go.opentelemetry.io/collector/receiver/receiverprofiles v0.115.0/go.mod h1:05E5hGujWeeXJmzKZwTdHyZ/+rRyrQlQB5p5Q2XY39M= +go.opentelemetry.io/collector/receiver/receivertest v0.115.0 h1:OiB684SbHQi6/Pd3ZH0cXjYvCpBS9ilQBfTQx0wVXHg= +go.opentelemetry.io/collector/receiver/receivertest v0.115.0/go.mod h1:Y8Z9U/bz9Xpyt8GI8DxZZgryw3mnnIw+AeKVLTD2cP8= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= +go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= +go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= +go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= +go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= +go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4= +go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU= +go.opentelemetry.io/otel/sdk/metric v1.32.0 h1:rZvFnvmvawYb0alrYkjraqJq0Z4ZUJAiyYCU9snn1CU= +go.opentelemetry.io/otel/sdk/metric v1.32.0/go.mod h1:PWeZlq0zt9YkYAp3gjKZ0eicRYvOh1Gd+X99x6GHpCQ= +go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= +go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= +golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= +google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= +google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/receiver/libhoneyreceiver/internal/metadata/generated_status.go b/receiver/libhoneyreceiver/internal/metadata/generated_status.go new file mode 100644 index 000000000000..ef6ead1f4954 --- /dev/null +++ b/receiver/libhoneyreceiver/internal/metadata/generated_status.go @@ -0,0 +1,17 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package metadata + +import ( + "go.opentelemetry.io/collector/component" +) + +var ( + Type = component.MustNewType("libhoney") + ScopeName = "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver" +) + +const ( + TracesStability = component.StabilityLevelDevelopment + LogsStability = component.StabilityLevelDevelopment +) diff --git a/receiver/libhoneyreceiver/internal/sharedcomponent/sharedcomponent.go b/receiver/libhoneyreceiver/internal/sharedcomponent/sharedcomponent.go new file mode 100644 index 000000000000..147dec1ed3f7 --- /dev/null +++ b/receiver/libhoneyreceiver/internal/sharedcomponent/sharedcomponent.go @@ -0,0 +1,170 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package sharedcomponent exposes functionality for components +// to register against a shared key, such as a configuration object, in order to be reused across signal types. +// This is particularly useful when the component relies on a shared resource such as os.File or http.Server. +package sharedcomponent // import "go.opentelemetry.io/collector/internal/sharedcomponent" + +import ( + "context" + "slices" + "sync" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" +) + +func NewMap[K comparable, V component.Component]() *Map[K, V] { + return &Map[K, V]{ + components: map[K]*Component[V]{}, + } +} + +// Map keeps reference of all created instances for a given shared key such as a component configuration. +type Map[K comparable, V component.Component] struct { + lock sync.Mutex + components map[K]*Component[V] +} + +// LoadOrStore returns the already created instance if exists, otherwise creates a new instance +// and adds it to the map of references. +func (m *Map[K, V]) LoadOrStore(key K, create func() (V, error)) (*Component[V], error) { + m.lock.Lock() + defer m.lock.Unlock() + if c, ok := m.components[key]; ok { + return c, nil + } + comp, err := create() + if err != nil { + return nil, err + } + + newComp := &Component[V]{ + component: comp, + removeFunc: func() { + m.lock.Lock() + defer m.lock.Unlock() + delete(m.components, key) + }, + } + m.components[key] = newComp + return newComp, nil +} + +// Component ensures that the wrapped component is started and stopped only once. +// When stopped it is removed from the Map. +type Component[V component.Component] struct { + component V + + startOnce sync.Once + stopOnce sync.Once + removeFunc func() + + hostWrapper *hostWrapper +} + +// Unwrap returns the original component. +func (c *Component[V]) Unwrap() V { + return c.component +} + +// Start starts the underlying component if it never started before. +func (c *Component[V]) Start(ctx context.Context, host component.Host) error { + if c.hostWrapper == nil { + var err error + c.startOnce.Do(func() { + c.hostWrapper = &hostWrapper{ + host: host, + sources: make([]componentstatus.Reporter, 0), + previousEvents: make([]*componentstatus.Event, 0), + } + statusReporter, isStatusReporter := host.(componentstatus.Reporter) + if isStatusReporter { + c.hostWrapper.addSource(statusReporter) + } + + // It's important that status for a shared component is reported through its + // telemetry settings to keep status in sync and avoid race conditions. This logic duplicates + // and takes priority over the automated status reporting that happens in graph, making the + // status reporting in graph a no-op. + c.hostWrapper.Report(componentstatus.NewEvent(componentstatus.StatusStarting)) + if err = c.component.Start(ctx, c.hostWrapper); err != nil { + c.hostWrapper.Report(componentstatus.NewPermanentErrorEvent(err)) + } + }) + return err + } + statusReporter, isStatusReporter := host.(componentstatus.Reporter) + if isStatusReporter { + c.hostWrapper.addSource(statusReporter) + } + return nil +} + +var ( + _ component.Host = (*hostWrapper)(nil) + _ componentstatus.Reporter = (*hostWrapper)(nil) +) + +type hostWrapper struct { + host component.Host + sources []componentstatus.Reporter + previousEvents []*componentstatus.Event + lock sync.Mutex +} + +func (h *hostWrapper) GetExtensions() map[component.ID]component.Component { + return h.host.GetExtensions() +} + +func (h *hostWrapper) Report(e *componentstatus.Event) { + // Only remember an event if it will be emitted and it has not been sent already. + h.lock.Lock() + if len(h.sources) > 0 && !slices.Contains(h.previousEvents, e) { + h.previousEvents = append(h.previousEvents, e) + } + h.lock.Unlock() + + h.lock.Lock() + for _, s := range h.sources { + s.Report(e) + } + h.lock.Unlock() +} + +func (h *hostWrapper) addSource(s componentstatus.Reporter) { + h.lock.Lock() + for _, e := range h.previousEvents { + s.Report(e) + } + h.lock.Unlock() + + h.lock.Lock() + h.sources = append(h.sources, s) + h.lock.Unlock() +} + +// Shutdown shuts down the underlying component. +func (c *Component[V]) Shutdown(ctx context.Context) error { + var err error + c.stopOnce.Do(func() { + // It's important that status for a shared component is reported through its + // telemetry settings to keep status in sync and avoid race conditions. This logic duplicates + // and takes priority over the automated status reporting that happens in graph, making the + // status reporting in graph a no-op. + if c.hostWrapper != nil { + c.hostWrapper.Report(componentstatus.NewEvent(componentstatus.StatusStopping)) + } + err = c.component.Shutdown(ctx) + if c.hostWrapper != nil { + if err != nil { + c.hostWrapper.Report(componentstatus.NewPermanentErrorEvent(err)) + } else { + c.hostWrapper.Report(componentstatus.NewEvent(componentstatus.StatusStopped)) + } + } + c.removeFunc() + }) + return err +} diff --git a/receiver/libhoneyreceiver/libhoney.go b/receiver/libhoneyreceiver/libhoney.go new file mode 100644 index 000000000000..a844867a210e --- /dev/null +++ b/receiver/libhoneyreceiver/libhoney.go @@ -0,0 +1,124 @@ +package libhoneyreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver + +import ( + "context" + "errors" + "net" + "net/http" + "sync" + + "go.uber.org/zap" + + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" + "go.opentelemetry.io/collector/consumer" + "go.opentelemetry.io/collector/receiver" + "go.opentelemetry.io/collector/receiver/receiverhelper" +) + +type libhoneyReceiver struct { + cfg *Config + serverHTTP *http.Server + + nextTraces consumer.Traces + nextLogs consumer.Logs + shutdownWG sync.WaitGroup + + obsrepHTTP *receiverhelper.ObsReport + + settings *receiver.Settings +} + +type TeamInfo struct { + Slug string `json:"slug"` +} + +type EnvironmentInfo struct { + Slug string `json:"slug"` + Name string `json:"name"` +} + +type AuthInfo struct { + APIKeyAccess map[string]bool `json:"api_key_access"` + Team TeamInfo `json:"team"` + Environment EnvironmentInfo `json:"environment"` +} + +func newLibhoneyReceiver(cfg *Config, set *receiver.Settings) (*libhoneyReceiver, error) { + r := &libhoneyReceiver{ + cfg: cfg, + nextTraces: nil, + settings: set, + } + + var err error + r.obsrepHTTP, err = receiverhelper.NewObsReport(receiverhelper.ObsReportSettings{ + ReceiverID: set.ID, + Transport: "http", + ReceiverCreateSettings: *set, + }) + if err != nil { + return nil, err + } + + return r, nil +} + +func (r *libhoneyReceiver) startHTTPServer(ctx context.Context, host component.Host) error { + // If HTTP is not enabled, nothing to start. + if r.cfg.HTTP == nil { + return nil + } + + if r.nextTraces != nil { + // initialize routes + } else { + r.settings.Logger.Debug("r.nextTraces is nil for some reason") + } + + // start server + var err error + r.settings.Logger.Info("Starting HTTP server", zap.String("endpoint", r.cfg.HTTP.ServerConfig.Endpoint)) + var hln net.Listener + if hln, err = r.cfg.HTTP.ServerConfig.ToListener(ctx); err != nil { + return err + } + + r.shutdownWG.Add(1) + go func() { + defer r.shutdownWG.Done() + + if errHTTP := r.serverHTTP.Serve(hln); errHTTP != nil && !errors.Is(errHTTP, http.ErrServerClosed) { + componentstatus.ReportStatus(host, componentstatus.NewFatalErrorEvent(errHTTP)) + } + }() + return nil +} + +func (r *libhoneyReceiver) Start(ctx context.Context, host component.Host) error { + if err := r.startHTTPServer(ctx, host); err != nil { + return errors.Join(err, r.Shutdown(ctx)) + } + + return nil +} + +// Shutdown is a method to turn off receiving. +func (r *libhoneyReceiver) Shutdown(ctx context.Context) error { + var err error + + if r.serverHTTP != nil { + err = r.serverHTTP.Shutdown(ctx) + } + + r.shutdownWG.Wait() + return err +} + +func (r *libhoneyReceiver) registerTraceConsumer(tc consumer.Traces) { + r.nextTraces = tc +} + +func (r *libhoneyReceiver) registerLogConsumer(tc consumer.Logs) { + r.nextLogs = tc +} diff --git a/receiver/libhoneyreceiver/metadata.yaml b/receiver/libhoneyreceiver/metadata.yaml new file mode 100644 index 000000000000..18710f4b2a5e --- /dev/null +++ b/receiver/libhoneyreceiver/metadata.yaml @@ -0,0 +1,8 @@ +type: libhoney + +status: + class: receiver + stability: + development: [traces, logs] + codeowners: + active: [TylerHelmuth] \ No newline at end of file From f2a79ffcb5e10e8ff7047563504e5d91e6c52da3 Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Thu, 5 Dec 2024 20:10:09 +0000 Subject: [PATCH 02/12] Update github templates --- .chloggen/initial_libhoneyreceiver.yaml | 27 +++++++++++++++++++ .github/CODEOWNERS | 1 + .github/ISSUE_TEMPLATE/bug_report.yaml | 1 + .github/ISSUE_TEMPLATE/feature_request.yaml | 1 + .github/ISSUE_TEMPLATE/other.yaml | 1 + .github/ISSUE_TEMPLATE/unmaintained.yaml | 1 + receiver/libhoneyreceiver/README.md | 10 +++++++ .../generated_package_test.go | 3 ++- versions.yaml | 1 + 9 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 .chloggen/initial_libhoneyreceiver.yaml diff --git a/.chloggen/initial_libhoneyreceiver.yaml b/.chloggen/initial_libhoneyreceiver.yaml new file mode 100644 index 000000000000..39e8630f8cb8 --- /dev/null +++ b/.chloggen/initial_libhoneyreceiver.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: new_component + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: libhoneyreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Introduce the scaffolding of a new component, libhoneyreceiver + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [36693] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0fd8ec11925d..e389d43597af 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -244,6 +244,7 @@ receiver/k8sobjectsreceiver/ @open-telemetry/collector-cont receiver/kafkametricsreceiver/ @open-telemetry/collector-contrib-approvers @dmitryax receiver/kafkareceiver/ @open-telemetry/collector-contrib-approvers @pavolloffay @MovieStoreGuy receiver/kubeletstatsreceiver/ @open-telemetry/collector-contrib-approvers @dmitryax @TylerHelmuth @ChrsMark +receiver/libhoneyreceiver/ @open-telemetry/collector-contrib-approvers @TylerHelmuth receiver/lokireceiver/ @open-telemetry/collector-contrib-approvers @mar4uk receiver/memcachedreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski receiver/mongodbatlasreceiver/ @open-telemetry/collector-contrib-approvers @schmikei diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 40374a31674d..ea469c572bcb 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -241,6 +241,7 @@ body: - receiver/kafka - receiver/kafkametrics - receiver/kubeletstats + - receiver/libhoney - receiver/loki - receiver/memcached - receiver/mongodb diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index aeee888ecb63..99f72f1c13b1 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -235,6 +235,7 @@ body: - receiver/kafka - receiver/kafkametrics - receiver/kubeletstats + - receiver/libhoney - receiver/loki - receiver/memcached - receiver/mongodb diff --git a/.github/ISSUE_TEMPLATE/other.yaml b/.github/ISSUE_TEMPLATE/other.yaml index 30152c26e1a0..c65b1b3fa089 100644 --- a/.github/ISSUE_TEMPLATE/other.yaml +++ b/.github/ISSUE_TEMPLATE/other.yaml @@ -235,6 +235,7 @@ body: - receiver/kafka - receiver/kafkametrics - receiver/kubeletstats + - receiver/libhoney - receiver/loki - receiver/memcached - receiver/mongodb diff --git a/.github/ISSUE_TEMPLATE/unmaintained.yaml b/.github/ISSUE_TEMPLATE/unmaintained.yaml index ab44912d5fe3..a6402ed0e246 100644 --- a/.github/ISSUE_TEMPLATE/unmaintained.yaml +++ b/.github/ISSUE_TEMPLATE/unmaintained.yaml @@ -240,6 +240,7 @@ body: - receiver/kafka - receiver/kafkametrics - receiver/kubeletstats + - receiver/libhoney - receiver/loki - receiver/memcached - receiver/mongodb diff --git a/receiver/libhoneyreceiver/README.md b/receiver/libhoneyreceiver/README.md index a0821b13e9a1..5adeefd7e6a2 100644 --- a/receiver/libhoneyreceiver/README.md +++ b/receiver/libhoneyreceiver/README.md @@ -1,4 +1,14 @@ # Libhoney Receiver + +| Status | | +| ------------- |-----------| +| Stability | [development]: traces, logs | +| Distributions | [] | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Areceiver%2Flibhoney%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Areceiver%2Flibhoney) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Areceiver%2Flibhoney%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Areceiver%2Flibhoney) | +| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@TylerHelmuth](https://www.github.com/TylerHelmuth) | + +[development]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#development + ### The purpose and use-cases of the new component diff --git a/receiver/libhoneyreceiver/generated_package_test.go b/receiver/libhoneyreceiver/generated_package_test.go index 32eb7ac89562..03bb3911aeb1 100644 --- a/receiver/libhoneyreceiver/generated_package_test.go +++ b/receiver/libhoneyreceiver/generated_package_test.go @@ -3,8 +3,9 @@ package libhoneyreceiver import ( - "go.uber.org/goleak" "testing" + + "go.uber.org/goleak" ) func TestMain(m *testing.M) { diff --git a/versions.yaml b/versions.yaml index 243ca7358e6a..2603a69b8fdd 100644 --- a/versions.yaml +++ b/versions.yaml @@ -238,6 +238,7 @@ module-sets: - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkametricsreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kafkareceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/kubeletstatsreceiver + - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/lokireceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/memcachedreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mongodbatlasreceiver From 7504ab7c0966078cf536ea920b56e8df842ec8bf Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Fri, 6 Dec 2024 15:36:22 +0000 Subject: [PATCH 03/12] fix variable names --- receiver/libhoneyreceiver/README.md | 2 +- receiver/libhoneyreceiver/config.go | 17 ++++++++++------- receiver/libhoneyreceiver/factory.go | 2 +- .../internal/sharedcomponent/sharedcomponent.go | 2 +- receiver/libhoneyreceiver/libhoney.go | 6 +++++- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/receiver/libhoneyreceiver/README.md b/receiver/libhoneyreceiver/README.md index 5adeefd7e6a2..c94d4604a290 100644 --- a/receiver/libhoneyreceiver/README.md +++ b/receiver/libhoneyreceiver/README.md @@ -27,7 +27,7 @@ The following settings are required: - `endpoint` must set an endpoint. Defaults to `127.0.0.1:8080` - `resources`: if the `service.name` field is different, map it here. - `scopes`: to get the `library.name` and `library.version` set in the scope section, set them here. -- `attributes`: if the other trace-related data have different keys, map them here, defautls are otlp-like field names. +- `attributes`: if the other trace-related data have different keys, map them here, defaults are otlp-like field names. The following setting is required for refinery traffic since: diff --git a/receiver/libhoneyreceiver/config.go b/receiver/libhoneyreceiver/config.go index 9c39b5f86c85..abfd6476dbd1 100644 --- a/receiver/libhoneyreceiver/config.go +++ b/receiver/libhoneyreceiver/config.go @@ -1,4 +1,7 @@ -package libhoneyreceiver +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package libhoneyreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver" import ( "errors" @@ -13,7 +16,7 @@ import ( // Config represents the receiver config settings within the collector's config.yaml type Config struct { HTTP *HTTPConfig `mapstructure:"http"` - AuthApi string `mapstructure:"auth_api"` + AuthAPI string `mapstructure:"auth_api"` Wrapper string `mapstructure:"wrapper"` Resources ResourcesConfig `mapstructure:"resources"` Scopes ScopesConfig `mapstructure:"scopes"` @@ -37,9 +40,9 @@ type ScopesConfig struct { } type AttributesConfig struct { - TraceId string `mapstructure:"trace_id"` - ParentId string `mapstructure:"parent_id"` - SpanId string `mapstructure:"span_id"` + TraceID string `mapstructure:"trace_id"` + ParentID string `mapstructure:"parent_id"` + SpanID string `mapstructure:"span_id"` Name string `mapstructure:"name"` Error string `mapstructure:"error"` SpanKind string `mapstructure:"spankind"` @@ -71,8 +74,8 @@ func (cfg *Config) Unmarshal(conf *confmap.Conf) error { } } } - if cleanUrl, err := url.Parse(cfg.AuthApi); err != nil { - cfg.AuthApi = cleanUrl.String() + if cleanURL, err := url.Parse(cfg.AuthAPI); err != nil { + cfg.AuthAPI = cleanURL.String() } else { return err } diff --git a/receiver/libhoneyreceiver/factory.go b/receiver/libhoneyreceiver/factory.go index 367a9e03cd5d..03171a7bf696 100644 --- a/receiver/libhoneyreceiver/factory.go +++ b/receiver/libhoneyreceiver/factory.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package libhoneyreceiver // import "go.opentelemetry.io/collector/receiver/otlpreceiver" +package libhoneyreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver" import ( "context" diff --git a/receiver/libhoneyreceiver/internal/sharedcomponent/sharedcomponent.go b/receiver/libhoneyreceiver/internal/sharedcomponent/sharedcomponent.go index 147dec1ed3f7..e4dbbfe27c2e 100644 --- a/receiver/libhoneyreceiver/internal/sharedcomponent/sharedcomponent.go +++ b/receiver/libhoneyreceiver/internal/sharedcomponent/sharedcomponent.go @@ -4,7 +4,7 @@ // Package sharedcomponent exposes functionality for components // to register against a shared key, such as a configuration object, in order to be reused across signal types. // This is particularly useful when the component relies on a shared resource such as os.File or http.Server. -package sharedcomponent // import "go.opentelemetry.io/collector/internal/sharedcomponent" +package sharedcomponent // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver/internal/sharedcomponent" import ( "context" diff --git a/receiver/libhoneyreceiver/libhoney.go b/receiver/libhoneyreceiver/libhoney.go index a844867a210e..77a69aba04a3 100644 --- a/receiver/libhoneyreceiver/libhoney.go +++ b/receiver/libhoneyreceiver/libhoney.go @@ -1,4 +1,7 @@ -package libhoneyreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package libhoneyreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver" import ( "context" @@ -72,6 +75,7 @@ func (r *libhoneyReceiver) startHTTPServer(ctx context.Context, host component.H if r.nextTraces != nil { // initialize routes + r.settings.Logger.Debug("r.nextTraces found and ready to go") } else { r.settings.Logger.Debug("r.nextTraces is nil for some reason") } From 0815394116d786b7c47a997d8b14c92c0373b7a0 Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Fri, 6 Dec 2024 17:25:24 +0000 Subject: [PATCH 04/12] change variable names for linter --- receiver/libhoneyreceiver/factory.go | 8 ++++---- receiver/libhoneyreceiver/libhoney.go | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/receiver/libhoneyreceiver/factory.go b/receiver/libhoneyreceiver/factory.go index 03171a7bf696..5667fc4c96de 100644 --- a/receiver/libhoneyreceiver/factory.go +++ b/receiver/libhoneyreceiver/factory.go @@ -43,7 +43,7 @@ func createDefaultConfig() component.Config { }, TracesURLPaths: defaultTracesURLPaths, }, - AuthApi: "", + AuthAPI: "", Resources: ResourcesConfig{ ServiceName: "service.name", }, @@ -52,9 +52,9 @@ func createDefaultConfig() component.Config { LibraryVersion: "library.version", }, Attributes: AttributesConfig{ - TraceId: "trace.trace_id", - SpanId: "trace.span_id", - ParentId: "trace.parent_id", + TraceID: "trace.trace_id", + SpanID: "trace.span_id", + ParentID: "trace.parent_id", Name: "name", Error: "error", SpanKind: "span.kind", diff --git a/receiver/libhoneyreceiver/libhoney.go b/receiver/libhoneyreceiver/libhoney.go index 77a69aba04a3..4ad1faab8fbb 100644 --- a/receiver/libhoneyreceiver/libhoney.go +++ b/receiver/libhoneyreceiver/libhoney.go @@ -10,13 +10,12 @@ import ( "net/http" "sync" - "go.uber.org/zap" - "go.opentelemetry.io/collector/component" "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" "go.opentelemetry.io/collector/receiver/receiverhelper" + "go.uber.org/zap" ) type libhoneyReceiver struct { From 78f21aa7cc0cecf80c325f07c6e5bcf125d8ab39 Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Mon, 9 Dec 2024 18:02:24 +0000 Subject: [PATCH 05/12] do codeboten's suggestions --- receiver/libhoneyreceiver/README.md | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/receiver/libhoneyreceiver/README.md b/receiver/libhoneyreceiver/README.md index c94d4604a290..a87c8735d5d0 100644 --- a/receiver/libhoneyreceiver/README.md +++ b/receiver/libhoneyreceiver/README.md @@ -12,12 +12,13 @@ ### The purpose and use-cases of the new component -The Libhoney receiver will accept data for either Trace or Logs signals that are emitted from applications that were instrumented using Libhoney libraries. - +The Libhoney receiver will accept data for either Trace or Logs signals that are emitted from applications that were +instrumented using [Libhoney](https://docs.honeycomb.io/send-data/logs/structured/libhoney/) libraries. ## Configuration -The configuration has 2 parts, One is the HTTP receiver configuration and the rest is about mapping attributes from the freeform libhoney format into the more structured OpenTelemetry objects. +The configuration has 2 parts, One is the HTTP receiver configuration and the rest is about mapping attributes from the +freeform libhoney format into the more structured OpenTelemetry objects. ### Example configuration for the component @@ -62,16 +63,8 @@ The following setting is required for refinery traffic since: ### Telemetry data types supported -It will subscribe to the Traces and Logs signals but accept traffic destined for either pipeline using one http receiver component. Libhoney does not differentiate between the two so the receiver will identify which pipeline to deliver the spans or log records to. +It will subscribe to the Traces and Logs signals but accept traffic destined for either pipeline using one http receiver +component. Libhoney doesnot differentiate between the two so the receiver will identify which pipeline to deliver the +spans or log records to. No support for metrics since they'd look just like logs. - -### Code Owner(s) - -Tyler Helmuth, Mike Terhar - -### Sponsor (optional) - -Tyler Helmuth - -### Additional context \ No newline at end of file From 47073118047d8fa0931e63b77784082166b3afb7 Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Tue, 10 Dec 2024 18:29:39 +0000 Subject: [PATCH 06/12] update go.mod to newer version --- receiver/libhoneyreceiver/go.mod | 40 ++++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/receiver/libhoneyreceiver/go.mod b/receiver/libhoneyreceiver/go.mod index 57104b46820e..f1d22eb56a0e 100644 --- a/receiver/libhoneyreceiver/go.mod +++ b/receiver/libhoneyreceiver/go.mod @@ -5,10 +5,10 @@ go 1.22.0 require ( github.com/stretchr/testify v1.10.0 go.opentelemetry.io/collector/component/componenttest v0.115.0 - go.opentelemetry.io/collector/config/confighttp v0.115.0 - go.opentelemetry.io/collector/confmap v1.21.0 - go.opentelemetry.io/collector/consumer v1.21.0 - go.opentelemetry.io/collector/consumer/consumertest v0.115.0 + go.opentelemetry.io/collector/config/confighttp v0.115.1-0.20241206185113-3f3e208e71b8 + go.opentelemetry.io/collector/confmap v1.21.1-0.20241206185113-3f3e208e71b8 + go.opentelemetry.io/collector/consumer v1.21.1-0.20241206185113-3f3e208e71b8 + go.opentelemetry.io/collector/consumer/consumertest v0.115.1-0.20241206185113-3f3e208e71b8 go.opentelemetry.io/collector/receiver/receivertest v0.115.0 go.uber.org/goleak v1.3.0 ) @@ -19,13 +19,13 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/client v1.21.0 // indirect + go.opentelemetry.io/collector/client v1.21.1-0.20241206185113-3f3e208e71b8 // indirect go.opentelemetry.io/collector/consumer/consumererror v0.115.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.0 // indirect - go.opentelemetry.io/collector/pdata v1.21.0 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.115.0 // indirect - go.opentelemetry.io/collector/pipeline v0.115.0 // indirect - go.opentelemetry.io/collector/receiver/receiverprofiles v0.115.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.1-0.20241206185113-3f3e208e71b8 // indirect + go.opentelemetry.io/collector/pdata v1.21.1-0.20241206185113-3f3e208e71b8 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.115.1-0.20241206185113-3f3e208e71b8 // indirect + go.opentelemetry.io/collector/pipeline v0.115.1-0.20241206185113-3f3e208e71b8 // indirect + go.opentelemetry.io/collector/receiver/receiverprofiles v0.115.1-0.20241206185113-3f3e208e71b8 // indirect go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/sdk v1.32.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect @@ -51,17 +51,17 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/rs/cors v1.11.1 // indirect - go.opentelemetry.io/collector/component v0.115.0 - go.opentelemetry.io/collector/component/componentstatus v0.115.0 - go.opentelemetry.io/collector/config/configauth v0.115.0 // indirect - go.opentelemetry.io/collector/config/configcompression v1.21.0 // indirect - go.opentelemetry.io/collector/config/configopaque v1.21.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.115.0 // indirect - go.opentelemetry.io/collector/config/configtls v1.21.0 // indirect + go.opentelemetry.io/collector/component v0.115.1-0.20241206185113-3f3e208e71b8 + go.opentelemetry.io/collector/component/componentstatus v0.115.1-0.20241206185113-3f3e208e71b8 + go.opentelemetry.io/collector/config/configauth v0.115.1-0.20241206185113-3f3e208e71b8 // indirect + go.opentelemetry.io/collector/config/configcompression v1.21.1-0.20241206185113-3f3e208e71b8 // indirect + go.opentelemetry.io/collector/config/configopaque v1.21.1-0.20241206185113-3f3e208e71b8 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.115.1-0.20241206185113-3f3e208e71b8 // indirect + go.opentelemetry.io/collector/config/configtls v1.21.1-0.20241206185113-3f3e208e71b8 // indirect go.opentelemetry.io/collector/config/internal v0.115.0 // indirect - go.opentelemetry.io/collector/extension v0.115.0 // indirect - go.opentelemetry.io/collector/extension/auth v0.115.0 // indirect - go.opentelemetry.io/collector/receiver v0.115.0 + go.opentelemetry.io/collector/extension v0.115.1-0.20241206185113-3f3e208e71b8 // indirect + go.opentelemetry.io/collector/extension/auth v0.115.1-0.20241206185113-3f3e208e71b8 // indirect + go.opentelemetry.io/collector/receiver v0.115.1-0.20241206185113-3f3e208e71b8 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect go.opentelemetry.io/otel/metric v1.32.0 // indirect go.uber.org/multierr v1.11.0 // indirect From a6a404a07512e755583c27e476b7cc28d5fa172f Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Tue, 10 Dec 2024 18:38:33 +0000 Subject: [PATCH 07/12] update go.sum --- receiver/libhoneyreceiver/go.sum | 80 ++++++++++++++++---------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/receiver/libhoneyreceiver/go.sum b/receiver/libhoneyreceiver/go.sum index 5df325fbcd3d..38355f537008 100644 --- a/receiver/libhoneyreceiver/go.sum +++ b/receiver/libhoneyreceiver/go.sum @@ -60,56 +60,56 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opentelemetry.io/collector/client v1.21.0 h1:3Kes8lOFMYVxoxeAmX+DTEAkuS1iTA3NkSfqzGmygJA= -go.opentelemetry.io/collector/client v1.21.0/go.mod h1:jYJGiL0UA975OOyHmjbQSokNWt1OiviI5KjPOMUMGwc= -go.opentelemetry.io/collector/component v0.115.0 h1:iLte1oCiXzjiCnaOBKdsXacfFiECecpWxW3/LeriMoo= -go.opentelemetry.io/collector/component v0.115.0/go.mod h1:oIUFiH7w1eOimdeYhFI+gAIxYSiLDocKVJ0PTvX7d6s= -go.opentelemetry.io/collector/component/componentstatus v0.115.0 h1:pbpUIL+uKDfEiSgKK+S5nuSL6MDIIQYsp4b65ZGVb9M= -go.opentelemetry.io/collector/component/componentstatus v0.115.0/go.mod h1:36A+9XSiOz0Cdhq+UwwPRlEr5CYuSkEnVO9om4BH7d0= +go.opentelemetry.io/collector/client v1.21.1-0.20241206185113-3f3e208e71b8 h1:VfdixIcglr5IZhu6ogj8/uEMnf9Oi798V0td47/9jHg= +go.opentelemetry.io/collector/client v1.21.1-0.20241206185113-3f3e208e71b8/go.mod h1:jYJGiL0UA975OOyHmjbQSokNWt1OiviI5KjPOMUMGwc= +go.opentelemetry.io/collector/component v0.115.1-0.20241206185113-3f3e208e71b8 h1:PtCINrFFDFi6aJRv8toOvLoKzu4qtz389PVcFlP7ydE= +go.opentelemetry.io/collector/component v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:oIUFiH7w1eOimdeYhFI+gAIxYSiLDocKVJ0PTvX7d6s= +go.opentelemetry.io/collector/component/componentstatus v0.115.1-0.20241206185113-3f3e208e71b8 h1:DD5ahJ8YNJ32hxGU4RSw5Y3EVuZg/IZr5YtykvkfSo8= +go.opentelemetry.io/collector/component/componentstatus v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:36A+9XSiOz0Cdhq+UwwPRlEr5CYuSkEnVO9om4BH7d0= go.opentelemetry.io/collector/component/componenttest v0.115.0 h1:9URDJ9VyP6tuij+YHjp/kSSMecnZOd7oGvzu+rw9SJY= go.opentelemetry.io/collector/component/componenttest v0.115.0/go.mod h1:PzXvNqKLCiSADZGZFKH+IOHMkaQ0GTHuzysfVbTPKYY= -go.opentelemetry.io/collector/config/configauth v0.115.0 h1:xa+ALdyPgva3rZnLBh1H2oS5MsHP6JxSqMtQmcELnys= -go.opentelemetry.io/collector/config/configauth v0.115.0/go.mod h1:C7anpb3Rf4KswMT+dgOzkW9UX0z/65PLORpUw3p0VYc= -go.opentelemetry.io/collector/config/configcompression v1.21.0 h1:0zbPdZAgPFMAarwJEC4gaR6f/JBP686A3TYSgb3oa+E= -go.opentelemetry.io/collector/config/configcompression v1.21.0/go.mod h1:LvYG00tbPTv0NOLoZN0wXq1F5thcxvukO8INq7xyfWU= -go.opentelemetry.io/collector/config/confighttp v0.115.0 h1:BIy394oNXnqySJwrCqgAJu4gWgAV5aQUDD6k1hy6C8o= -go.opentelemetry.io/collector/config/confighttp v0.115.0/go.mod h1:Wr50ut12NmCEAl4bWLJryw2EjUmJTtYRg89560Q51wc= -go.opentelemetry.io/collector/config/configopaque v1.21.0 h1:PcvRGkBk4Px8BQM7tX+kw4i3jBsfAHGoGQbtZg6Ox7U= -go.opentelemetry.io/collector/config/configopaque v1.21.0/go.mod h1:sW0t0iI/VfRL9VYX7Ik6XzVgPcR+Y5kejTLsYcMyDWs= -go.opentelemetry.io/collector/config/configtelemetry v0.115.0 h1:U07FinCDop+r2RjWQ3aP9ZWONC7r7kQIp1GkXQi6nsI= -go.opentelemetry.io/collector/config/configtelemetry v0.115.0/go.mod h1:SlBEwQg0qly75rXZ6W1Ig8jN25KBVBkFIIAUI1GiAAE= -go.opentelemetry.io/collector/config/configtls v1.21.0 h1:ZfrlAYgBD8lzp04W0GxwiDmUbrvKsvDYJi+wkyiXlpA= -go.opentelemetry.io/collector/config/configtls v1.21.0/go.mod h1:5EsNefPfVCMOTlOrr3wyj7LrsOgY7V8iqRl8oFZEqtw= +go.opentelemetry.io/collector/config/configauth v0.115.1-0.20241206185113-3f3e208e71b8 h1:ih4kf5/HN019ZFPGUWR31+3oRaUa3khBEL8jvY8AZrs= +go.opentelemetry.io/collector/config/configauth v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:C7anpb3Rf4KswMT+dgOzkW9UX0z/65PLORpUw3p0VYc= +go.opentelemetry.io/collector/config/configcompression v1.21.1-0.20241206185113-3f3e208e71b8 h1:DnwOMnt/KvdDMwl8jur0e0E0RZ/H2TRHvXSiEmZCosM= +go.opentelemetry.io/collector/config/configcompression v1.21.1-0.20241206185113-3f3e208e71b8/go.mod h1:LvYG00tbPTv0NOLoZN0wXq1F5thcxvukO8INq7xyfWU= +go.opentelemetry.io/collector/config/confighttp v0.115.1-0.20241206185113-3f3e208e71b8 h1:A8I7RHjEAnRBbEjAjtHg0fwWIb9yxDnk7s5tSNZICDE= +go.opentelemetry.io/collector/config/confighttp v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:Wr50ut12NmCEAl4bWLJryw2EjUmJTtYRg89560Q51wc= +go.opentelemetry.io/collector/config/configopaque v1.21.1-0.20241206185113-3f3e208e71b8 h1:y6nKsNrgQhMQW2naoyz4sMkOitAXytjhwx3lglhp+vg= +go.opentelemetry.io/collector/config/configopaque v1.21.1-0.20241206185113-3f3e208e71b8/go.mod h1:sW0t0iI/VfRL9VYX7Ik6XzVgPcR+Y5kejTLsYcMyDWs= +go.opentelemetry.io/collector/config/configtelemetry v0.115.1-0.20241206185113-3f3e208e71b8 h1:b+0cqGeO0ZdILW5lsTzX29llVu1Me/Bxv0ya6iwOxcc= +go.opentelemetry.io/collector/config/configtelemetry v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:SlBEwQg0qly75rXZ6W1Ig8jN25KBVBkFIIAUI1GiAAE= +go.opentelemetry.io/collector/config/configtls v1.21.1-0.20241206185113-3f3e208e71b8 h1:4H2199VHuPO0D9/9RlsDnRRimxRwEFcUTmfT14qv26E= +go.opentelemetry.io/collector/config/configtls v1.21.1-0.20241206185113-3f3e208e71b8/go.mod h1:5EsNefPfVCMOTlOrr3wyj7LrsOgY7V8iqRl8oFZEqtw= go.opentelemetry.io/collector/config/internal v0.115.0 h1:eVk57iufZpUXyPJFKTb1Ebx5tmcCyroIlt427r5pxS8= go.opentelemetry.io/collector/config/internal v0.115.0/go.mod h1:OVkadRWlKAoWjHslqjWtBLAne8ceQm8WYT71ZcBWLFc= -go.opentelemetry.io/collector/confmap v1.21.0 h1:1tIcx2/Suwg8VhuPmQw87ba0ludPmumpFCFRZZa6RXA= -go.opentelemetry.io/collector/confmap v1.21.0/go.mod h1:Rrhs+MWoaP6AswZp+ReQ2VO9dfOfcUjdjiSHBsG+nec= -go.opentelemetry.io/collector/consumer v1.21.0 h1:THKZ2Vbi6GkamjTBI2hFq5Dc4kINZTWGwQNa8d/Ty9g= -go.opentelemetry.io/collector/consumer v1.21.0/go.mod h1:FQcC4ThMtRYY41dv+IPNK8POLLhAFY3r1YR5fuP7iiY= +go.opentelemetry.io/collector/confmap v1.21.1-0.20241206185113-3f3e208e71b8 h1:CNLAB32cTRsaRJCnb+1T9y6XxJzmDtEbo2svat6/b4g= +go.opentelemetry.io/collector/confmap v1.21.1-0.20241206185113-3f3e208e71b8/go.mod h1:Rrhs+MWoaP6AswZp+ReQ2VO9dfOfcUjdjiSHBsG+nec= +go.opentelemetry.io/collector/consumer v1.21.1-0.20241206185113-3f3e208e71b8 h1:GYE8iqLaknLjnrOM8QP+PBi7FpJGzCktMg1A9kgBbWg= +go.opentelemetry.io/collector/consumer v1.21.1-0.20241206185113-3f3e208e71b8/go.mod h1:FQcC4ThMtRYY41dv+IPNK8POLLhAFY3r1YR5fuP7iiY= go.opentelemetry.io/collector/consumer/consumererror v0.115.0 h1:yli//xBCQMPZKXNgNlXemo4dvqhnFrAmCZ11DvQgmcY= go.opentelemetry.io/collector/consumer/consumererror v0.115.0/go.mod h1:LwVzAvQ6ZVNG7mbOvurbAo+W/rKws0IcjOwriuZXqPE= -go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.0 h1:H3fDuyQW1t2HWHkz96WMBQJKUevypOCjBqnqtaAWyoA= -go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.0/go.mod h1:IzEmZ91Tp7TBxVDq8Cc9xvLsmO7H08njr6Pu9P5d9ns= -go.opentelemetry.io/collector/consumer/consumertest v0.115.0 h1:hru0I2447y0TluCdwlKYFFtgcpyCnlM+LiOK1JZyA70= -go.opentelemetry.io/collector/consumer/consumertest v0.115.0/go.mod h1:ybjALRJWR6aKNOzEMy1T1ruCULVDEjj4omtOJMrH/kU= -go.opentelemetry.io/collector/extension v0.115.0 h1:/cBb8AUdD0KMWC6V3lvCC16eP9Fg0wd1Upcp5rgvuGI= -go.opentelemetry.io/collector/extension v0.115.0/go.mod h1:HI7Ak6loyi6ZrZPsQJW1OO1wbaAW8OqXLFNQlTZnreQ= -go.opentelemetry.io/collector/extension/auth v0.115.0 h1:TTMokbBsSHZRFH48PvGSJmgSS8F3Rkr9MWGHZn8eJDk= -go.opentelemetry.io/collector/extension/auth v0.115.0/go.mod h1:3w+2mzeb2OYNOO4Bi41TUo4jr32ap2y7AOq64IDpxQo= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.1-0.20241206185113-3f3e208e71b8 h1:ysXU7y4ltc7p1h3gQFtA7Cr3Qxn/10An8adNYPOeVUQ= +go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:IzEmZ91Tp7TBxVDq8Cc9xvLsmO7H08njr6Pu9P5d9ns= +go.opentelemetry.io/collector/consumer/consumertest v0.115.1-0.20241206185113-3f3e208e71b8 h1:zinrZujQGjMJhWo926FIwcIy4nMgwoYXnMe99nn0xDQ= +go.opentelemetry.io/collector/consumer/consumertest v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:ybjALRJWR6aKNOzEMy1T1ruCULVDEjj4omtOJMrH/kU= +go.opentelemetry.io/collector/extension v0.115.1-0.20241206185113-3f3e208e71b8 h1:4LCz2FyEYJk7yHoSWcQZbx6MPC2aXeDelTY8D9eoBOw= +go.opentelemetry.io/collector/extension v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:HI7Ak6loyi6ZrZPsQJW1OO1wbaAW8OqXLFNQlTZnreQ= +go.opentelemetry.io/collector/extension/auth v0.115.1-0.20241206185113-3f3e208e71b8 h1:rIgjShZE8h5MlOmuTmcz+obCOTSUXMkg56nWj/maXy4= +go.opentelemetry.io/collector/extension/auth v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:3w+2mzeb2OYNOO4Bi41TUo4jr32ap2y7AOq64IDpxQo= go.opentelemetry.io/collector/extension/auth/authtest v0.115.0 h1:OZe7dKbZ01qodSpZU0ZYzI6zpmmzJ3UvfdBSFAbSgDw= go.opentelemetry.io/collector/extension/auth/authtest v0.115.0/go.mod h1:fk9WCXP0x91Q64Z8HZKWTHh9PWtgoWE1KXe3n2Bff3U= -go.opentelemetry.io/collector/pdata v1.21.0 h1:PG+UbiFMJ35X/WcAR7Rf/PWmWtRdW0aHlOidsR6c5MA= -go.opentelemetry.io/collector/pdata v1.21.0/go.mod h1:GKb1/zocKJMvxKbS+sl0W85lxhYBTFJ6h6I1tphVyDU= -go.opentelemetry.io/collector/pdata/pprofile v0.115.0 h1:NI89hy13vNDw7EOnQf7Jtitks4HJFO0SUWznTssmP94= -go.opentelemetry.io/collector/pdata/pprofile v0.115.0/go.mod h1:jGzdNfO0XTtfLjXCL/uCC1livg1LlfR+ix2WE/z3RpQ= +go.opentelemetry.io/collector/pdata v1.21.1-0.20241206185113-3f3e208e71b8 h1:PUaCJ1XIIomqXvFBF6hMFikhZIwoBc57UP7xlaRT//I= +go.opentelemetry.io/collector/pdata v1.21.1-0.20241206185113-3f3e208e71b8/go.mod h1:GKb1/zocKJMvxKbS+sl0W85lxhYBTFJ6h6I1tphVyDU= +go.opentelemetry.io/collector/pdata/pprofile v0.115.1-0.20241206185113-3f3e208e71b8 h1:+RGyM6ZhtNHRaiNbIiJ82Ik6TFmk3BCOgLvhw509Hc4= +go.opentelemetry.io/collector/pdata/pprofile v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:jGzdNfO0XTtfLjXCL/uCC1livg1LlfR+ix2WE/z3RpQ= go.opentelemetry.io/collector/pdata/testdata v0.115.0 h1:Rblz+AKXdo3fG626jS+KSd0OSA4uMXcTQfpwed6P8LI= go.opentelemetry.io/collector/pdata/testdata v0.115.0/go.mod h1:inNnRt6S2Nn260EfCBEcjesjlKOSsr0jPwkPqpBkt4s= -go.opentelemetry.io/collector/pipeline v0.115.0 h1:bmACBqb0e8U9ag+vGGHUP7kCfAO7HHROdtzIEg8ulus= -go.opentelemetry.io/collector/pipeline v0.115.0/go.mod h1:qE3DmoB05AW0C3lmPvdxZqd/H4po84NPzd5MrqgtL74= -go.opentelemetry.io/collector/receiver v0.115.0 h1:55Q3Jvj6zHCIA1psKqi/3kEMJO4OqUF5tNAEYNdB1U8= -go.opentelemetry.io/collector/receiver v0.115.0/go.mod h1:nBSCh2O/WUcfgpJ+Jpz+B0z0Hn5jHeRvF2WmLij5EIY= -go.opentelemetry.io/collector/receiver/receiverprofiles v0.115.0 h1:R9JLaj2Al93smIPUkbJshAkb/cY0H5JBOxIx+Zu0NG4= -go.opentelemetry.io/collector/receiver/receiverprofiles v0.115.0/go.mod h1:05E5hGujWeeXJmzKZwTdHyZ/+rRyrQlQB5p5Q2XY39M= +go.opentelemetry.io/collector/pipeline v0.115.1-0.20241206185113-3f3e208e71b8 h1:In55kZRXRq1whMsZVeAIyaZ/enb+m673PxzBwrsQZm0= +go.opentelemetry.io/collector/pipeline v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:qE3DmoB05AW0C3lmPvdxZqd/H4po84NPzd5MrqgtL74= +go.opentelemetry.io/collector/receiver v0.115.1-0.20241206185113-3f3e208e71b8 h1:8AL/vaRXeGL6rw7E+RZJEomG/xs2/X9NxhS9RcqKsNU= +go.opentelemetry.io/collector/receiver v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:nBSCh2O/WUcfgpJ+Jpz+B0z0Hn5jHeRvF2WmLij5EIY= +go.opentelemetry.io/collector/receiver/receiverprofiles v0.115.1-0.20241206185113-3f3e208e71b8 h1:Nq/nLqbMLMKHN3tv/doV+BhS529q800HFE85o0r/XcI= +go.opentelemetry.io/collector/receiver/receiverprofiles v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:05E5hGujWeeXJmzKZwTdHyZ/+rRyrQlQB5p5Q2XY39M= go.opentelemetry.io/collector/receiver/receivertest v0.115.0 h1:OiB684SbHQi6/Pd3ZH0cXjYvCpBS9ilQBfTQx0wVXHg= go.opentelemetry.io/collector/receiver/receivertest v0.115.0/go.mod h1:Y8Z9U/bz9Xpyt8GI8DxZZgryw3mnnIw+AeKVLTD2cP8= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= From 9a6b4a76fa493a42b0cf49a889c3d58015941cc6 Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Tue, 10 Dec 2024 18:44:34 +0000 Subject: [PATCH 08/12] merge indirect blocks and remove whitespace --- .github/CODEOWNERS | 2 +- receiver/libhoneyreceiver/go.mod | 37 +++++++++++++++----------------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e389d43597af..22e81e44700a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -244,7 +244,7 @@ receiver/k8sobjectsreceiver/ @open-telemetry/collector-cont receiver/kafkametricsreceiver/ @open-telemetry/collector-contrib-approvers @dmitryax receiver/kafkareceiver/ @open-telemetry/collector-contrib-approvers @pavolloffay @MovieStoreGuy receiver/kubeletstatsreceiver/ @open-telemetry/collector-contrib-approvers @dmitryax @TylerHelmuth @ChrsMark -receiver/libhoneyreceiver/ @open-telemetry/collector-contrib-approvers @TylerHelmuth +receiver/libhoneyreceiver/ @open-telemetry/collector-contrib-approvers @TylerHelmuth receiver/lokireceiver/ @open-telemetry/collector-contrib-approvers @mar4uk receiver/memcachedreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski receiver/mongodbatlasreceiver/ @open-telemetry/collector-contrib-approvers @schmikei diff --git a/receiver/libhoneyreceiver/go.mod b/receiver/libhoneyreceiver/go.mod index f1d22eb56a0e..3d67a9e09ce7 100644 --- a/receiver/libhoneyreceiver/go.mod +++ b/receiver/libhoneyreceiver/go.mod @@ -15,32 +15,14 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/gogo/protobuf v1.3.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/pierrec/lz4/v4 v4.1.21 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/client v1.21.1-0.20241206185113-3f3e208e71b8 // indirect - go.opentelemetry.io/collector/consumer/consumererror v0.115.0 // indirect - go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.1-0.20241206185113-3f3e208e71b8 // indirect - go.opentelemetry.io/collector/pdata v1.21.1-0.20241206185113-3f3e208e71b8 // indirect - go.opentelemetry.io/collector/pdata/pprofile v0.115.1-0.20241206185113-3f3e208e71b8 // indirect - go.opentelemetry.io/collector/pipeline v0.115.1-0.20241206185113-3f3e208e71b8 // indirect - go.opentelemetry.io/collector/receiver/receiverprofiles v0.115.1-0.20241206185113-3f3e208e71b8 // indirect - go.opentelemetry.io/otel v1.32.0 // indirect - go.opentelemetry.io/otel/sdk v1.32.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect - go.opentelemetry.io/otel/trace v1.32.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect - google.golang.org/grpc v1.67.1 // indirect -) - -require ( github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.8.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-viper/mapstructure/v2 v2.2.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/snappy v0.0.4 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/compress v1.17.11 // indirect github.com/knadh/koanf/maps v0.1.1 // indirect @@ -50,7 +32,10 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pierrec/lz4/v4 v4.1.21 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rs/cors v1.11.1 // indirect + go.opentelemetry.io/collector/client v1.21.1-0.20241206185113-3f3e208e71b8 // indirect go.opentelemetry.io/collector/component v0.115.1-0.20241206185113-3f3e208e71b8 go.opentelemetry.io/collector/component/componentstatus v0.115.1-0.20241206185113-3f3e208e71b8 go.opentelemetry.io/collector/config/configauth v0.115.1-0.20241206185113-3f3e208e71b8 // indirect @@ -59,16 +44,28 @@ require ( go.opentelemetry.io/collector/config/configtelemetry v0.115.1-0.20241206185113-3f3e208e71b8 // indirect go.opentelemetry.io/collector/config/configtls v1.21.1-0.20241206185113-3f3e208e71b8 // indirect go.opentelemetry.io/collector/config/internal v0.115.0 // indirect + go.opentelemetry.io/collector/consumer/consumererror v0.115.0 // indirect + go.opentelemetry.io/collector/consumer/consumerprofiles v0.115.1-0.20241206185113-3f3e208e71b8 // indirect go.opentelemetry.io/collector/extension v0.115.1-0.20241206185113-3f3e208e71b8 // indirect go.opentelemetry.io/collector/extension/auth v0.115.1-0.20241206185113-3f3e208e71b8 // indirect + go.opentelemetry.io/collector/pdata v1.21.1-0.20241206185113-3f3e208e71b8 // indirect + go.opentelemetry.io/collector/pdata/pprofile v0.115.1-0.20241206185113-3f3e208e71b8 // indirect + go.opentelemetry.io/collector/pipeline v0.115.1-0.20241206185113-3f3e208e71b8 // indirect go.opentelemetry.io/collector/receiver v0.115.1-0.20241206185113-3f3e208e71b8 + go.opentelemetry.io/collector/receiver/receiverprofiles v0.115.1-0.20241206185113-3f3e208e71b8 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect + go.opentelemetry.io/otel v1.32.0 // indirect go.opentelemetry.io/otel/metric v1.32.0 // indirect + go.opentelemetry.io/otel/sdk v1.32.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect + go.opentelemetry.io/otel/trace v1.32.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 golang.org/x/net v0.31.0 // indirect golang.org/x/sys v0.27.0 // indirect golang.org/x/text v0.20.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect + google.golang.org/grpc v1.67.1 // indirect google.golang.org/protobuf v1.35.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) From 5fd4621d34485b4caffad3234c50e5eb58616079 Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Tue, 10 Dec 2024 19:00:56 +0000 Subject: [PATCH 09/12] some other go mod version things --- receiver/libhoneyreceiver/go.mod | 4 ++-- receiver/libhoneyreceiver/go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/receiver/libhoneyreceiver/go.mod b/receiver/libhoneyreceiver/go.mod index 3d67a9e09ce7..03109614fe15 100644 --- a/receiver/libhoneyreceiver/go.mod +++ b/receiver/libhoneyreceiver/go.mod @@ -4,12 +4,12 @@ go 1.22.0 require ( github.com/stretchr/testify v1.10.0 - go.opentelemetry.io/collector/component/componenttest v0.115.0 + go.opentelemetry.io/collector/component/componenttest v0.115.1-0.20241206185113-3f3e208e71b8 go.opentelemetry.io/collector/config/confighttp v0.115.1-0.20241206185113-3f3e208e71b8 go.opentelemetry.io/collector/confmap v1.21.1-0.20241206185113-3f3e208e71b8 go.opentelemetry.io/collector/consumer v1.21.1-0.20241206185113-3f3e208e71b8 go.opentelemetry.io/collector/consumer/consumertest v0.115.1-0.20241206185113-3f3e208e71b8 - go.opentelemetry.io/collector/receiver/receivertest v0.115.0 + go.opentelemetry.io/collector/receiver/receivertest v0.115.1-0.20241206185113-3f3e208e71b8 go.uber.org/goleak v1.3.0 ) diff --git a/receiver/libhoneyreceiver/go.sum b/receiver/libhoneyreceiver/go.sum index 38355f537008..5cb28e5c29a3 100644 --- a/receiver/libhoneyreceiver/go.sum +++ b/receiver/libhoneyreceiver/go.sum @@ -66,8 +66,8 @@ go.opentelemetry.io/collector/component v0.115.1-0.20241206185113-3f3e208e71b8 h go.opentelemetry.io/collector/component v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:oIUFiH7w1eOimdeYhFI+gAIxYSiLDocKVJ0PTvX7d6s= go.opentelemetry.io/collector/component/componentstatus v0.115.1-0.20241206185113-3f3e208e71b8 h1:DD5ahJ8YNJ32hxGU4RSw5Y3EVuZg/IZr5YtykvkfSo8= go.opentelemetry.io/collector/component/componentstatus v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:36A+9XSiOz0Cdhq+UwwPRlEr5CYuSkEnVO9om4BH7d0= -go.opentelemetry.io/collector/component/componenttest v0.115.0 h1:9URDJ9VyP6tuij+YHjp/kSSMecnZOd7oGvzu+rw9SJY= -go.opentelemetry.io/collector/component/componenttest v0.115.0/go.mod h1:PzXvNqKLCiSADZGZFKH+IOHMkaQ0GTHuzysfVbTPKYY= +go.opentelemetry.io/collector/component/componenttest v0.115.1-0.20241206185113-3f3e208e71b8 h1:Bic9twYk1GtkTNvzlt9rPCJEavRc5QYdSTN6Ug3hi9Q= +go.opentelemetry.io/collector/component/componenttest v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:PzXvNqKLCiSADZGZFKH+IOHMkaQ0GTHuzysfVbTPKYY= go.opentelemetry.io/collector/config/configauth v0.115.1-0.20241206185113-3f3e208e71b8 h1:ih4kf5/HN019ZFPGUWR31+3oRaUa3khBEL8jvY8AZrs= go.opentelemetry.io/collector/config/configauth v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:C7anpb3Rf4KswMT+dgOzkW9UX0z/65PLORpUw3p0VYc= go.opentelemetry.io/collector/config/configcompression v1.21.1-0.20241206185113-3f3e208e71b8 h1:DnwOMnt/KvdDMwl8jur0e0E0RZ/H2TRHvXSiEmZCosM= @@ -110,8 +110,8 @@ go.opentelemetry.io/collector/receiver v0.115.1-0.20241206185113-3f3e208e71b8 h1 go.opentelemetry.io/collector/receiver v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:nBSCh2O/WUcfgpJ+Jpz+B0z0Hn5jHeRvF2WmLij5EIY= go.opentelemetry.io/collector/receiver/receiverprofiles v0.115.1-0.20241206185113-3f3e208e71b8 h1:Nq/nLqbMLMKHN3tv/doV+BhS529q800HFE85o0r/XcI= go.opentelemetry.io/collector/receiver/receiverprofiles v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:05E5hGujWeeXJmzKZwTdHyZ/+rRyrQlQB5p5Q2XY39M= -go.opentelemetry.io/collector/receiver/receivertest v0.115.0 h1:OiB684SbHQi6/Pd3ZH0cXjYvCpBS9ilQBfTQx0wVXHg= -go.opentelemetry.io/collector/receiver/receivertest v0.115.0/go.mod h1:Y8Z9U/bz9Xpyt8GI8DxZZgryw3mnnIw+AeKVLTD2cP8= +go.opentelemetry.io/collector/receiver/receivertest v0.115.1-0.20241206185113-3f3e208e71b8 h1:cOsmTAvpuiDHh5ggc/JnsF3nBFC9dQaswFvTDpujJqs= +go.opentelemetry.io/collector/receiver/receivertest v0.115.1-0.20241206185113-3f3e208e71b8/go.mod h1:Y8Z9U/bz9Xpyt8GI8DxZZgryw3mnnIw+AeKVLTD2cP8= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= From d16d6b59f54d6d2e4d20d78feb85da03af053965 Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Wed, 11 Dec 2024 19:09:33 +0000 Subject: [PATCH 10/12] remove copy of sharedcomponent --- receiver/libhoneyreceiver/factory.go | 26 +-- receiver/libhoneyreceiver/go.mod | 1 + receiver/libhoneyreceiver/go.sum | 2 + .../sharedcomponent/sharedcomponent.go | 170 ------------------ 4 files changed, 18 insertions(+), 181 deletions(-) delete mode 100644 receiver/libhoneyreceiver/internal/sharedcomponent/sharedcomponent.go diff --git a/receiver/libhoneyreceiver/factory.go b/receiver/libhoneyreceiver/factory.go index 5667fc4c96de..4d0d0fa25cfa 100644 --- a/receiver/libhoneyreceiver/factory.go +++ b/receiver/libhoneyreceiver/factory.go @@ -12,8 +12,8 @@ import ( "go.opentelemetry.io/collector/consumer" "go.opentelemetry.io/collector/receiver" + "github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver/internal/metadata" - "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver/internal/sharedcomponent" ) const ( @@ -70,17 +70,20 @@ func createLogs( nextConsumer consumer.Logs, ) (receiver.Logs, error) { oCfg := cfg.(*Config) - r, err := receivers.LoadOrStore( + var err error + r := receivers.GetOrAdd( oCfg, - func() (*libhoneyReceiver, error) { - return newLibhoneyReceiver(oCfg, &set) + func() (lh component.Component) { + lh, err = newLibhoneyReceiver(oCfg, &set) + return lh }, ) + if err != nil { return nil, err } - r.Unwrap().registerLogConsumer(nextConsumer) + r.Unwrap().(*libhoneyReceiver).registerLogConsumer(nextConsumer) return r, nil } @@ -92,19 +95,20 @@ func createTraces( nextConsumer consumer.Traces, ) (receiver.Traces, error) { oCfg := cfg.(*Config) - r, err := receivers.LoadOrStore( + var err error + r := receivers.GetOrAdd( oCfg, - func() (*libhoneyReceiver, error) { - return newLibhoneyReceiver(oCfg, &set) + func() (lh component.Component) { + lh, err = newLibhoneyReceiver(oCfg, &set) + return lh }, ) if err != nil { return nil, err } - r.Unwrap().registerTraceConsumer(nextConsumer) + r.Unwrap().(*libhoneyReceiver).registerTraceConsumer(nextConsumer) return r, nil } -// Used the same pattern as the OTLP receiver. Requires sharedcomponent.go from core collector repo -var receivers = sharedcomponent.NewMap[*Config, *libhoneyReceiver]() +var receivers = sharedcomponent.NewSharedComponents() diff --git a/receiver/libhoneyreceiver/go.mod b/receiver/libhoneyreceiver/go.mod index 03109614fe15..0d3f85d96ab4 100644 --- a/receiver/libhoneyreceiver/go.mod +++ b/receiver/libhoneyreceiver/go.mod @@ -32,6 +32,7 @@ require ( github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.115.0 github.com/pierrec/lz4/v4 v4.1.21 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rs/cors v1.11.1 // indirect diff --git a/receiver/libhoneyreceiver/go.sum b/receiver/libhoneyreceiver/go.sum index 5cb28e5c29a3..55430aa13196 100644 --- a/receiver/libhoneyreceiver/go.sum +++ b/receiver/libhoneyreceiver/go.sum @@ -46,6 +46,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.115.0 h1:MuyDWyVoCty8HyP2CAYoRZXwINiThHovcC1Bj3+H8lk= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.115.0/go.mod h1:asekVnrdzYsMJBaJtIyXOt8p07l1x0xs8X3h00sZyf0= github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/receiver/libhoneyreceiver/internal/sharedcomponent/sharedcomponent.go b/receiver/libhoneyreceiver/internal/sharedcomponent/sharedcomponent.go deleted file mode 100644 index e4dbbfe27c2e..000000000000 --- a/receiver/libhoneyreceiver/internal/sharedcomponent/sharedcomponent.go +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Package sharedcomponent exposes functionality for components -// to register against a shared key, such as a configuration object, in order to be reused across signal types. -// This is particularly useful when the component relies on a shared resource such as os.File or http.Server. -package sharedcomponent // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/libhoneyreceiver/internal/sharedcomponent" - -import ( - "context" - "slices" - "sync" - - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componentstatus" -) - -func NewMap[K comparable, V component.Component]() *Map[K, V] { - return &Map[K, V]{ - components: map[K]*Component[V]{}, - } -} - -// Map keeps reference of all created instances for a given shared key such as a component configuration. -type Map[K comparable, V component.Component] struct { - lock sync.Mutex - components map[K]*Component[V] -} - -// LoadOrStore returns the already created instance if exists, otherwise creates a new instance -// and adds it to the map of references. -func (m *Map[K, V]) LoadOrStore(key K, create func() (V, error)) (*Component[V], error) { - m.lock.Lock() - defer m.lock.Unlock() - if c, ok := m.components[key]; ok { - return c, nil - } - comp, err := create() - if err != nil { - return nil, err - } - - newComp := &Component[V]{ - component: comp, - removeFunc: func() { - m.lock.Lock() - defer m.lock.Unlock() - delete(m.components, key) - }, - } - m.components[key] = newComp - return newComp, nil -} - -// Component ensures that the wrapped component is started and stopped only once. -// When stopped it is removed from the Map. -type Component[V component.Component] struct { - component V - - startOnce sync.Once - stopOnce sync.Once - removeFunc func() - - hostWrapper *hostWrapper -} - -// Unwrap returns the original component. -func (c *Component[V]) Unwrap() V { - return c.component -} - -// Start starts the underlying component if it never started before. -func (c *Component[V]) Start(ctx context.Context, host component.Host) error { - if c.hostWrapper == nil { - var err error - c.startOnce.Do(func() { - c.hostWrapper = &hostWrapper{ - host: host, - sources: make([]componentstatus.Reporter, 0), - previousEvents: make([]*componentstatus.Event, 0), - } - statusReporter, isStatusReporter := host.(componentstatus.Reporter) - if isStatusReporter { - c.hostWrapper.addSource(statusReporter) - } - - // It's important that status for a shared component is reported through its - // telemetry settings to keep status in sync and avoid race conditions. This logic duplicates - // and takes priority over the automated status reporting that happens in graph, making the - // status reporting in graph a no-op. - c.hostWrapper.Report(componentstatus.NewEvent(componentstatus.StatusStarting)) - if err = c.component.Start(ctx, c.hostWrapper); err != nil { - c.hostWrapper.Report(componentstatus.NewPermanentErrorEvent(err)) - } - }) - return err - } - statusReporter, isStatusReporter := host.(componentstatus.Reporter) - if isStatusReporter { - c.hostWrapper.addSource(statusReporter) - } - return nil -} - -var ( - _ component.Host = (*hostWrapper)(nil) - _ componentstatus.Reporter = (*hostWrapper)(nil) -) - -type hostWrapper struct { - host component.Host - sources []componentstatus.Reporter - previousEvents []*componentstatus.Event - lock sync.Mutex -} - -func (h *hostWrapper) GetExtensions() map[component.ID]component.Component { - return h.host.GetExtensions() -} - -func (h *hostWrapper) Report(e *componentstatus.Event) { - // Only remember an event if it will be emitted and it has not been sent already. - h.lock.Lock() - if len(h.sources) > 0 && !slices.Contains(h.previousEvents, e) { - h.previousEvents = append(h.previousEvents, e) - } - h.lock.Unlock() - - h.lock.Lock() - for _, s := range h.sources { - s.Report(e) - } - h.lock.Unlock() -} - -func (h *hostWrapper) addSource(s componentstatus.Reporter) { - h.lock.Lock() - for _, e := range h.previousEvents { - s.Report(e) - } - h.lock.Unlock() - - h.lock.Lock() - h.sources = append(h.sources, s) - h.lock.Unlock() -} - -// Shutdown shuts down the underlying component. -func (c *Component[V]) Shutdown(ctx context.Context) error { - var err error - c.stopOnce.Do(func() { - // It's important that status for a shared component is reported through its - // telemetry settings to keep status in sync and avoid race conditions. This logic duplicates - // and takes priority over the automated status reporting that happens in graph, making the - // status reporting in graph a no-op. - if c.hostWrapper != nil { - c.hostWrapper.Report(componentstatus.NewEvent(componentstatus.StatusStopping)) - } - err = c.component.Shutdown(ctx) - if c.hostWrapper != nil { - if err != nil { - c.hostWrapper.Report(componentstatus.NewPermanentErrorEvent(err)) - } else { - c.hostWrapper.Report(componentstatus.NewEvent(componentstatus.StatusStopped)) - } - } - c.removeFunc() - }) - return err -} From 0b1bbaf0c6b43b1695f11a0702b24fc9f6b69bcf Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Wed, 11 Dec 2024 19:59:08 +0000 Subject: [PATCH 11/12] fixed crosslink --- receiver/libhoneyreceiver/go.mod | 2 ++ 1 file changed, 2 insertions(+) diff --git a/receiver/libhoneyreceiver/go.mod b/receiver/libhoneyreceiver/go.mod index 0d3f85d96ab4..58ea39a586a9 100644 --- a/receiver/libhoneyreceiver/go.mod +++ b/receiver/libhoneyreceiver/go.mod @@ -72,3 +72,5 @@ require ( ) replace google.golang.org/genproto => google.golang.org/genproto v0.0.0-20240701130421-f6361c86f094 + +replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent => ../../internal/sharedcomponent From 63f19f2b12dec149849c012b5a94e3c0a0dc0222 Mon Sep 17 00:00:00 2001 From: Mike Terhar Date: Wed, 11 Dec 2024 21:08:03 +0000 Subject: [PATCH 12/12] fix go sum --- receiver/libhoneyreceiver/go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/receiver/libhoneyreceiver/go.sum b/receiver/libhoneyreceiver/go.sum index 55430aa13196..5cb28e5c29a3 100644 --- a/receiver/libhoneyreceiver/go.sum +++ b/receiver/libhoneyreceiver/go.sum @@ -46,8 +46,6 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.115.0 h1:MuyDWyVoCty8HyP2CAYoRZXwINiThHovcC1Bj3+H8lk= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.115.0/go.mod h1:asekVnrdzYsMJBaJtIyXOt8p07l1x0xs8X3h00sZyf0= github.com/pierrec/lz4/v4 v4.1.21 h1:yOVMLb6qSIDP67pl/5F7RepeKYu/VmTyEXvuMI5d9mQ= github.com/pierrec/lz4/v4 v4.1.21/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=