File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,16 @@ function maybeFile (filepath) {
151
151
}
152
152
}
153
153
154
+ function maybeJsonFile ( filepath ) {
155
+ const file = maybeFile ( filepath )
156
+ if ( ! file ) return
157
+ try {
158
+ return JSON . parse ( file )
159
+ } catch ( e ) {
160
+ log . error ( 'Error parsing JSON file %s' , filepath , e )
161
+ }
162
+ }
163
+
154
164
function safeJsonParse ( input ) {
155
165
try {
156
166
return JSON . parse ( input )
@@ -944,7 +954,7 @@ class Config {
944
954
otelSetRuntimeMetrics )
945
955
this . _setBoolean ( env , 'runtimeMetricsRuntimeId' , DD_RUNTIME_METRICS_RUNTIME_ID_ENABLED )
946
956
this . _setArray ( env , 'sampler.spanSamplingRules' , reformatSpanSamplingRules ( coalesce (
947
- safeJsonParse ( maybeFile ( DD_SPAN_SAMPLING_RULES_FILE ) ) ,
957
+ maybeJsonFile ( DD_SPAN_SAMPLING_RULES_FILE ) ,
948
958
safeJsonParse ( DD_SPAN_SAMPLING_RULES )
949
959
) ) )
950
960
this . _setUnit ( env , 'sampleRate' , DD_TRACE_SAMPLE_RATE ||
You can’t perform that action at this time.
0 commit comments