File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- const { schemaDefinitions } = require ( './schemas' )
2-
31class SchemaManager {
42 constructor ( ) {
5- this . schemas = schemaDefinitions
6- this . config = { spanAttributeSchema : 'v0' , spanRemoveIntegrationFromService : false }
3+ this . schemas = { }
4+ this . configure ( { spanAttributeSchema : 'v0' , spanRemoveIntegrationFromService : false } )
75 }
86
97 get schema ( ) {
@@ -31,6 +29,16 @@ class SchemaManager {
3129 }
3230
3331 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+
3442 this . config = config
3543 }
3644}
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')
1010const agent = require ( '../plugins/agent' )
1111const Nomenclature = require ( '../../src/service-naming' )
1212const { storage } = require ( '../../../datadog-core' )
13- const { schemaDefinitions } = require ( '../../src/service-naming/schemas' )
1413const { getInstrumentation } = require ( './helpers/load-inst' )
1514
1615global . withVersions = withVersions
@@ -35,7 +34,7 @@ function withNamingSchema (
3534 const testTitle = 'service and operation naming' + ( desc !== '' ? ` (${ desc } )` : '' )
3635
3736 describe ( testTitle , ( ) => {
38- Object . keys ( schemaDefinitions ) . forEach ( versionName => {
37+ [ 'v0' , 'v1' ] . forEach ( versionName => {
3938 describe ( `in version ${ versionName } ` , ( ) => {
4039 before ( ( ) => {
4140 fullConfig = Nomenclature . config
You can’t perform that action at this time.
0 commit comments