Skip to content

Commit

Permalink
lazy load appsec and llmobs sdks
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanista committed Jan 9, 2025
1 parent 0796a7f commit c1fa5d6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/dd-trace/src/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ const DynamicInstrumentation = require('./debugger')
const telemetry = require('./telemetry')
const nomenclature = require('./service-naming')
const PluginManager = require('./plugin_manager')
const AppsecSdk = require('./appsec/sdk')
const dogstatsd = require('./dogstatsd')
const NoopDogStatsDClient = require('./noop/dogstatsd')
const spanleak = require('./spanleak')
const { SSIHeuristics } = require('./profiling/ssi-heuristics')
const appsecStandalone = require('./appsec/standalone')
const LLMObsSDK = require('./llmobs/sdk')

class LazyModule {
constructor (provider) {
Expand Down Expand Up @@ -213,8 +211,17 @@ class Tracer extends NoopProxy {
const prioritySampler = appsecStandalone.configure(config)
this._tracer = new DatadogTracer(config, prioritySampler)
this.dataStreamsCheckpointer = this._tracer.dataStreamsCheckpointer
this.appsec = new AppsecSdk(this._tracer, config)
this.llmobs = new LLMObsSDK(this._tracer, this._modules.llmobs, config)

if (config.appsec.enabled) {
const AppsecSdk = require('./appsec/sdk')
this.appsec = new AppsecSdk(this._tracer, config)
}

if (config.llmobs.enabled) {
const LLMObsSDK = require('./llmobs/sdk')
this.llmobs = new LLMObsSDK(this._tracer, this._modules.llmobs, config)
}

this._tracingInitialized = true
}
if (config.iast.enabled) {
Expand Down

0 comments on commit c1fa5d6

Please sign in to comment.