-
Notifications
You must be signed in to change notification settings - Fork 24
/
factory.go
39 lines (33 loc) · 1.03 KB
/
factory.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package rollupprocessor
import (
"context"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/consumer"
)
const (
// The value of "type" key in configuration.
typeStr = "rollup"
)
// NewFactory returns a new factory for the Rollup processor.
func NewFactory() component.ProcessorFactory {
return component.NewProcessorFactory(
typeStr,
createDefaultConfig,
component.WithLogsProcessor(CreateLogsProcessor, component.StabilityLevelInDevelopment))
}
func createDefaultConfig() config.Processor {
return &Config{
ProcessorSettings: config.NewProcessorSettings(config.NewComponentID(typeStr)),
AttributeCardinalityLimit: defaultAttributeCardinalityLimit,
}
}
// CreateLogsProcessor returns rollupProcessor handling logs.
func CreateLogsProcessor(
_ context.Context,
set component.ProcessorCreateSettings,
cfg config.Processor,
nextConsumer consumer.Logs,
) (component.LogsProcessor, error) {
return newRollupLogsProcessor(set, nextConsumer, cfg.(*Config))
}