Skip to content

Commit 9b46327

Browse files
authored
Merge branch 'main' into fix/vcenter-tls
2 parents 89330ab + 3acc90c commit 9b46327

File tree

31 files changed

+2956
-369
lines changed

31 files changed

+2956
-369
lines changed

.chloggen/awsfirehose-contract.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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. otlpreceiver)
7+
component: awsfirehosereceiver
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Follow receiver contract based on type of error
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [5909]
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+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: []

.chloggen/failover-max-retry-fix.yaml

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: bug_fix
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: failoverconnector
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Resolves a bug that prevents proper recovery when disabling max retries
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: [36587]
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: []
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: internal
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Remove stable gate `component.UseLocalHostAsDefaultHost`
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: [36589]
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: []
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: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: routingconnector
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Add abiilty to route by 'datapoint' context
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: [36523]
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: []

connector/failoverconnector/failover_test.go

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func TestFailoverRecovery_MaxRetries(t *testing.T) {
202202

203203
failoverConnector.failover.ModifyConsumerAtIndex(0, consumertest.NewErr(errTracesConsumer))
204204
failoverConnector.failover.ModifyConsumerAtIndex(1, consumertest.NewErr(errTracesConsumer))
205-
failoverConnector.failover.pS.SetRetryCountToMax(0)
205+
failoverConnector.failover.pS.SetRetryCountToValue(0, cfg.MaxRetries)
206206

207207
require.Eventually(t, func() bool {
208208
return consumeTracesAndCheckStable(failoverConnector, 2, tr)
@@ -211,11 +211,77 @@ func TestFailoverRecovery_MaxRetries(t *testing.T) {
211211
failoverConnector.failover.ModifyConsumerAtIndex(0, &sinkFirst)
212212
failoverConnector.failover.ModifyConsumerAtIndex(1, &sinkSecond)
213213

214+
// Check that level 0 is skipped because max retry value is hit
214215
require.Eventually(t, func() bool {
215216
return consumeTracesAndCheckStable(failoverConnector, 1, tr)
216217
}, 3*time.Second, 5*time.Millisecond)
217218
}
218219

220+
func TestFailoverRecovery_MaxRetriesDisabled(t *testing.T) {
221+
var sinkFirst, sinkSecond, sinkThird, sinkFourth consumertest.TracesSink
222+
tracesFirst := pipeline.NewIDWithName(pipeline.SignalTraces, "traces/first")
223+
tracesSecond := pipeline.NewIDWithName(pipeline.SignalTraces, "traces/second")
224+
tracesThird := pipeline.NewIDWithName(pipeline.SignalTraces, "traces/third")
225+
tracesFourth := pipeline.NewIDWithName(pipeline.SignalTraces, "traces/fourth")
226+
227+
cfg := &Config{
228+
PipelinePriority: [][]pipeline.ID{{tracesFirst}, {tracesSecond}, {tracesThird}, {tracesFourth}},
229+
RetryInterval: 50 * time.Millisecond,
230+
RetryGap: 10 * time.Millisecond,
231+
MaxRetries: 0,
232+
}
233+
234+
router := connector.NewTracesRouter(map[pipeline.ID]consumer.Traces{
235+
tracesFirst: &sinkFirst,
236+
tracesSecond: &sinkSecond,
237+
tracesThird: &sinkThird,
238+
tracesFourth: &sinkFourth,
239+
})
240+
241+
conn, err := NewFactory().CreateTracesToTraces(context.Background(),
242+
connectortest.NewNopSettings(), cfg, router.(consumer.Traces))
243+
244+
require.NoError(t, err)
245+
246+
failoverConnector := conn.(*tracesFailover)
247+
248+
tr := sampleTrace()
249+
250+
defer func() {
251+
assert.NoError(t, failoverConnector.Shutdown(context.Background()))
252+
}()
253+
254+
failoverConnector.failover.ModifyConsumerAtIndex(0, consumertest.NewErr(errTracesConsumer))
255+
failoverConnector.failover.ModifyConsumerAtIndex(1, consumertest.NewErr(errTracesConsumer))
256+
257+
require.Eventually(t, func() bool {
258+
return consumeTracesAndCheckStable(failoverConnector, 2, tr)
259+
}, 3*time.Second, 5*time.Millisecond)
260+
261+
failoverConnector.failover.ModifyConsumerAtIndex(0, &sinkFirst)
262+
failoverConnector.failover.ModifyConsumerAtIndex(1, &sinkSecond)
263+
264+
require.Eventually(t, func() bool {
265+
return consumeTracesAndCheckStable(failoverConnector, 0, tr)
266+
}, 3*time.Second, 5*time.Millisecond)
267+
268+
failoverConnector.failover.ModifyConsumerAtIndex(0, consumertest.NewErr(errTracesConsumer))
269+
failoverConnector.failover.ModifyConsumerAtIndex(1, consumertest.NewErr(errTracesConsumer))
270+
failoverConnector.failover.pS.SetRetryCountToValue(0, cfg.MaxRetries)
271+
272+
require.Eventually(t, func() bool {
273+
return consumeTracesAndCheckStable(failoverConnector, 2, tr)
274+
}, 3*time.Second, 5*time.Millisecond)
275+
276+
failoverConnector.failover.ModifyConsumerAtIndex(0, &sinkFirst)
277+
failoverConnector.failover.ModifyConsumerAtIndex(1, &sinkSecond)
278+
279+
// Check that still resets to level 0 even though max retry value is hit
280+
require.Eventually(t, func() bool {
281+
return consumeTracesAndCheckStable(failoverConnector, 0, tr)
282+
}, 3*time.Second, 5*time.Millisecond)
283+
}
284+
219285
func resetConsumers(conn *tracesFailover, consumers ...consumer.Traces) {
220286
for i, sink := range consumers {
221287
conn.failover.ModifyConsumerAtIndex(i, sink)

connector/failoverconnector/internal/state/pipeline_selector.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func (p *PipelineSelector) retryHighPriorityPipelines(ctx context.Context, retry
9292
defer ticker.Stop()
9393

9494
for i := 0; i < len(p.pipelineRetries); i++ {
95-
if p.maxRetriesUsed(i) {
95+
if p.exceededMaxRetries(i) {
9696
continue
9797
}
9898
select {
@@ -110,7 +110,7 @@ func (p *PipelineSelector) retryHighPriorityPipelines(ctx context.Context, retry
110110
// checkContinueRetry checks if retry should be suspended if all higher priority levels have exceeded their max retries
111111
func (p *PipelineSelector) checkContinueRetry(index int) bool {
112112
for i := 0; i < index; i++ {
113-
if p.loadRetryCount(i) < p.constants.MaxRetries {
113+
if p.constants.MaxRetries == 0 || p.loadRetryCount(i) < p.constants.MaxRetries {
114114
return true
115115
}
116116
}
@@ -127,11 +127,6 @@ func (p *PipelineSelector) setToStableIndex(idx int) {
127127
p.currentIndex.Store(p.stableIndex.Load())
128128
}
129129

130-
// MaxRetriesUsed exported access to maxRetriesUsed
131-
func (p *PipelineSelector) maxRetriesUsed(idx int) bool {
132-
return p.loadRetryCount(idx) >= p.constants.MaxRetries
133-
}
134-
135130
// SetNewStableIndex Update stableIndex to the passed stable index
136131
func (p *PipelineSelector) setNewStableIndex(idx int) {
137132
p.resetRetryCount(idx)
@@ -249,8 +244,8 @@ func (p *PipelineSelector) TestRetryPipelines(ctx context.Context, retryInterval
249244
p.enableRetry(ctx, retryInterval, retryGap)
250245
}
251246

252-
func (p *PipelineSelector) SetRetryCountToMax(idx int) {
253-
p.pipelineRetries[idx].Store(int32(p.constants.MaxRetries))
247+
func (p *PipelineSelector) SetRetryCountToValue(idx int, val int) {
248+
p.pipelineRetries[idx].Store(int32(val))
254249
}
255250

256251
func (p *PipelineSelector) ResetRetryCount(idx int) {

connector/routingconnector/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ If you are not already familiar with connectors, you may find it helpful to firs
3333
The following settings are available:
3434

3535
- `table (required)`: the routing table for this connector.
36-
- `table.context (optional, default: resource)`: the [OTTL Context] in which the statement will be evaluated. Currently, only `resource`, `span`, `metric`, `log`, and `request` are supported.
36+
- `table.context (optional, default: resource)`: the [OTTL Context] in which the statement will be evaluated. Currently, only `resource`, `span`, `metric`, `datapoint`, `log`, and `request` are supported.
3737
- `table.statement`: the routing condition provided as the [OTTL] statement. Required if `table.condition` is not provided. May not be used for `request` context.
3838
- `table.condition`: the routing condition provided as the [OTTL] condition. Required if `table.statement` is not provided. Required for `request` context.
3939
- `table.pipelines (required)`: the list of pipelines to use when the routing condition is met.
@@ -43,7 +43,7 @@ The following settings are available:
4343

4444
### Limitations
4545

46-
- The `match_once` setting is only supported when using the `resource` context. If any routes use `span`, `metric`, `log` or `request` context, `match_once` must be set to `true`.
46+
- The `match_once` setting is only supported when using the `resource` context. If any routes use `span`, `metric`, `datapoint`, `log` or `request` context, `match_once` must be set to `true`.
4747
- The `request` context requires use of the `condition` setting, and relies on a very limited grammar. Conditions must be in the form of `request["key"] == "value"` or `request["key"] != "value"`. (In the future, this grammar may be expanded to support more complex conditions.)
4848

4949
### Supported [OTTL] functions

connector/routingconnector/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (c *Config) Validate() error {
7777
return err
7878
}
7979
fallthrough
80-
case "span", "metric", "log": // ok
80+
case "span", "metric", "datapoint", "log": // ok
8181
if !c.MatchOnce {
8282
return fmt.Errorf(`%q context is not supported with "match_once: false"`, item.Context)
8383
}

connector/routingconnector/config_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,22 @@ func TestValidateConfig(t *testing.T) {
250250
},
251251
error: `"metric" context is not supported with "match_once: false"`,
252252
},
253+
{
254+
name: "datapoint context with match_once false",
255+
config: &Config{
256+
MatchOnce: false,
257+
Table: []RoutingTableItem{
258+
{
259+
Context: "datapoint",
260+
Statement: `route() where attributes["attr"] == "acme"`,
261+
Pipelines: []pipeline.ID{
262+
pipeline.NewIDWithName(pipeline.SignalTraces, "otlp"),
263+
},
264+
},
265+
},
266+
},
267+
error: `"datapoint" context is not supported with "match_once: false"`,
268+
},
253269
{
254270
name: "log context with match_once false",
255271
config: &Config{

0 commit comments

Comments
 (0)