| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
package zpagesextension |
| 5 |
|
| 6 |
import ( |
| 7 |
"context" |
| 8 |
|
| 9 |
"go.opentelemetry.io/collector/component" |
| 10 |
"go.opentelemetry.io/collector/config/confighttp" |
| 11 |
"go.opentelemetry.io/collector/extension" |
| 12 |
"go.opentelemetry.io/collector/extension/zpagesextension/internal/metadata" |
| 13 |
) |
| 14 |
|
| 15 |
const ( |
| 16 |
defaultEndpoint = "localhost:55679" |
| 17 |
) |
| 18 |
|
| 19 |
|
| 20 |
func NewFactory() extension.Factory { |
| 21 |
return extension.NewFactory(metadata.Type, createDefaultConfig, create, metadata.ExtensionStability) |
| 22 |
} |
| 23 |
|
| 24 |
func createDefaultConfig() component.Config { |
| 25 |
return &Config{ |
| 26 |
ServerConfig: confighttp.ServerConfig{ |
| 27 |
Endpoint: defaultEndpoint, |
| 28 |
}, |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
func create(_ context.Context, set extension.Settings, cfg component.Config) (extension.Extension, error) { |
| 34 |
return newServer(cfg.(*Config), set.TelemetrySettings), nil |
| 35 |
} |