Skip to content

Commit e64f8f7

Browse files
committed
Fix blobstore benchmark errand
- Decouple blobstore benchmark logging from cc logging - Add cc_overrides to ccng yml, with that fog properties are really merged into ccng yml and fog is used for blobstore coomunication
1 parent 57fc561 commit e64f8f7

File tree

2 files changed

+44
-9
lines changed

2 files changed

+44
-9
lines changed

jobs/blobstore_benchmark/spec

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ properties:
3939
blobstore_benchmark.cc_overrides:
4040
description: "Hash merged into cc config for this errand."
4141
default: {}
42+
blobstore_benchmark.logging_level:
43+
default: "info"
44+
description: "Steno log level for the benchmark process (info|warn|error)."
45+
blobstore_benchmark.stdout_sink_enabled:
46+
default: false
47+
4248
cc:
4349
description: "Full Cloud Controller 'cc' config subtree."
4450
default: {}

jobs/blobstore_benchmark/templates/cloud_controller_ng.yml.erb

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,31 @@
2828
end
2929

3030
cc_cfg = (link("cloud_controller_internal").p("cc") rescue {})
31-
3231
unless cc_cfg.is_a?(Hash)
3332
raise "cc link did not return a Hash, got: #{cc_cfg.class}"
3433
end
3534

35+
overrides = p("blobstore_benchmark.cc_overrides", {})
36+
unless overrides.is_a?(Hash)
37+
raise "blobstore_benchmark.cc_overrides must be a Hash, got: #{overrides.class}"
38+
end
39+
40+
if cc_cfg.respond_to?(:deep_merge)
41+
cc_cfg = cc_cfg.deep_merge(overrides)
42+
else
43+
merge_overwrite = lambda do |base, extra|
44+
extra.each do |k, v|
45+
if base[k].is_a?(Hash) && v.is_a?(Hash)
46+
merge_overwrite.call(base[k], v)
47+
else
48+
base[k] = v
49+
end
50+
end
51+
base
52+
end
53+
cc_cfg = merge_overwrite.call(cc_cfg, overrides)
54+
end
55+
3656
%w[resource_pool buildpacks packages droplets].each do |k|
3757
section = cc_cfg[k]
3858
next unless section.is_a?(Hash)
@@ -72,7 +92,8 @@
7292
db_hash['ca_cert_path'] = '/var/vcap/jobs/blobstore_benchmark/config/certs/db_ca.crt'
7393
end
7494

75-
logging_level = p("cc.logging_level", cc_cfg["logging_level"] || cc_cfg.dig("logging", "level") || "error")
95+
benchmark_logging_level = p("blobstore_benchmark.logging_level", "info")
96+
benchmark_stdout_sink = p("blobstore_benchmark.stdout_sink_enabled", false)
7697

7798
final = {
7899
'pid_filename' => '/var/vcap/sys/run/blobstore_benchmark/blobstore_benchmark.pid',
@@ -82,23 +103,31 @@
82103
'logging' => {
83104
'file' => '/var/vcap/sys/log/blobstore_benchmark/blobstore_benchmark.log',
84105
'syslog' => 'vcap.cloud_controller_ng',
85-
'level' => logging_level.to_s,
106+
'level' => benchmark_logging_level.to_s,
107+
86108
'max_retries' => p("cc.logging_max_retries", cc_cfg["logging_max_retries"] || 0),
87109
'format' => {
88110
'timestamp' => (cc_cfg.dig("logging", "format", "timestamp") ||
89111
link("cloud_controller_internal").p("cc.logging.format.timestamp", "rfc3339"))
90112
},
91-
'stdout_sink_enabled' => p('cc.stdout_logging_enabled', false)
113+
'stdout_sink_enabled' => benchmark_stdout_sink
92114
},
93115

94116
'db' => db_hash,
95-
96-
'storage_cli_config_file_resource_pool' => '/var/vcap/jobs/blobstore_benchmark/config/storage_cli_config_resource_pool.json',
97-
'storage_cli_config_file_buildpacks' => '/var/vcap/jobs/blobstore_benchmark/config/storage_cli_config_buildpacks.json',
98-
'storage_cli_config_file_packages' => '/var/vcap/jobs/blobstore_benchmark/config/storage_cli_config_packages.json',
99-
'storage_cli_config_file_droplets' => '/var/vcap/jobs/blobstore_benchmark/config/storage_cli_config_droplets.json',
100117
}
101118

119+
mode = p("blobstore_benchmark.mode")
120+
121+
# Only configure storage-cli JSON config paths when running storage-cli mode
122+
if mode == "storage-cli"
123+
final.merge!(
124+
'storage_cli_config_file_resource_pool' => '/var/vcap/jobs/blobstore_benchmark/config/storage_cli_config_resource_pool.json',
125+
'storage_cli_config_file_buildpacks' => '/var/vcap/jobs/blobstore_benchmark/config/storage_cli_config_buildpacks.json',
126+
'storage_cli_config_file_packages' => '/var/vcap/jobs/blobstore_benchmark/config/storage_cli_config_packages.json',
127+
'storage_cli_config_file_droplets' => '/var/vcap/jobs/blobstore_benchmark/config/storage_cli_config_droplets.json',
128+
)
129+
end
130+
102131
deep_merge_without_overwrite(final, cc_cfg)
103132
%>
104133
---

0 commit comments

Comments
 (0)