| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
package extensions |
| 5 |
|
| 6 |
import ( |
| 7 |
"context" |
| 8 |
"errors" |
| 9 |
"slices" |
| 10 |
"testing" |
| 11 |
|
| 12 |
"github.com/stretchr/testify/assert" |
| 13 |
"github.com/stretchr/testify/require" |
| 14 |
|
| 15 |
"go.opentelemetry.io/collector/component" |
| 16 |
"go.opentelemetry.io/collector/component/componentstatus" |
| 17 |
"go.opentelemetry.io/collector/component/componenttest" |
| 18 |
"go.opentelemetry.io/collector/confmap" |
| 19 |
"go.opentelemetry.io/collector/extension" |
| 20 |
"go.opentelemetry.io/collector/extension/extensioncapabilities" |
| 21 |
"go.opentelemetry.io/collector/extension/extensiontest" |
| 22 |
"go.opentelemetry.io/collector/service/internal/builders" |
| 23 |
"go.opentelemetry.io/collector/service/internal/status" |
| 24 |
) |
| 25 |
|
| 26 |
func TestBuildExtensions(t *testing.T) { |
| 27 |
nopExtensionFactory := extensiontest.NewNopFactory() |
| 28 |
nopExtensionConfig := nopExtensionFactory.CreateDefaultConfig() |
| 29 |
errExtensionFactory := newCreateErrorExtensionFactory() |
| 30 |
errExtensionConfig := errExtensionFactory.CreateDefaultConfig() |
| 31 |
badExtensionFactory := newBadExtensionFactory() |
| 32 |
badExtensionCfg := badExtensionFactory.CreateDefaultConfig() |
| 33 |
|
| 34 |
tests := []struct { |
| 35 |
name string |
| 36 |
factories map[component.Type]extension.Factory |
| 37 |
extensionsConfigs map[component.ID]component.Config |
| 38 |
config Config |
| 39 |
wantErrMsg string |
| 40 |
}{ |
| 41 |
{ |
| 42 |
name: "extension_not_configured", |
| 43 |
config: Config{ |
| 44 |
component.MustNewID("myextension"), |
| 45 |
}, |
| 46 |
wantErrMsg: "failed to create extension \"myextension\": extension \"myextension\" is not configured", |
| 47 |
}, |
| 48 |
{ |
| 49 |
name: "missing_extension_factory", |
| 50 |
extensionsConfigs: map[component.ID]component.Config{ |
| 51 |
component.MustNewID("unknown"): nopExtensionConfig, |
| 52 |
}, |
| 53 |
config: Config{ |
| 54 |
component.MustNewID("unknown"), |
| 55 |
}, |
| 56 |
wantErrMsg: "failed to create extension \"unknown\": extension factory not available for: \"unknown\"", |
| 57 |
}, |
| 58 |
{ |
| 59 |
name: "error_on_create_extension", |
| 60 |
factories: map[component.Type]extension.Factory{ |
| 61 |
errExtensionFactory.Type(): errExtensionFactory, |
| 62 |
}, |
| 63 |
extensionsConfigs: map[component.ID]component.Config{ |
| 64 |
component.NewID(errExtensionFactory.Type()): errExtensionConfig, |
| 65 |
}, |
| 66 |
config: Config{ |
| 67 |
component.NewID(errExtensionFactory.Type()), |
| 68 |
}, |
| 69 |
wantErrMsg: "failed to create extension \"err\": cannot create \"err\" extension type", |
| 70 |
}, |
| 71 |
{ |
| 72 |
name: "bad_factory", |
| 73 |
factories: map[component.Type]extension.Factory{ |
| 74 |
badExtensionFactory.Type(): badExtensionFactory, |
| 75 |
}, |
| 76 |
extensionsConfigs: map[component.ID]component.Config{ |
| 77 |
component.NewID(badExtensionFactory.Type()): badExtensionCfg, |
| 78 |
}, |
| 79 |
config: Config{ |
| 80 |
component.NewID(badExtensionFactory.Type()), |
| 81 |
}, |
| 82 |
wantErrMsg: "factory for \"bf\" produced a nil extension", |
| 83 |
}, |
| 84 |
} |
| 85 |
|
| 86 |
for _, tt := range tests { |
| 87 |
t.Run(tt.name, func(t *testing.T) { |
| 88 |
_, err := New(context.Background(), Settings{ |
| 89 |
Telemetry: componenttest.NewNopTelemetrySettings(), |
| 90 |
BuildInfo: component.NewDefaultBuildInfo(), |
| 91 |
Extensions: builders.NewExtension(tt.extensionsConfigs, tt.factories), |
| 92 |
}, tt.config) |
| 93 |
require.Error(t, err) |
| 94 |
assert.EqualError(t, err, tt.wantErrMsg) |
| 95 |
}) |
| 96 |
} |
| 97 |
} |
| 98 |
|
| 99 |
type testOrderExt struct { |
| 100 |
name string |
| 101 |
deps []string |
| 102 |
} |
| 103 |
|
| 104 |
type testOrderCase struct { |
| 105 |
testName string |
| 106 |
extensions []testOrderExt |
| 107 |
order []string |
| 108 |
err string |
| 109 |
} |
| 110 |
|
| 111 |
func TestOrdering(t *testing.T) { |
| 112 |
tests := []testOrderCase{ |
| 113 |
{ |
| 114 |
testName: "no_deps", |
| 115 |
extensions: []testOrderExt{{name: ""}, {name: "foo"}, {name: "bar"}}, |
| 116 |
order: nil, // no predictable order |
| 117 |
}, |
| 118 |
{ |
| 119 |
testName: "deps", |
| 120 |
extensions: []testOrderExt{ |
| 121 |
{name: "foo", deps: []string{"bar"}}, // foo -> bar |
| 122 |
{name: "baz", deps: []string{"foo"}}, // baz -> foo |
| 123 |
{name: "bar"}, |
| 124 |
}, |
| 125 |
// baz -> foo -> bar |
| 126 |
order: []string{"recording/bar", "recording/foo", "recording/baz"}, |
| 127 |
}, |
| 128 |
{ |
| 129 |
testName: "deps_double", |
| 130 |
extensions: []testOrderExt{ |
| 131 |
{name: "foo", deps: []string{"bar"}}, // foo -> bar |
| 132 |
{name: "baz", deps: []string{"foo", "bar"}}, // baz -> {foo, bar} |
| 133 |
{name: "bar"}, |
| 134 |
}, |
| 135 |
// baz -> foo -> bar |
| 136 |
order: []string{"recording/bar", "recording/foo", "recording/baz"}, |
| 137 |
}, |
| 138 |
{ |
| 139 |
testName: "unknown_dep", |
| 140 |
extensions: []testOrderExt{ |
| 141 |
{name: "foo", deps: []string{"BAZ"}}, |
| 142 |
{name: "bar"}, |
| 143 |
}, |
| 144 |
err: "unable to find extension", |
| 145 |
}, |
| 146 |
{ |
| 147 |
testName: "circular", |
| 148 |
extensions: []testOrderExt{ |
| 149 |
{name: "foo", deps: []string{"bar"}}, |
| 150 |
{name: "bar", deps: []string{"foo"}}, |
| 151 |
}, |
| 152 |
err: "unable to order extensions", |
| 153 |
}, |
| 154 |
} |
| 155 |
for _, testCase := range tests { |
| 156 |
t.Run(testCase.testName, testCase.testOrdering) |
| 157 |
} |
| 158 |
} |
| 159 |
|
| 160 |
func (tc testOrderCase) testOrdering(t *testing.T) { |
| 161 |
var startOrder []string |
| 162 |
var shutdownOrder []string |
| 163 |
|
| 164 |
recordingExtensionFactory := newRecordingExtensionFactory(func(set extension.Settings, _ component.Host) error { |
| 165 |
startOrder = append(startOrder, set.ID.String()) |
| 166 |
return nil |
| 167 |
}, func(set extension.Settings) error { |
| 168 |
shutdownOrder = append(shutdownOrder, set.ID.String()) |
| 169 |
return nil |
| 170 |
}) |
| 171 |
|
| 172 |
extCfgs := make(map[component.ID]component.Config) |
| 173 |
extIDs := make([]component.ID, len(tc.extensions)) |
| 174 |
for i, ext := range tc.extensions { |
| 175 |
extID := component.NewIDWithName(recordingExtensionFactory.Type(), ext.name) |
| 176 |
extIDs[i] = extID |
| 177 |
extCfgs[extID] = recordingExtensionConfig{dependencies: ext.deps} |
| 178 |
} |
| 179 |
|
| 180 |
exts, err := New(context.Background(), Settings{ |
| 181 |
Telemetry: componenttest.NewNopTelemetrySettings(), |
| 182 |
BuildInfo: component.NewDefaultBuildInfo(), |
| 183 |
Extensions: builders.NewExtension( |
| 184 |
extCfgs, |
| 185 |
map[component.Type]extension.Factory{ |
| 186 |
recordingExtensionFactory.Type(): recordingExtensionFactory, |
| 187 |
}), |
| 188 |
}, Config(extIDs)) |
| 189 |
if tc.err != "" { |
| 190 |
require.ErrorContains(t, err, tc.err) |
| 191 |
return |
| 192 |
} |
| 193 |
require.NoError(t, err) |
| 194 |
|
| 195 |
err = exts.Start(context.Background(), componenttest.NewNopHost()) |
| 196 |
require.NoError(t, err) |
| 197 |
err = exts.Shutdown(context.Background()) |
| 198 |
require.NoError(t, err) |
| 199 |
|
| 200 |
if len(tc.order) > 0 { |
| 201 |
require.Equal(t, tc.order, startOrder) |
| 202 |
slices.Reverse(shutdownOrder) |
| 203 |
require.Equal(t, tc.order, shutdownOrder) |
| 204 |
} |
| 205 |
} |
| 206 |
|
| 207 |
func TestNotifyConfig(t *testing.T) { |
| 208 |
notificationError := errors.New("Error processing config") |
| 209 |
nopExtensionFactory := extensiontest.NewNopFactory() |
| 210 |
nopExtensionConfig := nopExtensionFactory.CreateDefaultConfig() |
| 211 |
n1ExtensionFactory := newConfigWatcherExtensionFactory(component.MustNewType("notifiable1"), func() error { return nil }) |
| 212 |
n1ExtensionConfig := n1ExtensionFactory.CreateDefaultConfig() |
| 213 |
n2ExtensionFactory := newConfigWatcherExtensionFactory(component.MustNewType("notifiable2"), func() error { return nil }) |
| 214 |
n2ExtensionConfig := n1ExtensionFactory.CreateDefaultConfig() |
| 215 |
nErrExtensionFactory := newConfigWatcherExtensionFactory(component.MustNewType("notifiableErr"), func() error { return notificationError }) |
| 216 |
nErrExtensionConfig := nErrExtensionFactory.CreateDefaultConfig() |
| 217 |
|
| 218 |
tests := []struct { |
| 219 |
name string |
| 220 |
factories map[component.Type]extension.Factory |
| 221 |
extensionsConfigs map[component.ID]component.Config |
| 222 |
serviceExtensions []component.ID |
| 223 |
wantErrMsg string |
| 224 |
want error |
| 225 |
}{ |
| 226 |
{ |
| 227 |
name: "No notifiable extensions", |
| 228 |
factories: map[component.Type]extension.Factory{ |
| 229 |
component.MustNewType("nop"): nopExtensionFactory, |
| 230 |
}, |
| 231 |
extensionsConfigs: map[component.ID]component.Config{ |
| 232 |
component.MustNewID("nop"): nopExtensionConfig, |
| 233 |
}, |
| 234 |
serviceExtensions: []component.ID{ |
| 235 |
component.MustNewID("nop"), |
| 236 |
}, |
| 237 |
}, |
| 238 |
{ |
| 239 |
name: "One notifiable extension", |
| 240 |
factories: map[component.Type]extension.Factory{ |
| 241 |
component.MustNewType("notifiable1"): n1ExtensionFactory, |
| 242 |
}, |
| 243 |
extensionsConfigs: map[component.ID]component.Config{ |
| 244 |
component.MustNewID("notifiable1"): n1ExtensionConfig, |
| 245 |
}, |
| 246 |
serviceExtensions: []component.ID{ |
| 247 |
component.MustNewID("notifiable1"), |
| 248 |
}, |
| 249 |
}, |
| 250 |
{ |
| 251 |
name: "Multiple notifiable extensions", |
| 252 |
factories: map[component.Type]extension.Factory{ |
| 253 |
component.MustNewType("notifiable1"): n1ExtensionFactory, |
| 254 |
component.MustNewType("notifiable2"): n2ExtensionFactory, |
| 255 |
}, |
| 256 |
extensionsConfigs: map[component.ID]component.Config{ |
| 257 |
component.MustNewID("notifiable1"): n1ExtensionConfig, |
| 258 |
component.MustNewID("notifiable2"): n2ExtensionConfig, |
| 259 |
}, |
| 260 |
serviceExtensions: []component.ID{ |
| 261 |
component.MustNewID("notifiable1"), |
| 262 |
component.MustNewID("notifiable2"), |
| 263 |
}, |
| 264 |
}, |
| 265 |
{ |
| 266 |
name: "Errors in extension notification", |
| 267 |
factories: map[component.Type]extension.Factory{ |
| 268 |
component.MustNewType("notifiableErr"): nErrExtensionFactory, |
| 269 |
}, |
| 270 |
extensionsConfigs: map[component.ID]component.Config{ |
| 271 |
component.MustNewID("notifiableErr"): nErrExtensionConfig, |
| 272 |
}, |
| 273 |
serviceExtensions: []component.ID{ |
| 274 |
component.MustNewID("notifiableErr"), |
| 275 |
}, |
| 276 |
want: notificationError, |
| 277 |
}, |
| 278 |
} |
| 279 |
|
| 280 |
for _, tt := range tests { |
| 281 |
t.Run(tt.name, func(t *testing.T) { |
| 282 |
extensions, err := New(context.Background(), Settings{ |
| 283 |
Telemetry: componenttest.NewNopTelemetrySettings(), |
| 284 |
BuildInfo: component.NewDefaultBuildInfo(), |
| 285 |
Extensions: builders.NewExtension(tt.extensionsConfigs, tt.factories), |
| 286 |
}, tt.serviceExtensions) |
| 287 |
require.NoError(t, err) |
| 288 |
errs := extensions.NotifyConfig(context.Background(), confmap.NewFromStringMap(map[string]any{})) |
| 289 |
assert.Equal(t, tt.want, errs) |
| 290 |
}) |
| 291 |
} |
| 292 |
} |
| 293 |
|
| 294 |
type configWatcherExtension struct { |
| 295 |
fn func() error |
| 296 |
} |
| 297 |
|
| 298 |
func (comp *configWatcherExtension) Start(context.Context, component.Host) error { |
| 299 |
return comp.fn() |
| 300 |
} |
| 301 |
|
| 302 |
func (comp *configWatcherExtension) Shutdown(context.Context) error { |
| 303 |
return comp.fn() |
| 304 |
} |
| 305 |
|
| 306 |
func (comp *configWatcherExtension) NotifyConfig(context.Context, *confmap.Conf) error { |
| 307 |
return comp.fn() |
| 308 |
} |
| 309 |
|
| 310 |
func newConfigWatcherExtension(fn func() error) *configWatcherExtension { |
| 311 |
comp := &configWatcherExtension{ |
| 312 |
fn: fn, |
| 313 |
} |
| 314 |
|
| 315 |
return comp |
| 316 |
} |
| 317 |
|
| 318 |
func newConfigWatcherExtensionFactory(name component.Type, fn func() error) extension.Factory { |
| 319 |
return extension.NewFactory( |
| 320 |
name, |
| 321 |
func() component.Config { |
| 322 |
return &struct{}{} |
| 323 |
}, |
| 324 |
func(context.Context, extension.Settings, component.Config) (extension.Extension, error) { |
| 325 |
return newConfigWatcherExtension(fn), nil |
| 326 |
}, |
| 327 |
component.StabilityLevelDevelopment, |
| 328 |
) |
| 329 |
} |
| 330 |
|
| 331 |
func newBadExtensionFactory() extension.Factory { |
| 332 |
return extension.NewFactory( |
| 333 |
component.MustNewType("bf"), |
| 334 |
func() component.Config { |
| 335 |
return &struct{}{} |
| 336 |
}, |
| 337 |
func(context.Context, extension.Settings, component.Config) (extension.Extension, error) { |
| 338 |
return nil, nil |
| 339 |
}, |
| 340 |
component.StabilityLevelDevelopment, |
| 341 |
) |
| 342 |
} |
| 343 |
|
| 344 |
func newCreateErrorExtensionFactory() extension.Factory { |
| 345 |
return extension.NewFactory( |
| 346 |
component.MustNewType("err"), |
| 347 |
func() component.Config { |
| 348 |
return &struct{}{} |
| 349 |
}, |
| 350 |
func(context.Context, extension.Settings, component.Config) (extension.Extension, error) { |
| 351 |
return nil, errors.New("cannot create \"err\" extension type") |
| 352 |
}, |
| 353 |
component.StabilityLevelDevelopment, |
| 354 |
) |
| 355 |
} |
| 356 |
|
| 357 |
func TestStatusReportedOnStartupShutdown(t *testing.T) { |
| 358 |
// compare two slices of status events ignoring timestamp |
| 359 |
assertEqualStatuses := func(t *testing.T, evts1, evts2 []*componentstatus.Event) { |
| 360 |
assert.Len(t, evts2, len(evts1)) |
| 361 |
for i := range evts1 { |
| 362 |
ev1 := evts1[i] |
| 363 |
ev2 := evts2[i] |
| 364 |
assert.Equal(t, ev1.Status(), ev2.Status()) |
| 365 |
assert.Equal(t, ev1.Err(), ev2.Err()) |
| 366 |
} |
| 367 |
} |
| 368 |
|
| 369 |
for _, tt := range []struct { |
| 370 |
name string |
| 371 |
expectedStatuses []*componentstatus.Event |
| 372 |
startErr error |
| 373 |
shutdownErr error |
| 374 |
}{ |
| 375 |
{ |
| 376 |
name: "successful startup/shutdown", |
| 377 |
expectedStatuses: []*componentstatus.Event{ |
| 378 |
componentstatus.NewEvent(componentstatus.StatusStarting), |
| 379 |
componentstatus.NewEvent(componentstatus.StatusOK), |
| 380 |
componentstatus.NewEvent(componentstatus.StatusStopping), |
| 381 |
componentstatus.NewEvent(componentstatus.StatusStopped), |
| 382 |
}, |
| 383 |
startErr: nil, |
| 384 |
shutdownErr: nil, |
| 385 |
}, |
| 386 |
{ |
| 387 |
name: "start error", |
| 388 |
expectedStatuses: []*componentstatus.Event{ |
| 389 |
componentstatus.NewEvent(componentstatus.StatusStarting), |
| 390 |
componentstatus.NewPermanentErrorEvent(assert.AnError), |
| 391 |
}, |
| 392 |
startErr: assert.AnError, |
| 393 |
shutdownErr: nil, |
| 394 |
}, |
| 395 |
{ |
| 396 |
name: "shutdown error", |
| 397 |
expectedStatuses: []*componentstatus.Event{ |
| 398 |
componentstatus.NewEvent(componentstatus.StatusStarting), |
| 399 |
componentstatus.NewEvent(componentstatus.StatusOK), |
| 400 |
componentstatus.NewEvent(componentstatus.StatusStopping), |
| 401 |
componentstatus.NewPermanentErrorEvent(assert.AnError), |
| 402 |
}, |
| 403 |
startErr: nil, |
| 404 |
shutdownErr: assert.AnError, |
| 405 |
}, |
| 406 |
} { |
| 407 |
t.Run(tt.name, func(t *testing.T) { |
| 408 |
statusType := component.MustNewType("statustest") |
| 409 |
compID := component.NewID(statusType) |
| 410 |
factory := newStatusTestExtensionFactory(statusType, tt.startErr, tt.shutdownErr) |
| 411 |
config := factory.CreateDefaultConfig() |
| 412 |
extensionsConfigs := map[component.ID]component.Config{ |
| 413 |
compID: config, |
| 414 |
} |
| 415 |
factories := map[component.Type]extension.Factory{ |
| 416 |
statusType: factory, |
| 417 |
} |
| 418 |
|
| 419 |
var actualStatuses []*componentstatus.Event |
| 420 |
rep := status.NewReporter(func(_ *componentstatus.InstanceID, ev *componentstatus.Event) { |
| 421 |
actualStatuses = append(actualStatuses, ev) |
| 422 |
}, func(err error) { |
| 423 |
require.NoError(t, err) |
| 424 |
}) |
| 425 |
|
| 426 |
extensions, err := New( |
| 427 |
context.Background(), |
| 428 |
Settings{ |
| 429 |
Telemetry: componenttest.NewNopTelemetrySettings(), |
| 430 |
BuildInfo: component.NewDefaultBuildInfo(), |
| 431 |
Extensions: builders.NewExtension(extensionsConfigs, factories), |
| 432 |
}, |
| 433 |
[]component.ID{compID}, |
| 434 |
WithReporter(rep), |
| 435 |
) |
| 436 |
require.NoError(t, err) |
| 437 |
|
| 438 |
assert.Equal(t, tt.startErr, extensions.Start(context.Background(), componenttest.NewNopHost())) |
| 439 |
if tt.startErr == nil { |
| 440 |
assert.Equal(t, tt.shutdownErr, extensions.Shutdown(context.Background())) |
| 441 |
} |
| 442 |
assertEqualStatuses(t, tt.expectedStatuses, actualStatuses) |
| 443 |
}) |
| 444 |
} |
| 445 |
} |
| 446 |
|
| 447 |
type statusTestExtension struct { |
| 448 |
startErr error |
| 449 |
shutdownErr error |
| 450 |
} |
| 451 |
|
| 452 |
func (ext *statusTestExtension) Start(context.Context, component.Host) error { |
| 453 |
return ext.startErr |
| 454 |
} |
| 455 |
|
| 456 |
func (ext *statusTestExtension) Shutdown(context.Context) error { |
| 457 |
return ext.shutdownErr |
| 458 |
} |
| 459 |
|
| 460 |
func newStatusTestExtension(startErr, shutdownErr error) *statusTestExtension { |
| 461 |
return &statusTestExtension{ |
| 462 |
startErr: startErr, |
| 463 |
shutdownErr: shutdownErr, |
| 464 |
} |
| 465 |
} |
| 466 |
|
| 467 |
func newStatusTestExtensionFactory(name component.Type, startErr, shutdownErr error) extension.Factory { |
| 468 |
return extension.NewFactory( |
| 469 |
name, |
| 470 |
func() component.Config { |
| 471 |
return &struct{}{} |
| 472 |
}, |
| 473 |
func(context.Context, extension.Settings, component.Config) (extension.Extension, error) { |
| 474 |
return newStatusTestExtension(startErr, shutdownErr), nil |
| 475 |
}, |
| 476 |
component.StabilityLevelDevelopment, |
| 477 |
) |
| 478 |
} |
| 479 |
|
| 480 |
func newRecordingExtensionFactory(startCallback func(set extension.Settings, host component.Host) error, shutdownCallback func(set extension.Settings) error) extension.Factory { |
| 481 |
return extension.NewFactory( |
| 482 |
component.MustNewType("recording"), |
| 483 |
func() component.Config { |
| 484 |
return &recordingExtensionConfig{} |
| 485 |
}, |
| 486 |
func(_ context.Context, set extension.Settings, cfg component.Config) (extension.Extension, error) { |
| 487 |
return &recordingExtension{ |
| 488 |
config: cfg.(recordingExtensionConfig), |
| 489 |
createSettings: set, |
| 490 |
startCallback: startCallback, |
| 491 |
shutdownCallback: shutdownCallback, |
| 492 |
}, nil |
| 493 |
}, |
| 494 |
component.StabilityLevelDevelopment, |
| 495 |
) |
| 496 |
} |
| 497 |
|
| 498 |
type recordingExtensionConfig struct { |
| 499 |
dependencies []string // names of dependencies of the same extension type |
| 500 |
} |
| 501 |
|
| 502 |
type recordingExtension struct { |
| 503 |
config recordingExtensionConfig |
| 504 |
startCallback func(set extension.Settings, host component.Host) error |
| 505 |
shutdownCallback func(set extension.Settings) error |
| 506 |
createSettings extension.Settings |
| 507 |
} |
| 508 |
|
| 509 |
var _ extensioncapabilities.Dependent = (*recordingExtension)(nil) |
| 510 |
|
| 511 |
func (ext *recordingExtension) Dependencies() []component.ID { |
| 512 |
if len(ext.config.dependencies) == 0 { |
| 513 |
return nil |
| 514 |
} |
| 515 |
deps := make([]component.ID, len(ext.config.dependencies)) |
| 516 |
for i, dep := range ext.config.dependencies { |
| 517 |
deps[i] = component.MustNewIDWithName("recording", dep) |
| 518 |
} |
| 519 |
return deps |
| 520 |
} |
| 521 |
|
| 522 |
func (ext *recordingExtension) Start(_ context.Context, host component.Host) error { |
| 523 |
return ext.startCallback(ext.createSettings, host) |
| 524 |
} |
| 525 |
|
| 526 |
func (ext *recordingExtension) Shutdown(context.Context) error { |
| 527 |
return ext.shutdownCallback(ext.createSettings) |
| 528 |
} |