Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add ai_monitoring configuration #1873

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions documentation/feature-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ Any prerelease flags can be enabled or disabled in your agent config by adding a

## Current prerelease feature flags

#### openai_instrumentation
* Enabled by default: `false`
* Configuration: `{ feature_flag: { openai_instrumentation: true|false }}`
* Environment Variable: `NEW_RELIC_FEATURE_FLAG_OPENAI_INSTRUMENTATION`
* Description: Enables instrumenting the `openai` module.

#### promise_segments
* Enabled by default: `false`
* Configuration: `{ feature_flag: { promise_segments: true|false }}`
Expand Down
14 changes: 14 additions & 0 deletions lib/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,20 @@ defaultConfig.definition = () => ({
formatter: boolean,
default: false
}
},

/**
* When enabled, instrumentation of supported AI libraries will be in
* effect.
*/
ai_monitoring: {
/**
* Toggles the generation of AI monitoring events by the agent.
*/
enabled: {
formatter: boolean,
default: false
}
}
})

Expand Down
3 changes: 3 additions & 0 deletions lib/config/hsm.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ const HIGH_SECURITY_SETTINGS = {
forwarding: {
enabled: false
}
},
ai_monitoring: {
enabled: false
}
}

Expand Down
1 change: 0 additions & 1 deletion lib/feature_flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// unreleased flags gating an active feature
exports.prerelease = {
express5: false,
openai_instrumentation: false,
promise_segments: false,
reverse_naming_rules: false,
undici_async_tracking: true,
Expand Down
5 changes: 5 additions & 0 deletions test/unit/config/config-defaults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,4 +308,9 @@ tap.test('with default properties', (t) => {
t.equal(configuration.worker_threads.enabled, false)
t.end()
})

t.test('should default ai_monitoring.enabled to false', (t) => {
t.equal(configuration.ai_monitoring.enabled, false)
t.end()
})
})
13 changes: 13 additions & 0 deletions test/unit/config/config-security.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,16 @@ tap.test('#applyLasp', (t) => {
t.end()
})
})

tap.test('ai_monitoring should not be enabled in HSM', (t) => {
const config = Config.initialize({
ai_monitoring: {
enabled: true
},
high_security: 'true'
jsumners-nr marked this conversation as resolved.
Show resolved Hide resolved
})

t.equal(config.ai_monitoring.enabled, false)

t.end()
})
3 changes: 1 addition & 2 deletions test/unit/feature_flag.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ const used = [
'certificate_bundle',
'unresolved_promise_cleanup',
'undici_instrumentation',
'undici_async_tracking',
'openai_instrumentation'
'undici_async_tracking'
]

tap.test('feature flags', (t) => {
Expand Down
Loading