File tree Expand file tree Collapse file tree 3 files changed +13
-12
lines changed Expand file tree Collapse file tree 3 files changed +13
-12
lines changed Original file line number Diff line number Diff line change 1
- const { schemaDefinitions } = require ( './schemas' )
2
-
3
1
class SchemaManager {
4
2
constructor ( ) {
5
- this . schemas = schemaDefinitions
6
- this . config = { spanAttributeSchema : 'v0' , spanRemoveIntegrationFromService : false }
3
+ this . schemas = { }
4
+ this . configure ( { spanAttributeSchema : 'v0' , spanRemoveIntegrationFromService : false } )
7
5
}
8
6
9
7
get schema ( ) {
@@ -31,6 +29,16 @@ class SchemaManager {
31
29
}
32
30
33
31
configure ( config = { } ) {
32
+ const { spanAttributeSchema, spanRemoveIntegrationFromService } = config
33
+
34
+ if ( ! this . schemas . v0 && spanAttributeSchema === 'v0' ) {
35
+ this . schemas . v0 = require ( './schemas/v0' )
36
+ }
37
+
38
+ if ( ! this . schemas . v1 && ( spanAttributeSchema === 'v1' || spanRemoveIntegrationFromService ) ) {
39
+ this . schemas . v1 = require ( './schemas/v1' )
40
+ }
41
+
34
42
this . config = config
35
43
}
36
44
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ const runtimeMetrics = require('../../src/runtime_metrics')
10
10
const agent = require ( '../plugins/agent' )
11
11
const Nomenclature = require ( '../../src/service-naming' )
12
12
const { storage } = require ( '../../../datadog-core' )
13
- const { schemaDefinitions } = require ( '../../src/service-naming/schemas' )
14
13
const { getInstrumentation } = require ( './helpers/load-inst' )
15
14
16
15
global . withVersions = withVersions
@@ -35,7 +34,7 @@ function withNamingSchema (
35
34
const testTitle = 'service and operation naming' + ( desc !== '' ? ` (${ desc } )` : '' )
36
35
37
36
describe ( testTitle , ( ) => {
38
- Object . keys ( schemaDefinitions ) . forEach ( versionName => {
37
+ [ 'v0' , 'v1' ] . forEach ( versionName => {
39
38
describe ( `in version ${ versionName } ` , ( ) => {
40
39
before ( ( ) => {
41
40
fullConfig = Nomenclature . config
You can’t perform that action at this time.
0 commit comments