Skip to content

Commit f2f4fd7

Browse files
committed
Dirigent metadata bugfix.
Signed-off-by: Tobias Stocker <tstocker@student.ethz.ch>
1 parent 18abcef commit f2f4fd7

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

pkg/generator/rps.go

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,26 @@ func CreateRPSFunctions(cfg *config.LoaderConfiguration, dcfg *config.DirigentCo
112112
busyLoopFor := ComputeBusyLoopPeriod(cfg.RpsMemoryMB)
113113

114114
if warmFunction != nil || warmFunctionCount != nil {
115-
result = append(result, &common.Function{
116-
Name: fmt.Sprintf("warm-function-%d", rand.Int()),
117-
118-
InvocationStats: &common.FunctionInvocationStats{Invocations: warmFunctionCount},
119-
RuntimeStats: &common.FunctionRuntimeStats{Average: float64(cfg.RpsRuntimeMs)},
120-
MemoryStats: &common.FunctionMemoryStats{Percentile100: float64(cfg.RpsMemoryMB)},
121-
DirigentMetadata: &common.DirigentMetadata{
115+
var dirigentMetadataWarm *common.DirigentMetadata
116+
if dcfg != nil {
117+
dirigentMetadataWarm = &common.DirigentMetadata{
122118
Image: dcfg.RpsImage,
123119
Port: 80,
124120
Protocol: "tcp",
125121
ScalingUpperBound: 1024,
126122
ScalingLowerBound: 1,
127123
IterationMultiplier: cfg.RpsIterationMultiplier,
128124
IOPercentage: 0,
129-
},
125+
}
126+
}
127+
128+
result = append(result, &common.Function{
129+
Name: fmt.Sprintf("warm-function-%d", rand.Int()),
130+
131+
InvocationStats: &common.FunctionInvocationStats{Invocations: warmFunctionCount},
132+
RuntimeStats: &common.FunctionRuntimeStats{Average: float64(cfg.RpsRuntimeMs)},
133+
MemoryStats: &common.FunctionMemoryStats{Percentile100: float64(cfg.RpsMemoryMB)},
134+
DirigentMetadata: dirigentMetadataWarm,
130135

131136
Specification: &common.FunctionSpecification{
132137
IAT: warmFunction,
@@ -139,20 +144,25 @@ func CreateRPSFunctions(cfg *config.LoaderConfiguration, dcfg *config.DirigentCo
139144
}
140145

141146
for i := 0; i < len(coldFunctions); i++ {
142-
result = append(result, &common.Function{
143-
Name: fmt.Sprintf("cold-function-%d-%d", i, rand.Int()),
144-
145-
InvocationStats: &common.FunctionInvocationStats{Invocations: coldFunctionCount[i]},
146-
MemoryStats: &common.FunctionMemoryStats{Percentile100: float64(cfg.RpsMemoryMB)},
147-
DirigentMetadata: &common.DirigentMetadata{
147+
var dirigentMetadataCold *common.DirigentMetadata
148+
if dcfg != nil {
149+
dirigentMetadataCold = &common.DirigentMetadata{
148150
Image: dcfg.RpsImage,
149151
Port: 80,
150152
Protocol: "tcp",
151153
ScalingUpperBound: 1,
152154
ScalingLowerBound: 0,
153155
IterationMultiplier: cfg.RpsIterationMultiplier,
154156
IOPercentage: 0,
155-
},
157+
}
158+
}
159+
160+
result = append(result, &common.Function{
161+
Name: fmt.Sprintf("cold-function-%d-%d", i, rand.Int()),
162+
163+
InvocationStats: &common.FunctionInvocationStats{Invocations: coldFunctionCount[i]},
164+
MemoryStats: &common.FunctionMemoryStats{Percentile100: float64(cfg.RpsMemoryMB)},
165+
DirigentMetadata: dirigentMetadataCold,
156166

157167
Specification: &common.FunctionSpecification{
158168
IAT: coldFunctions[i],

0 commit comments

Comments
 (0)