Skip to content

Commit 1387a66

Browse files
committed
fix: supported-configurations.json have valid version/types/default
1 parent 2651307 commit 1387a66

2 files changed

Lines changed: 38 additions & 24 deletions

File tree

‎metadata/supported-configurations.json‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
],
1111
"DD_API_KEY": [
1212
{
13-
"implementation": "A",
13+
"implementation": "C",
1414
"type": "string",
1515
"default": ""
1616
}
@@ -81,7 +81,7 @@
8181
"DD_DBM_PROPAGATION_MODE": [
8282
{
8383
"implementation": "A",
84-
"type": "int",
84+
"type": "string",
8585
"default": "disabled"
8686
}
8787
],
@@ -171,21 +171,21 @@
171171
],
172172
"DD_GIT_COMMIT_SHA": [
173173
{
174-
"implementation": "A",
174+
"implementation": "B",
175175
"type": "string",
176176
"default": ""
177177
}
178178
],
179179
"DD_GIT_REPOSITORY_URL": [
180180
{
181-
"implementation": "A",
181+
"implementation": "B",
182182
"type": "string",
183183
"default": ""
184184
}
185185
],
186186
"DD_HOSTNAME": [
187187
{
188-
"implementation": "A",
188+
"implementation": "B",
189189
"type": "string",
190190
"default": ""
191191
}
@@ -290,7 +290,7 @@
290290
],
291291
"DD_SERVICE": [
292292
{
293-
"implementation": "E",
293+
"implementation": "F",
294294
"type": "string",
295295
"default": ""
296296
}
@@ -311,7 +311,7 @@
311311
],
312312
"DD_SPAN_SAMPLING_RULES_FILE": [
313313
{
314-
"implementation": "A",
314+
"implementation": "B",
315315
"type": "string",
316316
"default": ""
317317
}
@@ -1315,7 +1315,7 @@
13151315
],
13161316
"DD_TRACE_MEMCACHE_ANALYTICS_ENABLED": [
13171317
{
1318-
"implementation": "A",
1318+
"implementation": "B",
13191319
"type": "boolean",
13201320
"default": "false",
13211321
"aliases": [
@@ -1855,15 +1855,15 @@
18551855
],
18561856
"DD_TRACE_SAMPLING_RULES": [
18571857
{
1858-
"implementation": "A",
1858+
"implementation": "D",
18591859
"type": "array",
18601860
"default": "[]"
18611861
}
18621862
],
18631863
"DD_TRACE_SAMPLING_RULES_FORMAT": [
18641864
{
18651865
"implementation": "A",
1866-
"type": "int",
1866+
"type": "string",
18671867
"default": "glob"
18681868
}
18691869
],
@@ -2238,56 +2238,56 @@
22382238
],
22392239
"OTEL_LOG_LEVEL": [
22402240
{
2241-
"implementation": "C",
2241+
"implementation": "E",
22422242
"type": "string",
22432243
"default": ""
22442244
}
22452245
],
22462246
"OTEL_METRICS_EXPORTER": [
22472247
{
2248-
"implementation": "B",
2248+
"implementation": "D",
22492249
"type": "string",
22502250
"default": ""
22512251
}
22522252
],
22532253
"OTEL_PROPAGATORS": [
22542254
{
2255-
"implementation": "A",
2255+
"implementation": "B",
22562256
"type": "string",
22572257
"default": ""
22582258
}
22592259
],
22602260
"OTEL_RESOURCE_ATTRIBUTES": [
22612261
{
2262-
"implementation": "A",
2262+
"implementation": "B",
22632263
"type": "string",
22642264
"default": ""
22652265
}
22662266
],
22672267
"OTEL_SERVICE_NAME": [
22682268
{
2269-
"implementation": "B",
2269+
"implementation": "C",
22702270
"type": "string",
22712271
"default": ""
22722272
}
22732273
],
22742274
"OTEL_TRACES_EXPORTER": [
22752275
{
2276-
"implementation": "C",
2276+
"implementation": "E",
22772277
"type": "string",
22782278
"default": ""
22792279
}
22802280
],
22812281
"OTEL_TRACES_SAMPLER": [
22822282
{
2283-
"implementation": "C",
2283+
"implementation": "D",
22842284
"type": "string",
22852285
"default": ""
22862286
}
22872287
],
22882288
"OTEL_TRACES_SAMPLER_ARG": [
22892289
{
2290-
"implementation": "C",
2290+
"implementation": "E",
22912291
"type": "string",
22922292
"default": ""
22932293
}

‎tooling/generate-supported-configurations.sh‎

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,24 @@ set -euo pipefail
66
cd "$(dirname "$0")"
77

88
# Maps C config type to JSON schema type.
9-
PHP_CODE=$(cat <<'ENDPHP'
9+
PHP_CODE_FILE=$(mktemp "${TMPDIR:-/tmp}/ddtrace-supported-configurations.XXXXXX.php")
10+
trap 'rm -f "$PHP_CODE_FILE"' EXIT
11+
12+
cat >"$PHP_CODE_FILE" <<'ENDPHP'
13+
<?php
1014
function map_type($raw) {
1115
$raw = trim($raw);
1216
if (preg_match('/^CUSTOM\((.+)\)$/', $raw, $m)) {
13-
$raw = trim($m[1]);
17+
$inner = trim($m[1]);
18+
// CUSTOM() types don't always map 1:1 to JSON schema types.
19+
// In particular, CUSTOM(INT) values are exposed as strings at the config boundary.
20+
if ($inner === 'INT') {
21+
return 'string';
22+
}
23+
if ($inner === 'MAP') {
24+
return 'map';
25+
}
26+
$raw = $inner;
1427
}
1528
$map = [
1629
'BOOL' => 'boolean', 'STRING' => 'string', 'INT' => 'int', 'DOUBLE' => 'decimal',
@@ -172,7 +185,6 @@ $json = preg_replace_callback('/^ +/m', function ($m) {
172185
file_put_contents($outputPath, $json . "\n");
173186
echo "Wrote supported configurations to $outputPath\n";
174187
ENDPHP
175-
)
176188

177189
cat <<EOT >../ext/version.h
178190
#ifndef PHP_DDTRACE_VERSION
@@ -181,7 +193,7 @@ cat <<EOT >../ext/version.h
181193
EOT
182194

183195
PHP_VERSION_ID=${PHP_VERSION_ID:-0}
184-
gcc $(php-config --includes) -I.. -I../ext -I../zend_abstract_interface -I../src/dogstatsd -I../components-rs -x c -E - <<CODE | grep -A9999 -m1 -F 'JSON_CONFIGURATION_MARKER' | tail -n+2 | php -r "$PHP_CODE"
196+
gcc $(php-config --includes) -I.. -I../ext -I../zend_abstract_interface -I../src/dogstatsd -I../components-rs -x c -E - <<CODE | grep -A9999 -m1 -F "JSON_CONFIGURATION_MARKER" | tail -n+2 | php "$PHP_CODE_FILE"
185197
#include "../ext/configuration.h"
186198
187199
#undef PHP_VERSION_ID
@@ -196,8 +208,10 @@ gcc $(php-config --includes) -I.. -I../ext -I../zend_abstract_interface -I../src
196208
#define ALTCALIASES(...) ,##__VA_ARGS__
197209
#define EXPAND(x) x
198210
#define CUSTOM(id) id
199-
#define CONFIG(type, name, default_value, ...) CALIAS(type, name, default_value,)
200-
#define CALIAS(type, name, default_value, aliases, ...) #type, #name, default_value EXPAND(ALT##aliases) |NEXT_CONFIG|
211+
// Preserve the literal config type tokens (e.g. CUSTOM(INT)) so the generator can
212+
// map them to the correct JSON schema type.
213+
#define CONFIG(type, name, default_value, ...) CALIAS(#type, name, default_value,)
214+
#define CALIAS(type, name, default_value, aliases, ...) type, #name, default_value EXPAND(ALT##aliases) |NEXT_CONFIG|
201215
202216
JSON_CONFIGURATION_MARKER
203217
DD_CONFIGURATION

0 commit comments

Comments
 (0)