Skip to content

Commit 61bab14

Browse files
atoulmegithub-actions[bot]
authored andcommitted
[processor/interval] unexport Processor (open-telemetry#40273)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Unexport Processor struct. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 51d1972 commit 61bab14

File tree

3 files changed

+39
-12
lines changed

3 files changed

+39
-12
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: breaking
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: intervalprocessor
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Unexport Processor
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [40273]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [api]

processor/intervalprocessor/processor.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import (
2020
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/intervalprocessor/internal/metrics"
2121
)
2222

23-
var _ processor.Metrics = (*Processor)(nil)
23+
var _ processor.Metrics = (*intervalProcessor)(nil)
2424

25-
type Processor struct {
25+
type intervalProcessor struct {
2626
ctx context.Context
2727
cancel context.CancelFunc
2828
logger *zap.Logger
@@ -43,10 +43,10 @@ type Processor struct {
4343
nextConsumer consumer.Metrics
4444
}
4545

46-
func newProcessor(config *Config, log *zap.Logger, nextConsumer consumer.Metrics) *Processor {
46+
func newProcessor(config *Config, log *zap.Logger, nextConsumer consumer.Metrics) *intervalProcessor {
4747
ctx, cancel := context.WithCancel(context.Background())
4848

49-
return &Processor{
49+
return &intervalProcessor{
5050
ctx: ctx,
5151
cancel: cancel,
5252
logger: log,
@@ -68,7 +68,7 @@ func newProcessor(config *Config, log *zap.Logger, nextConsumer consumer.Metrics
6868
}
6969
}
7070

71-
func (p *Processor) Start(_ context.Context, _ component.Host) error {
71+
func (p *intervalProcessor) Start(_ context.Context, _ component.Host) error {
7272
exportTicker := time.NewTicker(p.config.Interval)
7373
go func() {
7474
for {
@@ -85,16 +85,16 @@ func (p *Processor) Start(_ context.Context, _ component.Host) error {
8585
return nil
8686
}
8787

88-
func (p *Processor) Shutdown(_ context.Context) error {
88+
func (p *intervalProcessor) Shutdown(_ context.Context) error {
8989
p.cancel()
9090
return nil
9191
}
9292

93-
func (p *Processor) Capabilities() consumer.Capabilities {
93+
func (p *intervalProcessor) Capabilities() consumer.Capabilities {
9494
return consumer.Capabilities{MutatesData: true}
9595
}
9696

97-
func (p *Processor) ConsumeMetrics(ctx context.Context, md pmetric.Metrics) error {
97+
func (p *intervalProcessor) ConsumeMetrics(ctx context.Context, md pmetric.Metrics) error {
9898
var errs error
9999

100100
p.stateLock.Lock()
@@ -201,7 +201,7 @@ func aggregateDataPoints[DPS metrics.DataPointSlice[DP], DP metrics.DataPoint[DP
201201
}
202202
}
203203

204-
func (p *Processor) exportMetrics() {
204+
func (p *intervalProcessor) exportMetrics() {
205205
md := func() pmetric.Metrics {
206206
p.stateLock.Lock()
207207
defer p.stateLock.Unlock()
@@ -228,7 +228,7 @@ func (p *Processor) exportMetrics() {
228228
}
229229
}
230230

231-
func (p *Processor) getOrCloneMetric(rm pmetric.ResourceMetrics, sm pmetric.ScopeMetrics, m pmetric.Metric) (pmetric.Metric, identity.Metric) {
231+
func (p *intervalProcessor) getOrCloneMetric(rm pmetric.ResourceMetrics, sm pmetric.ScopeMetrics, m pmetric.Metric) (pmetric.Metric, identity.Metric) {
232232
// Find the ResourceMetrics
233233
resID := identity.OfResource(rm.Resource())
234234
rmClone, ok := p.rmLookup[resID]

processor/intervalprocessor/processor_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ func TestAggregation(t *testing.T) {
6666
err = mgp.ConsumeMetrics(ctx, md)
6767
require.NoError(t, err)
6868

69-
require.IsType(t, &Processor{}, mgp)
70-
processor := mgp.(*Processor)
69+
require.IsType(t, &intervalProcessor{}, mgp)
70+
processor := mgp.(*intervalProcessor)
7171

7272
// Pretend we hit the interval timer and call export
7373
processor.exportMetrics()

0 commit comments

Comments
 (0)