-
Notifications
You must be signed in to change notification settings - Fork 322
Add LLMObs configuration #8076
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
Add LLMObs configuration #8076
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package datadog.trace.api.config; | ||
|
|
||
| /** | ||
| * Constant with names of configuration options for LLM Observability. (EXPERIMENTAL AND SUBJECT TO | ||
| * CHANGE) | ||
| */ | ||
| public final class LlmObsConfig { | ||
|
|
||
| public static final String LLMOBS_ENABLED = "llmobs.enabled"; | ||
|
|
||
| public static final String LLMOBS_ML_APP = "llmobs.ml.app"; | ||
|
|
||
| public static final String LLMOBS_AGENTLESS_ENABLED = "llmobs.agentless.enabled"; | ||
|
|
||
| private LlmObsConfig() {} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |
| import static datadog.trace.api.config.GeneralConfig.SERVICE_NAME; | ||
| import static datadog.trace.api.config.IastConfig.*; | ||
| import static datadog.trace.api.config.JmxFetchConfig.*; | ||
| import static datadog.trace.api.config.LlmObsConfig.*; | ||
| import static datadog.trace.api.config.ProfilingConfig.*; | ||
| import static datadog.trace.api.config.RemoteConfigConfig.*; | ||
| import static datadog.trace.api.config.TraceInstrumentationConfig.*; | ||
|
|
@@ -309,6 +310,9 @@ public static String getHostName() { | |
| private final boolean iastExperimentalPropagationEnabled; | ||
| private final String iastSecurityControlsConfiguration; | ||
|
|
||
| private final boolean llmObsAgentlessEnabled; | ||
| private final String llmObsMlApp; | ||
|
|
||
| private final boolean ciVisibilityTraceSanitationEnabled; | ||
| private final boolean ciVisibilityAgentlessEnabled; | ||
| private final String ciVisibilityAgentlessUrl; | ||
|
|
@@ -1336,6 +1340,10 @@ PROFILING_DATADOG_PROFILER_ENABLED, isDatadogProfilerSafeInCurrentEnvironment()) | |
| iastSecurityControlsConfiguration = | ||
| configProvider.getString(IAST_SECURITY_CONTROLS_CONFIGURATION, null); | ||
|
|
||
| llmObsAgentlessEnabled = | ||
| configProvider.getBoolean(LLMOBS_AGENTLESS_ENABLED, DEFAULT_LLM_OBS_AGENTLESS_ENABLED); | ||
| llmObsMlApp = configProvider.getString(LLMOBS_ML_APP); | ||
|
|
||
| ciVisibilityTraceSanitationEnabled = | ||
| configProvider.getBoolean(CIVISIBILITY_TRACE_SANITATION_ENABLED, true); | ||
|
|
||
|
|
@@ -1766,21 +1774,46 @@ PROFILING_DATADOG_PROFILER_ENABLED, isDatadogProfilerSafeInCurrentEnvironment()) | |
| this.traceFlushIntervalSeconds = | ||
| configProvider.getFloat( | ||
| TracerConfig.TRACE_FLUSH_INTERVAL, ConfigDefaults.DEFAULT_TRACE_FLUSH_INTERVAL); | ||
| if (profilingAgentless && apiKey == null) { | ||
| log.warn( | ||
| "Agentless profiling activated but no api key provided. Profile uploading will likely fail"); | ||
| } | ||
|
|
||
| this.tracePostProcessingTimeout = | ||
| configProvider.getLong( | ||
| TRACE_POST_PROCESSING_TIMEOUT, ConfigDefaults.DEFAULT_TRACE_POST_PROCESSING_TIMEOUT); | ||
|
|
||
| if (isCiVisibilityEnabled() | ||
| && ciVisibilityAgentlessEnabled | ||
| && (apiKey == null || apiKey.isEmpty())) { | ||
| throw new FatalAgentMisconfigurationError( | ||
| "Attempt to start in Agentless mode without API key. " | ||
| + "Please ensure that either an API key is configured, or the tracer is set up to work with the Agent"); | ||
| if (isLlmObsEnabled()) { | ||
| log.debug("Attempting to enable LLM Observability"); | ||
| if (llmObsMlApp == null || llmObsMlApp.isEmpty()) { | ||
| throw new IllegalArgumentException( | ||
| "Attempt to enable LLM Observability without ML app defined." | ||
| + "Please ensure that the name of the ML app is provided through properties or env variable"); | ||
| } | ||
|
|
||
| log.debug( | ||
| "LLM Observability enabled for ML app {}, agentless mode {}", | ||
| llmObsMlApp, | ||
| llmObsAgentlessEnabled); | ||
| } | ||
|
|
||
| // if API key is not provided, check if any products are using agentless mode and require it | ||
| if (apiKey == null || apiKey.isEmpty()) { | ||
| // CI Visibility | ||
| if (isCiVisibilityEnabled() && ciVisibilityAgentlessEnabled) { | ||
| throw new FatalAgentMisconfigurationError( | ||
| "Attempt to start in CI Visibility in Agentless mode without API key. " | ||
| + "Please ensure that either an API key is configured, or the tracer is set up to work with the Agent"); | ||
| } | ||
|
|
||
| // Profiling | ||
| if (profilingAgentless) { | ||
| log.warn( | ||
| "Agentless profiling activated but no api key provided. Profile uploading will likely fail"); | ||
| } | ||
|
|
||
| // LLM Observability | ||
| if (isLlmObsEnabled() && llmObsAgentlessEnabled) { | ||
| throw new FatalAgentMisconfigurationError( | ||
| "Attempt to start LLM Observability in Agentless mode without API key. " | ||
| + "Please ensure that either an API key is configured, or the tracer is set up to work with the Agent"); | ||
| } | ||
| } | ||
|
|
||
| this.telemetryDebugRequestsEnabled = | ||
|
|
@@ -2640,6 +2673,18 @@ public String getIastSecurityControlsConfiguration() { | |
| return iastSecurityControlsConfiguration; | ||
| } | ||
|
|
||
| public boolean isLlmObsEnabled() { | ||
| return instrumenterConfig.isLlmObsEnabled(); | ||
| } | ||
|
|
||
| public boolean isLlmObsAgentlessEnabled() { | ||
| return llmObsAgentlessEnabled; | ||
| } | ||
|
|
||
| public String getLlmObsMlApp() { | ||
| return llmObsMlApp; | ||
|
Comment on lines
+2680
to
+2685
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these two options not set on the instrumenterConfig object? We're fine to just store this directly on the Config instance?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think it is fine to store these in the config instance for now, i am not sure but it is possible we may need them, instrumenterConfig seems to be about starting actual implementations classes if a product is enabled, i think we can add them later as needed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup that's fine with me to add them later when needed. Thanks for clarifying |
||
| } | ||
|
|
||
| public boolean isCiVisibilityEnabled() { | ||
| return instrumenterConfig.isCiVisibilityEnabled(); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.