@@ -41,12 +41,20 @@ type Factory interface {
4141 // this function returns the error [pipeline.ErrSignalNotSupported].
4242 CreateMetrics (ctx context.Context , set Settings , cfg component.Config ) (Metrics , error )
4343
44+ // CreateProfiles creates a Profiles scraper based on this config.
45+ // If the scraper type does not support profiles,
46+ // this function returns the error [pipeline.ErrSignalNotSupported].
47+ CreateProfiles (ctx context.Context , set Settings , cfg component.Config ) (Profiles , error )
48+
4449 // LogsStability gets the stability level of the Logs scraper.
4550 LogsStability () component.StabilityLevel
4651
4752 // MetricsStability gets the stability level of the Metrics scraper.
4853 MetricsStability () component.StabilityLevel
4954
55+ // ProfilesStability gets the stability level of the Profiles scraper.
56+ ProfilesStability () component.StabilityLevel
57+
5058 unexportedFactoryFunc ()
5159}
5260
@@ -68,10 +76,12 @@ func (f factoryOptionFunc) applyOption(o *factory) {
6876type factory struct {
6977 cfgType component.Type
7078 component.CreateDefaultConfigFunc
71- createLogsFunc CreateLogsFunc
72- createMetricsFunc CreateMetricsFunc
73- logsStabilityLevel component.StabilityLevel
74- metricsStabilityLevel component.StabilityLevel
79+ createLogsFunc CreateLogsFunc
80+ createMetricsFunc CreateMetricsFunc
81+ createProfilesFunc CreateProfilesFunc
82+ logsStabilityLevel component.StabilityLevel
83+ metricsStabilityLevel component.StabilityLevel
84+ profilesStabilityLevel component.StabilityLevel
7585}
7686
7787func (f * factory ) Type () component.Type {
@@ -88,6 +98,10 @@ func (f *factory) MetricsStability() component.StabilityLevel {
8898 return f .metricsStabilityLevel
8999}
90100
101+ func (f * factory ) ProfilesStability () component.StabilityLevel {
102+ return f .profilesStabilityLevel
103+ }
104+
91105func (f * factory ) CreateLogs (ctx context.Context , set Settings , cfg component.Config ) (Logs , error ) {
92106 if f .createLogsFunc == nil {
93107 return nil , pipeline .ErrSignalNotSupported
@@ -102,12 +116,22 @@ func (f *factory) CreateMetrics(ctx context.Context, set Settings, cfg component
102116 return f .createMetricsFunc (ctx , set , cfg )
103117}
104118
119+ func (f * factory ) CreateProfiles (ctx context.Context , set Settings , cfg component.Config ) (Profiles , error ) {
120+ if f .createProfilesFunc == nil {
121+ return nil , pipeline .ErrSignalNotSupported
122+ }
123+ return f .createProfilesFunc (ctx , set , cfg )
124+ }
125+
105126// CreateLogsFunc is the equivalent of Factory.CreateLogs().
106127type CreateLogsFunc func (context.Context , Settings , component.Config ) (Logs , error )
107128
108129// CreateMetricsFunc is the equivalent of Factory.CreateMetrics().
109130type CreateMetricsFunc func (context.Context , Settings , component.Config ) (Metrics , error )
110131
132+ // CreateProfilesFunc is the equivalent of Factory.CreateProfiles().
133+ type CreateProfilesFunc func (context.Context , Settings , component.Config ) (Profiles , error )
134+
111135// WithLogs overrides the default "error not supported" implementation for CreateLogs and the default "undefined" stability level.
112136func WithLogs (createLogs CreateLogsFunc , sl component.StabilityLevel ) FactoryOption {
113137 return factoryOptionFunc (func (o * factory ) {
@@ -124,6 +148,14 @@ func WithMetrics(createMetrics CreateMetricsFunc, sl component.StabilityLevel) F
124148 })
125149}
126150
151+ // WithProfiles overrides the default "error not supported" implementation for CreateProfiles and the default "undefined" stability level.
152+ func WithProfiles (createProfiles CreateProfilesFunc , sl component.StabilityLevel ) FactoryOption {
153+ return factoryOptionFunc (func (o * factory ) {
154+ o .profilesStabilityLevel = sl
155+ o .createProfilesFunc = createProfiles
156+ })
157+ }
158+
127159// NewFactory returns a Factory.
128160func NewFactory (cfgType component.Type , createDefaultConfig component.CreateDefaultConfigFunc , options ... FactoryOption ) Factory {
129161 f := & factory {
0 commit comments