From b102db7225ecc830a9a29de735bdd980d25e29ce Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Mon, 7 Oct 2024 10:30:30 -0400 Subject: [PATCH 01/11] Refactor extension/healthcheckv2extension/internal/status to pkg/status --- extension/healthcheckv2extension/extension.go | 2 +- .../healthcheckv2extension/extension_test.go | 4 +- extension/healthcheckv2extension/go.mod | 5 +- .../internal/grpc/grpc.go | 2 +- .../internal/grpc/grpc_test.go | 9 +- .../internal/grpc/server.go | 2 +- .../internal/http/handlers.go | 2 +- .../internal/http/responders.go | 2 +- .../internal/http/serialization.go | 2 +- .../internal/http/server.go | 2 +- .../internal/http/server_test.go | 7 +- .../internal/testhelpers/helpers.go | 53 +---------- pkg/status/Makefile | 1 + pkg/status/README.md | 12 +++ .../internal => pkg}/status/aggregation.go | 2 +- .../status/aggregation_test.go | 0 .../internal => pkg}/status/aggregator.go | 2 +- .../status/aggregator_test.go | 4 +- pkg/status/go.mod | 32 +++++++ pkg/status/go.sum | 90 +++++++++++++++++++ .../internal => pkg}/status/package_test.go | 2 +- pkg/status/testhelpers/helpers.go | 59 ++++++++++++ 22 files changed, 222 insertions(+), 74 deletions(-) create mode 100644 pkg/status/Makefile create mode 100644 pkg/status/README.md rename {extension/healthcheckv2extension/internal => pkg}/status/aggregation.go (98%) rename {extension/healthcheckv2extension/internal => pkg}/status/aggregation_test.go (100%) rename {extension/healthcheckv2extension/internal => pkg}/status/aggregator.go (99%) rename {extension/healthcheckv2extension/internal => pkg}/status/aggregator_test.go (98%) create mode 100644 pkg/status/go.mod create mode 100644 pkg/status/go.sum rename {extension/healthcheckv2extension/internal => pkg}/status/package_test.go (77%) create mode 100644 pkg/status/testhelpers/helpers.go diff --git a/extension/healthcheckv2extension/extension.go b/extension/healthcheckv2extension/extension.go index afcaceb36cb9..23a307c9a9cf 100644 --- a/extension/healthcheckv2extension/extension.go +++ b/extension/healthcheckv2extension/extension.go @@ -16,7 +16,7 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/grpc" "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/http" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" ) type eventSourcePair struct { diff --git a/extension/healthcheckv2extension/extension_test.go b/extension/healthcheckv2extension/extension_test.go index bb15441a1aae..c15acc269245 100644 --- a/extension/healthcheckv2extension/extension_test.go +++ b/extension/healthcheckv2extension/extension_test.go @@ -20,9 +20,9 @@ import ( "go.opentelemetry.io/collector/confmap/confmaptest" "go.opentelemetry.io/collector/extension/extensiontest" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/testhelpers" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status/testhelpers" ) func TestComponentStatus(t *testing.T) { diff --git a/extension/healthcheckv2extension/go.mod b/extension/healthcheckv2extension/go.mod index d338ee9d8ff9..b482baefb423 100644 --- a/extension/healthcheckv2extension/go.mod +++ b/extension/healthcheckv2extension/go.mod @@ -4,6 +4,7 @@ go 1.22.0 require ( github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.111.0 + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status v0.111.0 github.com/stretchr/testify v1.9.0 go.opentelemetry.io/collector/component v0.111.0 go.opentelemetry.io/collector/component/componentstatus v0.111.0 @@ -14,7 +15,6 @@ require ( go.opentelemetry.io/collector/confmap v1.17.0 go.opentelemetry.io/collector/extension v0.111.0 go.opentelemetry.io/collector/extension/extensioncapabilities v0.111.0 - go.opentelemetry.io/collector/pipeline v0.111.0 go.uber.org/goleak v1.3.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 @@ -51,6 +51,7 @@ require ( go.opentelemetry.io/collector/featuregate v1.17.0 // indirect go.opentelemetry.io/collector/internal/globalsignal v0.111.0 // indirect go.opentelemetry.io/collector/pdata v1.17.0 // indirect + go.opentelemetry.io/collector/pipeline v0.111.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.55.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.55.0 // indirect go.opentelemetry.io/otel v1.30.0 // indirect @@ -67,3 +68,5 @@ require ( ) replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/common => ../../internal/common + +replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status => ../../pkg/status diff --git a/extension/healthcheckv2extension/internal/grpc/grpc.go b/extension/healthcheckv2extension/internal/grpc/grpc.go index b457c18e7d4a..2f8ad037c490 100644 --- a/extension/healthcheckv2extension/internal/grpc/grpc.go +++ b/extension/healthcheckv2extension/internal/grpc/grpc.go @@ -12,7 +12,7 @@ import ( healthpb "google.golang.org/grpc/health/grpc_health_v1" grpcstatus "google.golang.org/grpc/status" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" ) var ( diff --git a/extension/healthcheckv2extension/internal/grpc/grpc_test.go b/extension/healthcheckv2extension/internal/grpc/grpc_test.go index f6f689b01c0a..837a58ebdf63 100644 --- a/extension/healthcheckv2extension/internal/grpc/grpc_test.go +++ b/extension/healthcheckv2extension/internal/grpc/grpc_test.go @@ -22,9 +22,10 @@ import ( grpcstatus "google.golang.org/grpc/status" "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/common" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/testhelpers" + internalhelpers "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/testhelpers" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status/testhelpers" ) func TestCheck(t *testing.T) { @@ -695,7 +696,7 @@ func TestCheck(t *testing.T) { config, tc.componentHealthSettings, componenttest.NewNopTelemetrySettings(), - status.NewAggregator(testhelpers.ErrPriority(tc.componentHealthSettings)), + status.NewAggregator(internalhelpers.ErrPriority(tc.componentHealthSettings)), ) require.NoError(t, server.Start(context.Background(), componenttest.NewNopHost())) t.Cleanup(func() { require.NoError(t, server.Shutdown(context.Background())) }) @@ -1532,7 +1533,7 @@ func TestWatch(t *testing.T) { config, tc.componentHealthSettings, componenttest.NewNopTelemetrySettings(), - status.NewAggregator(testhelpers.ErrPriority(tc.componentHealthSettings)), + status.NewAggregator(internalhelpers.ErrPriority(tc.componentHealthSettings)), ) require.NoError(t, server.Start(context.Background(), componenttest.NewNopHost())) t.Cleanup(func() { require.NoError(t, server.Shutdown(context.Background())) }) diff --git a/extension/healthcheckv2extension/internal/grpc/server.go b/extension/healthcheckv2extension/internal/grpc/server.go index e9a9e3ff92ee..2c69e5fb9e61 100644 --- a/extension/healthcheckv2extension/internal/grpc/server.go +++ b/extension/healthcheckv2extension/internal/grpc/server.go @@ -13,7 +13,7 @@ import ( healthpb "google.golang.org/grpc/health/grpc_health_v1" "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/common" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" ) type Server struct { diff --git a/extension/healthcheckv2extension/internal/http/handlers.go b/extension/healthcheckv2extension/internal/http/handlers.go index 186add81504b..2ae041558038 100644 --- a/extension/healthcheckv2extension/internal/http/handlers.go +++ b/extension/healthcheckv2extension/internal/http/handlers.go @@ -6,7 +6,7 @@ package http // import "github.com/open-telemetry/opentelemetry-collector-contri import ( "net/http" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" ) func (s *Server) statusHandler() http.Handler { diff --git a/extension/healthcheckv2extension/internal/http/responders.go b/extension/healthcheckv2extension/internal/http/responders.go index 6cb4ed6e3dd0..5dfc3b2cfe09 100644 --- a/extension/healthcheckv2extension/internal/http/responders.go +++ b/extension/healthcheckv2extension/internal/http/responders.go @@ -12,7 +12,7 @@ import ( "go.opentelemetry.io/collector/component/componentstatus" "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/common" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" ) var responseCodes = map[componentstatus.Status]int{ diff --git a/extension/healthcheckv2extension/internal/http/serialization.go b/extension/healthcheckv2extension/internal/http/serialization.go index ce98541e3678..a1a61c72ebfc 100644 --- a/extension/healthcheckv2extension/internal/http/serialization.go +++ b/extension/healthcheckv2extension/internal/http/serialization.go @@ -8,7 +8,7 @@ import ( "go.opentelemetry.io/collector/component/componentstatus" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" ) type healthyFunc func(status.Event) bool diff --git a/extension/healthcheckv2extension/internal/http/server.go b/extension/healthcheckv2extension/internal/http/server.go index 42e6b943b3c8..d38f9f3944c0 100644 --- a/extension/healthcheckv2extension/internal/http/server.go +++ b/extension/healthcheckv2extension/internal/http/server.go @@ -20,7 +20,7 @@ import ( "go.uber.org/zap" "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/common" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" ) type Server struct { diff --git a/extension/healthcheckv2extension/internal/http/server_test.go b/extension/healthcheckv2extension/internal/http/server_test.go index fb3e671a7fd3..4a11d0138d55 100644 --- a/extension/healthcheckv2extension/internal/http/server_test.go +++ b/extension/healthcheckv2extension/internal/http/server_test.go @@ -23,9 +23,10 @@ import ( "go.opentelemetry.io/collector/confmap/confmaptest" "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/common" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/testhelpers" + internalhelpers "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/testhelpers" "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status/testhelpers" ) // These are used for the legacy test assertions @@ -2942,7 +2943,7 @@ func TestStatus(t *testing.T) { tc.legacyConfig, tc.componentHealthConfig, componenttest.NewNopTelemetrySettings(), - status.NewAggregator(testhelpers.ErrPriority(tc.componentHealthConfig)), + status.NewAggregator(internalhelpers.ErrPriority(tc.componentHealthConfig)), ) require.NoError(t, server.Start(context.Background(), componenttest.NewNopHost())) diff --git a/extension/healthcheckv2extension/internal/testhelpers/helpers.go b/extension/healthcheckv2extension/internal/testhelpers/helpers.go index 57d44301b985..1377c040d84f 100644 --- a/extension/healthcheckv2extension/internal/testhelpers/helpers.go +++ b/extension/healthcheckv2extension/internal/testhelpers/helpers.go @@ -4,61 +4,10 @@ package testhelpers // import "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/testhelpers" import ( - "go.opentelemetry.io/collector/component" - "go.opentelemetry.io/collector/component/componentstatus" - "go.opentelemetry.io/collector/pipeline" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/common" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" ) -// PipelineMetadata groups together component and instance IDs for a hypothetical pipeline used -// for testing purposes. -type PipelineMetadata struct { - PipelineID pipeline.ID - ReceiverID *componentstatus.InstanceID - ProcessorID *componentstatus.InstanceID - ExporterID *componentstatus.InstanceID -} - -// InstanceIDs returns a slice of instanceIDs for components within the hypothetical pipeline. -func (p *PipelineMetadata) InstanceIDs() []*componentstatus.InstanceID { - return []*componentstatus.InstanceID{p.ReceiverID, p.ProcessorID, p.ExporterID} -} - -// NewPipelineMetadata returns a metadata for a hypothetical pipeline. -func NewPipelineMetadata(typestr string) *PipelineMetadata { - pipelineID := pipeline.MustNewID(typestr) - return &PipelineMetadata{ - PipelineID: pipelineID, - ReceiverID: componentstatus.NewInstanceID(component.NewIDWithName(component.MustNewType(typestr), "in"), component.KindReceiver).WithPipelines(pipelineID), - ProcessorID: componentstatus.NewInstanceID(component.MustNewID("batch"), component.KindProcessor).WithPipelines(pipelineID), - ExporterID: componentstatus.NewInstanceID(component.NewIDWithName(component.MustNewType(typestr), "out"), component.KindExporter).WithPipelines(pipelineID), - } -} - -// NewPipelines returns a map of hypothetical pipelines identified by their stringified typeVal. -func NewPipelines(typestrs ...string) map[string]*PipelineMetadata { - result := make(map[string]*PipelineMetadata, len(typestrs)) - for _, typestr := range typestrs { - result[typestr] = NewPipelineMetadata(typestr) - } - return result -} - -// SeedAggregator records a status event for each instanceID. -func SeedAggregator( - agg *status.Aggregator, - instanceIDs []*componentstatus.InstanceID, - statuses ...componentstatus.Status, -) { - for _, st := range statuses { - for _, id := range instanceIDs { - agg.RecordStatus(id, componentstatus.NewEvent(st)) - } - } -} - func ErrPriority(config *common.ComponentHealthConfig) status.ErrorPriority { if config != nil && config.IncludeRecoverable && !config.IncludePermanent { return status.PriorityRecoverable diff --git a/pkg/status/Makefile b/pkg/status/Makefile new file mode 100644 index 000000000000..ded7a36092dc --- /dev/null +++ b/pkg/status/Makefile @@ -0,0 +1 @@ +include ../../Makefile.Common diff --git a/pkg/status/README.md b/pkg/status/README.md new file mode 100644 index 000000000000..6b0b4c3ed166 --- /dev/null +++ b/pkg/status/README.md @@ -0,0 +1,12 @@ +# pkg/status + +## Overview + +This module contains functionality for aggregating status information about components. Used by extensions that +implement the `extension.StatusWatcher` interface for collecting status information about the internal status of all +components inside the collector. + +### History + +`status` was originally developed for the `healthcheckv2extension`. Other extensions that need to collector status +information needed to use this same implementation to aggregate status information. diff --git a/extension/healthcheckv2extension/internal/status/aggregation.go b/pkg/status/aggregation.go similarity index 98% rename from extension/healthcheckv2extension/internal/status/aggregation.go rename to pkg/status/aggregation.go index 072b55565e7e..c1af5a4c0c7d 100644 --- a/extension/healthcheckv2extension/internal/status/aggregation.go +++ b/pkg/status/aggregation.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package status // import "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" +package status // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" import ( "time" diff --git a/extension/healthcheckv2extension/internal/status/aggregation_test.go b/pkg/status/aggregation_test.go similarity index 100% rename from extension/healthcheckv2extension/internal/status/aggregation_test.go rename to pkg/status/aggregation_test.go diff --git a/extension/healthcheckv2extension/internal/status/aggregator.go b/pkg/status/aggregator.go similarity index 99% rename from extension/healthcheckv2extension/internal/status/aggregator.go rename to pkg/status/aggregator.go index 7a80717e0682..13193876055d 100644 --- a/extension/healthcheckv2extension/internal/status/aggregator.go +++ b/pkg/status/aggregator.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package status // import "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" +package status // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" import ( "container/list" diff --git a/extension/healthcheckv2extension/internal/status/aggregator_test.go b/pkg/status/aggregator_test.go similarity index 98% rename from extension/healthcheckv2extension/internal/status/aggregator_test.go rename to pkg/status/aggregator_test.go index d099588c56b2..255c3c1f3dff 100644 --- a/extension/healthcheckv2extension/internal/status/aggregator_test.go +++ b/pkg/status/aggregator_test.go @@ -14,8 +14,8 @@ import ( "go.opentelemetry.io/collector/component/componentstatus" "go.opentelemetry.io/collector/pipeline" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" - "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/testhelpers" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status/testhelpers" ) func TestAggregateStatus(t *testing.T) { diff --git a/pkg/status/go.mod b/pkg/status/go.mod new file mode 100644 index 000000000000..a2341e72e49e --- /dev/null +++ b/pkg/status/go.mod @@ -0,0 +1,32 @@ +module github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status + +go 1.22.0 + +require ( + github.com/stretchr/testify v1.9.0 + go.opentelemetry.io/collector/component v0.111.0 + go.opentelemetry.io/collector/component/componentstatus v0.111.0 + go.opentelemetry.io/collector/pipeline v0.111.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/pmezard/go-difflib v1.0.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.111.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.111.0 // indirect + go.opentelemetry.io/collector/pdata v1.17.0 // indirect + go.opentelemetry.io/otel v1.30.0 // indirect + go.opentelemetry.io/otel/metric v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.30.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.27.0 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.17.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/grpc v1.67.1 // indirect + google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/pkg/status/go.sum b/pkg/status/go.sum new file mode 100644 index 000000000000..a1baa04a2079 --- /dev/null +++ b/pkg/status/go.sum @@ -0,0 +1,90 @@ +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/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/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +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/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/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/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.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.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/component v0.111.0 h1:AiDIrhkq6sbHnU9Rhq6t4DC4Gal43bryd1+NTJNojAQ= +go.opentelemetry.io/collector/component v0.111.0/go.mod h1:wYwbRuhzK5bm5x1bX+ukm1tT50QXYLs4MKwzyfiVGoE= +go.opentelemetry.io/collector/component/componentstatus v0.111.0 h1:DojO8TbkysTtEoxzN6fJqhgCsu0QhxgJ9R+1bitnowM= +go.opentelemetry.io/collector/component/componentstatus v0.111.0/go.mod h1:wKozN6s9dykUB9aLSBXSPT9SJ2fckNvGSFZx4fRZbSY= +go.opentelemetry.io/collector/config/configtelemetry v0.111.0 h1:Q3TJRM2A3FIDjIvzWa3uFArsdFN0I/0GzcWynHjC+oY= +go.opentelemetry.io/collector/config/configtelemetry v0.111.0/go.mod h1:R0MBUxjSMVMIhljuDHWIygzzJWQyZHXXWIgQNxcFwhc= +go.opentelemetry.io/collector/internal/globalsignal v0.111.0 h1:oq0nSD+7K2Q1Fx5d3s6lPRdKZeTL0FEg4sIaR7ZJzIc= +go.opentelemetry.io/collector/internal/globalsignal v0.111.0/go.mod h1:GqMXodPWOxK5uqpX8MaMXC2389y2XJTa5nPwf8FYDK8= +go.opentelemetry.io/collector/pdata v1.17.0 h1:z8cjjT2FThAehWu5fbF48OnZyK5q8xd1UhC4XszDo0w= +go.opentelemetry.io/collector/pdata v1.17.0/go.mod h1:yZaQ9KZAm/qie96LTygRKxOXMq0/54h8OW7330ycuvQ= +go.opentelemetry.io/collector/pipeline v0.111.0 h1:qENDGvWWnDXguEfmj8eO+5kr8Y6XFKytU5SuMinz3Ls= +go.opentelemetry.io/collector/pipeline v0.111.0/go.mod h1:ZZMU3019geEU283rTW5M/LkcqLqHp/YI2Nl6/Vp68PQ= +go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= +go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= +go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= +go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= +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.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +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.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.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.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +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-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +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.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +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/extension/healthcheckv2extension/internal/status/package_test.go b/pkg/status/package_test.go similarity index 77% rename from extension/healthcheckv2extension/internal/status/package_test.go rename to pkg/status/package_test.go index 312e32157c05..c7a4d67bd4a8 100644 --- a/extension/healthcheckv2extension/internal/status/package_test.go +++ b/pkg/status/package_test.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package status // import "github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckv2extension/internal/status" +package status // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" import ( "testing" diff --git a/pkg/status/testhelpers/helpers.go b/pkg/status/testhelpers/helpers.go new file mode 100644 index 000000000000..cb5ef286734a --- /dev/null +++ b/pkg/status/testhelpers/helpers.go @@ -0,0 +1,59 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package testhelpers // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status/testhelpers" + +import ( + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componentstatus" + "go.opentelemetry.io/collector/pipeline" + + "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" +) + +// PipelineMetadata groups together component and instance IDs for a hypothetical pipeline used +// for testing purposes. +type PipelineMetadata struct { + PipelineID pipeline.ID + ReceiverID *componentstatus.InstanceID + ProcessorID *componentstatus.InstanceID + ExporterID *componentstatus.InstanceID +} + +// InstanceIDs returns a slice of instanceIDs for components within the hypothetical pipeline. +func (p *PipelineMetadata) InstanceIDs() []*componentstatus.InstanceID { + return []*componentstatus.InstanceID{p.ReceiverID, p.ProcessorID, p.ExporterID} +} + +// NewPipelineMetadata returns a metadata for a hypothetical pipeline. +func NewPipelineMetadata(typestr string) *PipelineMetadata { + pipelineID := pipeline.MustNewID(typestr) + return &PipelineMetadata{ + PipelineID: pipelineID, + ReceiverID: componentstatus.NewInstanceID(component.NewIDWithName(component.MustNewType(typestr), "in"), component.KindReceiver).WithPipelines(pipelineID), + ProcessorID: componentstatus.NewInstanceID(component.MustNewID("batch"), component.KindProcessor).WithPipelines(pipelineID), + ExporterID: componentstatus.NewInstanceID(component.NewIDWithName(component.MustNewType(typestr), "out"), component.KindExporter).WithPipelines(pipelineID), + } +} + +// NewPipelines returns a map of hypothetical pipelines identified by their stringified typeVal. +func NewPipelines(typestrs ...string) map[string]*PipelineMetadata { + result := make(map[string]*PipelineMetadata, len(typestrs)) + for _, typestr := range typestrs { + result[typestr] = NewPipelineMetadata(typestr) + } + return result +} + +// SeedAggregator records a status event for each instanceID. +func SeedAggregator( + agg *status.Aggregator, + instanceIDs []*componentstatus.InstanceID, + statuses ...componentstatus.Status, +) { + for _, st := range statuses { + for _, id := range instanceIDs { + agg.RecordStatus(id, componentstatus.NewEvent(st)) + } + } +} From 933c454065c30d00715a8faaefc248115ed09ca2 Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Mon, 7 Oct 2024 10:40:37 -0400 Subject: [PATCH 02/11] Add pkg/status to CODEOWNERS. --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 70a5e095cb32..f4a9d4b9b37f 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -156,6 +156,7 @@ pkg/resourcetotelemetry/ @open-teleme pkg/sampling/ @open-telemetry/collector-contrib-approvers @kentquirk @jmacd pkg/stanza/ @open-telemetry/collector-contrib-approvers @djaglowski pkg/stanza/fileconsumer/ @open-telemetry/collector-contrib-approvers @djaglowski +pkg/status/ @open-telemetry/collector-contrib-approvers @jpkrohling @mwear pkg/translator/azure/ @open-telemetry/collector-contrib-approvers @open-telemetry/collector-approvers @atoulme @cparkins pkg/translator/azurelogs/ @open-telemetry/collector-contrib-approvers @atoulme @cparkins @MikeGoldsmith pkg/translator/jaeger/ @open-telemetry/collector-contrib-approvers @open-telemetry/collector-approvers @frzifus From d88073246e2f8821b7519f3c99fabbe2d4a5b76c Mon Sep 17 00:00:00 2001 From: Matthew Wear Date: Mon, 7 Oct 2024 15:57:56 -0700 Subject: [PATCH 03/11] Versons, builder config, and metadata --- cmd/otelcontribcol/builder-config.yaml | 1 + pkg/status/metadata.yml | 3 +++ versions.yaml | 1 + 3 files changed, 5 insertions(+) create mode 100644 pkg/status/metadata.yml diff --git a/cmd/otelcontribcol/builder-config.yaml b/cmd/otelcontribcol/builder-config.yaml index 97c311a10817..9dcc6cc77991 100644 --- a/cmd/otelcontribcol/builder-config.yaml +++ b/cmd/otelcontribcol/builder-config.yaml @@ -496,3 +496,4 @@ replaces: - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/githubreceiver => ../../receiver/githubreceiver - github.com/open-telemetry/opentelemetry-collector-contrib/internal/grpcutil => ../../internal/grpcutil - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/googlecloudmonitoringreceiver => ../../receiver/googlecloudmonitoringreceiver + - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status => ../../pkg/status diff --git a/pkg/status/metadata.yml b/pkg/status/metadata.yml new file mode 100644 index 000000000000..639f5e51dd69 --- /dev/null +++ b/pkg/status/metadata.yml @@ -0,0 +1,3 @@ +status: + codeowners: + active: [jpkrohling, mwear] diff --git a/versions.yaml b/versions.yaml index 974edb7119d5..4e2b89d12da0 100644 --- a/versions.yaml +++ b/versions.yaml @@ -149,6 +149,7 @@ module-sets: - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/sampling - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog + - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/azure - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/azurelogs - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger From 3bfaf24472712773cec2be3e985bc12bc01ad511 Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Tue, 8 Oct 2024 10:21:03 -0400 Subject: [PATCH 04/11] Update pkg/status/README.md Co-authored-by: Matthew Wear --- pkg/status/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/status/README.md b/pkg/status/README.md index 6b0b4c3ed166..4566264eeed2 100644 --- a/pkg/status/README.md +++ b/pkg/status/README.md @@ -3,7 +3,7 @@ ## Overview This module contains functionality for aggregating status information about components. Used by extensions that -implement the `extension.StatusWatcher` interface for collecting status information about the internal status of all +implement the `componentstatus.Watcher` interface for collecting status information about the internal status of all components inside the collector. ### History From 1dd28a40c5aba9b0dd6be9e9f04243b99bdc50c4 Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Tue, 8 Oct 2024 13:12:43 -0400 Subject: [PATCH 05/11] Add changelog. --- .chloggen/pkg-status.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .chloggen/pkg-status.yaml diff --git a/.chloggen/pkg-status.yaml b/.chloggen/pkg-status.yaml new file mode 100644 index 000000000000..4979f2953e11 --- /dev/null +++ b/.chloggen/pkg-status.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: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: healthcheckv2extension + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Refactors the extension/healthcheckv2extension/internal/status into pkg/status + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [34692] + +# (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: [api] From 66bdb104f9e38f01301d9cf8ed5aa18933cbd0f0 Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Wed, 9 Oct 2024 10:41:32 -0400 Subject: [PATCH 06/11] Update changelog and metadta. --- .chloggen/pkg-status.yaml | 4 ++-- pkg/status/README.md | 3 +++ pkg/status/metadata.yml | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.chloggen/pkg-status.yaml b/.chloggen/pkg-status.yaml index 4979f2953e11..0e3a45ceb50d 100644 --- a/.chloggen/pkg-status.yaml +++ b/.chloggen/pkg-status.yaml @@ -1,10 +1,10 @@ # Use this changelog template to create an entry for release notes. # One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: enhancement +change_type: new_component # The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) -component: healthcheckv2extension +component: pkg/status # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). note: Refactors the extension/healthcheckv2extension/internal/status into pkg/status diff --git a/pkg/status/README.md b/pkg/status/README.md index 4566264eeed2..e2a5ff89f3c5 100644 --- a/pkg/status/README.md +++ b/pkg/status/README.md @@ -1,5 +1,8 @@ # pkg/status + + + ## Overview This module contains functionality for aggregating status information about components. Used by extensions that diff --git a/pkg/status/metadata.yml b/pkg/status/metadata.yml index 639f5e51dd69..550c26835ea8 100644 --- a/pkg/status/metadata.yml +++ b/pkg/status/metadata.yml @@ -1,3 +1,6 @@ status: + class: pkg + stability: + development: [ extension ] codeowners: active: [jpkrohling, mwear] From 6f4145183c15682b389f69f706ee8cc7a66b8783 Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Wed, 9 Oct 2024 11:14:13 -0400 Subject: [PATCH 07/11] Update pkg/status go.mod. --- pkg/status/go.mod | 12 ++++++------ pkg/status/go.sum | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pkg/status/go.mod b/pkg/status/go.mod index a2341e72e49e..a4ec960949d0 100644 --- a/pkg/status/go.mod +++ b/pkg/status/go.mod @@ -4,9 +4,9 @@ go 1.22.0 require ( github.com/stretchr/testify v1.9.0 - go.opentelemetry.io/collector/component v0.111.0 - go.opentelemetry.io/collector/component/componentstatus v0.111.0 - go.opentelemetry.io/collector/pipeline v0.111.0 + go.opentelemetry.io/collector/component v0.111.1-0.20241008154146-ea48c09c31ae + go.opentelemetry.io/collector/component/componentstatus v0.111.1-0.20241008154146-ea48c09c31ae + go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae go.uber.org/goleak v1.3.0 ) @@ -14,9 +14,9 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/collector/config/configtelemetry v0.111.0 // indirect + go.opentelemetry.io/collector/config/configtelemetry v0.111.1-0.20241008154146-ea48c09c31ae // indirect go.opentelemetry.io/collector/internal/globalsignal v0.111.0 // indirect - go.opentelemetry.io/collector/pdata v1.17.0 // indirect + go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect go.opentelemetry.io/otel/trace v1.30.0 // indirect @@ -27,6 +27,6 @@ require ( golang.org/x/text v0.17.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect google.golang.org/grpc v1.67.1 // indirect - google.golang.org/protobuf v1.34.2 // indirect + google.golang.org/protobuf v1.35.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/status/go.sum b/pkg/status/go.sum index a1baa04a2079..7fc94ca2abe7 100644 --- a/pkg/status/go.sum +++ b/pkg/status/go.sum @@ -22,18 +22,18 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.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/component v0.111.0 h1:AiDIrhkq6sbHnU9Rhq6t4DC4Gal43bryd1+NTJNojAQ= -go.opentelemetry.io/collector/component v0.111.0/go.mod h1:wYwbRuhzK5bm5x1bX+ukm1tT50QXYLs4MKwzyfiVGoE= -go.opentelemetry.io/collector/component/componentstatus v0.111.0 h1:DojO8TbkysTtEoxzN6fJqhgCsu0QhxgJ9R+1bitnowM= -go.opentelemetry.io/collector/component/componentstatus v0.111.0/go.mod h1:wKozN6s9dykUB9aLSBXSPT9SJ2fckNvGSFZx4fRZbSY= -go.opentelemetry.io/collector/config/configtelemetry v0.111.0 h1:Q3TJRM2A3FIDjIvzWa3uFArsdFN0I/0GzcWynHjC+oY= -go.opentelemetry.io/collector/config/configtelemetry v0.111.0/go.mod h1:R0MBUxjSMVMIhljuDHWIygzzJWQyZHXXWIgQNxcFwhc= +go.opentelemetry.io/collector/component v0.111.1-0.20241008154146-ea48c09c31ae h1:dXAMqXGJp1vWG7qwS/2sjIyJgmyOSfEOm6Gcmkzp1cQ= +go.opentelemetry.io/collector/component v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:iWUfPxpVwZhkI4v3/Gh5wt4iKyJn4lriPFAug8iLXno= +go.opentelemetry.io/collector/component/componentstatus v0.111.1-0.20241008154146-ea48c09c31ae h1:BVTz/s8fmI5UA4Q6zAndl0Pds4RrkhxEXkx9TMelleM= +go.opentelemetry.io/collector/component/componentstatus v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:fwY2NdXkOw07ObusogFZChVyyvqXqCJBlGaWwwDJAtI= +go.opentelemetry.io/collector/config/configtelemetry v0.111.1-0.20241008154146-ea48c09c31ae h1:NmNYRBSP+IUK9CsU1Q/1eS/tXmYTPMYxmGQsxEprq/s= +go.opentelemetry.io/collector/config/configtelemetry v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:R0MBUxjSMVMIhljuDHWIygzzJWQyZHXXWIgQNxcFwhc= go.opentelemetry.io/collector/internal/globalsignal v0.111.0 h1:oq0nSD+7K2Q1Fx5d3s6lPRdKZeTL0FEg4sIaR7ZJzIc= go.opentelemetry.io/collector/internal/globalsignal v0.111.0/go.mod h1:GqMXodPWOxK5uqpX8MaMXC2389y2XJTa5nPwf8FYDK8= -go.opentelemetry.io/collector/pdata v1.17.0 h1:z8cjjT2FThAehWu5fbF48OnZyK5q8xd1UhC4XszDo0w= -go.opentelemetry.io/collector/pdata v1.17.0/go.mod h1:yZaQ9KZAm/qie96LTygRKxOXMq0/54h8OW7330ycuvQ= -go.opentelemetry.io/collector/pipeline v0.111.0 h1:qENDGvWWnDXguEfmj8eO+5kr8Y6XFKytU5SuMinz3Ls= -go.opentelemetry.io/collector/pipeline v0.111.0/go.mod h1:ZZMU3019geEU283rTW5M/LkcqLqHp/YI2Nl6/Vp68PQ= +go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae h1:PcwZe1RD8tC4SZExhf0f5HqK+ZuWGsowHaBBU4PiUv0= +go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae/go.mod h1:Ox1YVLe87cZDB/TL30i4SUz1cA5s6AM6SpFMfY61ICs= +go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae h1:/NNb1rBd/Y42FzIjpLjlRSb7bPANHyI3/3DnPg5p50U= +go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:ZZMU3019geEU283rTW5M/LkcqLqHp/YI2Nl6/Vp68PQ= go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= @@ -81,8 +81,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= 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.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/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= From 59fd7147fa104cb2eae18e66dcd40f7bc8575c8d Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Wed, 9 Oct 2024 11:15:31 -0400 Subject: [PATCH 08/11] Update globalsignal. --- pkg/status/go.mod | 2 +- pkg/status/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/status/go.mod b/pkg/status/go.mod index a4ec960949d0..9239308b71bf 100644 --- a/pkg/status/go.mod +++ b/pkg/status/go.mod @@ -15,7 +15,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/collector/config/configtelemetry v0.111.1-0.20241008154146-ea48c09c31ae // indirect - go.opentelemetry.io/collector/internal/globalsignal v0.111.0 // indirect + go.opentelemetry.io/collector/internal/globalsignal v0.111.1-0.20241008154146-ea48c09c31ae // indirect go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae // indirect go.opentelemetry.io/otel v1.30.0 // indirect go.opentelemetry.io/otel/metric v1.30.0 // indirect diff --git a/pkg/status/go.sum b/pkg/status/go.sum index 7fc94ca2abe7..86d58b5023a7 100644 --- a/pkg/status/go.sum +++ b/pkg/status/go.sum @@ -28,8 +28,8 @@ go.opentelemetry.io/collector/component/componentstatus v0.111.1-0.2024100815414 go.opentelemetry.io/collector/component/componentstatus v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:fwY2NdXkOw07ObusogFZChVyyvqXqCJBlGaWwwDJAtI= go.opentelemetry.io/collector/config/configtelemetry v0.111.1-0.20241008154146-ea48c09c31ae h1:NmNYRBSP+IUK9CsU1Q/1eS/tXmYTPMYxmGQsxEprq/s= go.opentelemetry.io/collector/config/configtelemetry v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:R0MBUxjSMVMIhljuDHWIygzzJWQyZHXXWIgQNxcFwhc= -go.opentelemetry.io/collector/internal/globalsignal v0.111.0 h1:oq0nSD+7K2Q1Fx5d3s6lPRdKZeTL0FEg4sIaR7ZJzIc= -go.opentelemetry.io/collector/internal/globalsignal v0.111.0/go.mod h1:GqMXodPWOxK5uqpX8MaMXC2389y2XJTa5nPwf8FYDK8= +go.opentelemetry.io/collector/internal/globalsignal v0.111.1-0.20241008154146-ea48c09c31ae h1:fublc0EO06p79/OWw2jWVPSPNBMiBcB+0QpLes587DU= +go.opentelemetry.io/collector/internal/globalsignal v0.111.1-0.20241008154146-ea48c09c31ae/go.mod h1:GqMXodPWOxK5uqpX8MaMXC2389y2XJTa5nPwf8FYDK8= go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae h1:PcwZe1RD8tC4SZExhf0f5HqK+ZuWGsowHaBBU4PiUv0= go.opentelemetry.io/collector/pdata v1.17.1-0.20241008154146-ea48c09c31ae/go.mod h1:Ox1YVLe87cZDB/TL30i4SUz1cA5s6AM6SpFMfY61ICs= go.opentelemetry.io/collector/pipeline v0.111.1-0.20241008154146-ea48c09c31ae h1:/NNb1rBd/Y42FzIjpLjlRSb7bPANHyI3/3DnPg5p50U= From a0b822c8eb326b52a3ea7bad7a197adea3ee7c3f Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Wed, 9 Oct 2024 16:25:51 -0400 Subject: [PATCH 09/11] Fix generate. --- pkg/status/README.md | 7 +++++++ pkg/status/{package_test.go => doc.go} | 12 ++---------- pkg/status/generated_package_test.go | 13 +++++++++++++ pkg/status/{metadata.yml => metadata.yaml} | 4 +++- 4 files changed, 25 insertions(+), 11 deletions(-) rename pkg/status/{package_test.go => doc.go} (62%) create mode 100644 pkg/status/generated_package_test.go rename pkg/status/{metadata.yml => metadata.yaml} (65%) diff --git a/pkg/status/README.md b/pkg/status/README.md index e2a5ff89f3c5..f721cfc8ff5b 100644 --- a/pkg/status/README.md +++ b/pkg/status/README.md @@ -1,6 +1,13 @@ # pkg/status +| Status | | +| ------------- |-----------| +| Stability | [development]: extension | +| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Apkg%2Fstatus%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Apkg%2Fstatus) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Apkg%2Fstatus%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Apkg%2Fstatus) | +| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@jpkrohling](https://www.github.com/jpkrohling), [@mwear](https://www.github.com/mwear) | + +[development]: https://github.com/open-telemetry/opentelemetry-collector#development ## Overview diff --git a/pkg/status/package_test.go b/pkg/status/doc.go similarity index 62% rename from pkg/status/package_test.go rename to pkg/status/doc.go index c7a4d67bd4a8..0f73d96762c5 100644 --- a/pkg/status/package_test.go +++ b/pkg/status/doc.go @@ -1,14 +1,6 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package status // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" - -import ( - "testing" +//go:generate mdatagen metadata.yaml - "go.uber.org/goleak" -) - -func TestMain(m *testing.M) { - goleak.VerifyTestMain(m) -} +package status // import "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status" diff --git a/pkg/status/generated_package_test.go b/pkg/status/generated_package_test.go new file mode 100644 index 000000000000..015146739dba --- /dev/null +++ b/pkg/status/generated_package_test.go @@ -0,0 +1,13 @@ +// Code generated by mdatagen. DO NOT EDIT. + +package status + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} diff --git a/pkg/status/metadata.yml b/pkg/status/metadata.yaml similarity index 65% rename from pkg/status/metadata.yml rename to pkg/status/metadata.yaml index 550c26835ea8..dea0fc8ce9ef 100644 --- a/pkg/status/metadata.yml +++ b/pkg/status/metadata.yaml @@ -1,6 +1,8 @@ +type: status + status: class: pkg stability: - development: [ extension ] + development: [extension] codeowners: active: [jpkrohling, mwear] From 106f91519f5d6bf741b8ee421f6f4c7bc2481f1d Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Wed, 9 Oct 2024 19:48:35 -0400 Subject: [PATCH 10/11] Run make generate-gh-issue-templates. --- .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 + 4 files changed, 4 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index b705cbecfb53..ad131c35f7f5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -152,6 +152,7 @@ body: - pkg/sampling - pkg/stanza - pkg/stanza/fileconsumer + - pkg/status - pkg/translator/azure - pkg/translator/azurelogs - pkg/translator/jaeger diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml index 8ec681fa0a67..f3469039b91b 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yaml +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -146,6 +146,7 @@ body: - pkg/sampling - pkg/stanza - pkg/stanza/fileconsumer + - pkg/status - pkg/translator/azure - pkg/translator/azurelogs - pkg/translator/jaeger diff --git a/.github/ISSUE_TEMPLATE/other.yaml b/.github/ISSUE_TEMPLATE/other.yaml index b0098510b798..4ab292407473 100644 --- a/.github/ISSUE_TEMPLATE/other.yaml +++ b/.github/ISSUE_TEMPLATE/other.yaml @@ -146,6 +146,7 @@ body: - pkg/sampling - pkg/stanza - pkg/stanza/fileconsumer + - pkg/status - pkg/translator/azure - pkg/translator/azurelogs - pkg/translator/jaeger diff --git a/.github/ISSUE_TEMPLATE/unmaintained.yaml b/.github/ISSUE_TEMPLATE/unmaintained.yaml index df65436ba755..dd4fe6fa52d5 100644 --- a/.github/ISSUE_TEMPLATE/unmaintained.yaml +++ b/.github/ISSUE_TEMPLATE/unmaintained.yaml @@ -151,6 +151,7 @@ body: - pkg/sampling - pkg/stanza - pkg/stanza/fileconsumer + - pkg/status - pkg/translator/azure - pkg/translator/azurelogs - pkg/translator/jaeger From c10318e29daf2a25260e456c12c2d7afd4926e52 Mon Sep 17 00:00:00 2001 From: Blake Rouse Date: Thu, 10 Oct 2024 09:33:43 -0400 Subject: [PATCH 11/11] Update README.md. --- pkg/status/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/status/README.md b/pkg/status/README.md index f721cfc8ff5b..eb65edbe7516 100644 --- a/pkg/status/README.md +++ b/pkg/status/README.md @@ -18,5 +18,6 @@ components inside the collector. ### History -`status` was originally developed for the `healthcheckv2extension`. Other extensions that need to collector status -information needed to use this same implementation to aggregate status information. +`pkg/status` was originally developed for the `healthcheckv2extension`. It provided a generic way of aggregating +status information for components. Other extensions that need to implement the `componentstatus.Watcher` can now use +the same implementation `healthcheckv2extension` uses.