File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ func RegisterSource(src DataSource) error {
9797 return defaultDataSources .Register (src )
9898}
9999
100- // GetNamedSourceTyped returns a typed data source from the default registry.
100+ // GetNamedSource returns a typed data source from the default registry.
101101func GetNamedSource [T DataSource ](name string ) (T , bool ) {
102102 v , ok := defaultDataSources .GetNamedSource (name )
103103 if ! ok {
Original file line number Diff line number Diff line change @@ -58,18 +58,13 @@ type EndpointLifecycle struct {
5858}
5959
6060// NewEndpointFactory returns a new endpoint for factory, managing collectors for
61- // its endpoints.
62- // Sources might not be known at creation time (e.g., loaded from configuration
63- // file), so they're not passed at this point.
61+ // its endpoints. This function assumes that sources are not modified afterwards.
6462func NewEndpointFactory (sources []DataSource , refreshMetricsInterval time.Duration ) * EndpointLifecycle {
65- lc := & EndpointLifecycle {
66- sources : make ([] DataSource , len ( sources )) ,
63+ return & EndpointLifecycle {
64+ sources : sources ,
6765 collectors : sync.Map {},
6866 refreshInterval : refreshMetricsInterval ,
6967 }
70- _ = copy (lc .sources , sources )
71-
72- return lc
7368}
7469
7570// NewEndpoint implements EndpointFactory.NewEndpoint.
You can’t perform that action at this time.
0 commit comments