Skip to content

Commit 0f6cb4b

Browse files
[azservicebus] Fixing the stress tests to take care of some debt (Azure#21719)
- Upgrade to mariner:2.0 - Remove "custom" stats from the tests and use the names that Liudmila's standardizing. - Some tests weren't properly ending their runs, which meant they didn't report an End() event (mostly affected reporting) - Start events contain some more context about the test (ie, number of rounds, etc..)
1 parent daad817 commit 0f6cb4b

24 files changed

+490
-438
lines changed

sdk/messaging/azservicebus/internal/stress/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.18-fips-cbl-mariner2.0 as build
1+
FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21-cbl-mariner2.0 as build
22
# you'll need to run this build from the root of the azservicebus module
33
ENV GOOS=linux
44
ENV GOARCH=amd64
@@ -12,7 +12,8 @@ RUN go build -o stress .
1212
#
1313
# This image pulls from the other container (using COPY --from=build). The resulting image
1414
# will be pushed to our container registry.
15-
FROM mcr.microsoft.com/cbl-mariner/base/core:1.0
15+
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0
1616
WORKDIR /app
1717
COPY --from=build /src/internal/stress/stress /app/stress
18+
RUN yum update && yum install -y ca-certificates
1819
ENTRYPOINT ["/bin/bash"]

sdk/messaging/azservicebus/internal/stress/scenarios-matrix.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ matrix:
2828
finiteSessions:
2929
testTarget: finiteSessions
3030
memory: "4Gi"
31+
finiteSessionsWithChaos:
32+
testTarget: finiteSessions
33+
memory: "4Gi"
34+
chaos: "true"
3135
idleFastReconnect:
3236
testTarget: idleFastReconnect
3337
memory: "0.5Gi"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
package shared
5+
6+
type Metric string
7+
8+
// These names are modeled off of the metrics from Java
9+
// https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/implementation/instrumentation/ServiceBusMeter.java
10+
//
11+
// and from our standard for attributes:
12+
// https://gist.github.com/lmolkova/e4215c0f44a49ef824983382762e6b92
13+
const (
14+
MetricConnectionLost Metric = "messaging.servicebus.connectionlost"
15+
MetricMessagesSent Metric = "messaging.servicebus.messages.sent"
16+
17+
// metrics related to Service Bus sessions (NOT amqp sessions)
18+
MetricSessionAccept Metric = "messaging.servicebus.session.accept"
19+
MetricSessionTimeoutMS Metric = "messaging.servicebus.session.timeout"
20+
21+
MetricSettlementRequestDuration Metric = "messaging.servicebus.settlement.request.duration"
22+
MetricReceiveLag Metric = "messaging.servicebus.receiver.lag"
23+
24+
MetricAMQPSendDuration Metric = "messaging.az.amqp.producer.send.duration"
25+
// - amqp.delivery_state (ex: 'accepted')
26+
27+
MetricAMQPMgmtRequestDuration Metric = "messaging.az.amqp.management.request.duration"
28+
// - amqp.status_code (ex: 'accepted')
29+
30+
MetricAMQPSettlementRequestDuration Metric = "messaging.servicebus.settlement.request.duration"
31+
MetricAMQPSettlementSequenceNum Metric = "messaging.servicebus.settlement.sequence_number"
32+
33+
// OTel attributes (should come in naturally when we swap over to using OTel throughout)
34+
// otel.status_code
35+
36+
// TODO: I've made these up entirely.
37+
MetricMessageReceived Metric = "messaging.servicebus.messages.received"
38+
MetricMessagePeeked Metric = "messaging.servicebus.messages.peeked"
39+
MetricCloseDuration Metric = "messaging.servicebus.close.duration"
40+
MetricLockRenew Metric = "messaging.servicebus.lockrenew.duration" // TODO: separate for session vs message lock?
41+
)
42+
43+
const (
44+
AttrAMQPDeliveryState string = "amqp.delivery_state"
45+
AttrAMQPStatusCode string = "amqp.status_code"
46+
47+
// TODO: I made these up entirely
48+
AttrMessageCount string = "amqp.message_count"
49+
)
50+
51+
// these metrics are specific to stress tests and wouldn't be in customer code.
52+
const (
53+
MetricStressSuccessfulCancels = "stress.cancels"
54+
)

sdk/messaging/azservicebus/internal/stress/shared/stats.go

Lines changed: 0 additions & 130 deletions
This file was deleted.

sdk/messaging/azservicebus/internal/stress/shared/streaming_batch.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type internalBatch interface {
2323
}
2424

2525
type senderWrapper struct {
26-
inner *azservicebus.Sender
26+
inner *TrackingSender
2727
}
2828

2929
func (sw *senderWrapper) SendMessageBatch(ctx context.Context, batch internalBatch) error {
@@ -34,7 +34,7 @@ func (sw *senderWrapper) NewMessageBatch(ctx context.Context, options *azservice
3434
return sw.inner.NewMessageBatch(ctx, options)
3535
}
3636

37-
func NewStreamingMessageBatch(ctx context.Context, sender internalBatchSender, stats *Stats) (*StreamingMessageBatch, error) {
37+
func NewStreamingMessageBatch(ctx context.Context, sender internalBatchSender) (*StreamingMessageBatch, error) {
3838
batch, err := sender.NewMessageBatch(ctx, nil)
3939

4040
if err != nil {
@@ -43,14 +43,12 @@ func NewStreamingMessageBatch(ctx context.Context, sender internalBatchSender, s
4343

4444
return &StreamingMessageBatch{
4545
sender: sender,
46-
stats: stats,
4746
currentBatch: batch,
4847
}, nil
4948
}
5049

5150
type StreamingMessageBatch struct {
5251
sender internalBatchSender
53-
stats *Stats
5452
currentBatch internalBatch
5553
}
5654

@@ -72,10 +70,6 @@ func (sb *StreamingMessageBatch) Add(ctx context.Context, msg *azservicebus.Mess
7270
return err
7371
}
7472

75-
if sb.stats != nil {
76-
sb.stats.AddSent(sb.currentBatch.NumMessages())
77-
}
78-
7973
// throttle a teeny bit.
8074
time.Sleep(time.Second)
8175

@@ -106,8 +100,5 @@ func (sb *StreamingMessageBatch) Close(ctx context.Context) error {
106100
return err
107101
}
108102

109-
if sb.stats != nil {
110-
sb.stats.AddSent(sb.currentBatch.NumMessages())
111-
}
112103
return nil
113104
}

sdk/messaging/azservicebus/internal/stress/shared/streaming_batch_test.go

Lines changed: 0 additions & 131 deletions
This file was deleted.

0 commit comments

Comments
 (0)