@@ -41,12 +41,20 @@ type Factory interface {
41
41
// this function returns the error [pipeline.ErrSignalNotSupported].
42
42
CreateMetrics (ctx context.Context , set Settings , cfg component.Config ) (Metrics , error )
43
43
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
+
44
49
// LogsStability gets the stability level of the Logs scraper.
45
50
LogsStability () component.StabilityLevel
46
51
47
52
// MetricsStability gets the stability level of the Metrics scraper.
48
53
MetricsStability () component.StabilityLevel
49
54
55
+ // ProfilesStability gets the stability level of the Profiles scraper.
56
+ ProfilesStability () component.StabilityLevel
57
+
50
58
unexportedFactoryFunc ()
51
59
}
52
60
@@ -68,10 +76,12 @@ func (f factoryOptionFunc) applyOption(o *factory) {
68
76
type factory struct {
69
77
cfgType component.Type
70
78
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
75
85
}
76
86
77
87
func (f * factory ) Type () component.Type {
@@ -88,6 +98,10 @@ func (f *factory) MetricsStability() component.StabilityLevel {
88
98
return f .metricsStabilityLevel
89
99
}
90
100
101
+ func (f * factory ) ProfilesStability () component.StabilityLevel {
102
+ return f .profilesStabilityLevel
103
+ }
104
+
91
105
func (f * factory ) CreateLogs (ctx context.Context , set Settings , cfg component.Config ) (Logs , error ) {
92
106
if f .createLogsFunc == nil {
93
107
return nil , pipeline .ErrSignalNotSupported
@@ -102,12 +116,22 @@ func (f *factory) CreateMetrics(ctx context.Context, set Settings, cfg component
102
116
return f .createMetricsFunc (ctx , set , cfg )
103
117
}
104
118
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
+
105
126
// CreateLogsFunc is the equivalent of Factory.CreateLogs().
106
127
type CreateLogsFunc func (context.Context , Settings , component.Config ) (Logs , error )
107
128
108
129
// CreateMetricsFunc is the equivalent of Factory.CreateMetrics().
109
130
type CreateMetricsFunc func (context.Context , Settings , component.Config ) (Metrics , error )
110
131
132
+ // CreateProfilesFunc is the equivalent of Factory.CreateProfiles().
133
+ type CreateProfilesFunc func (context.Context , Settings , component.Config ) (Profiles , error )
134
+
111
135
// WithLogs overrides the default "error not supported" implementation for CreateLogs and the default "undefined" stability level.
112
136
func WithLogs (createLogs CreateLogsFunc , sl component.StabilityLevel ) FactoryOption {
113
137
return factoryOptionFunc (func (o * factory ) {
@@ -124,6 +148,14 @@ func WithMetrics(createMetrics CreateMetricsFunc, sl component.StabilityLevel) F
124
148
})
125
149
}
126
150
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
+
127
159
// NewFactory returns a Factory.
128
160
func NewFactory (cfgType component.Type , createDefaultConfig component.CreateDefaultConfigFunc , options ... FactoryOption ) Factory {
129
161
f := & factory {
0 commit comments