|
32 | 32 | import datadog.trace.api.config.CrashTrackingConfig; |
33 | 33 | import datadog.trace.api.config.CwsConfig; |
34 | 34 | import datadog.trace.api.config.DebuggerConfig; |
| 35 | +import datadog.trace.api.config.FeatureFlaggingConfig; |
35 | 36 | import datadog.trace.api.config.GeneralConfig; |
36 | 37 | import datadog.trace.api.config.IastConfig; |
37 | 38 | import datadog.trace.api.config.JmxFetchConfig; |
@@ -125,7 +126,8 @@ private enum AgentFeature { |
125 | 126 | DATA_JOBS(GeneralConfig.DATA_JOBS_ENABLED, false), |
126 | 127 | AGENTLESS_LOG_SUBMISSION(GeneralConfig.AGENTLESS_LOG_SUBMISSION_ENABLED, false), |
127 | 128 | LLMOBS(LlmObsConfig.LLMOBS_ENABLED, false), |
128 | | - LLMOBS_AGENTLESS(LlmObsConfig.LLMOBS_AGENTLESS_ENABLED, false); |
| 129 | + LLMOBS_AGENTLESS(LlmObsConfig.LLMOBS_AGENTLESS_ENABLED, false), |
| 130 | + FEATURE_FLAGGING(FeatureFlaggingConfig.FLAGGING_PROVIDER_ENABLED, false); |
129 | 131 |
|
130 | 132 | private final String configKey; |
131 | 133 | private final String systemProp; |
@@ -184,6 +186,7 @@ public boolean isEnabledByDefault() { |
184 | 186 | private static boolean codeOriginEnabled = false; |
185 | 187 | private static boolean distributedDebuggerEnabled = false; |
186 | 188 | private static boolean agentlessLogSubmissionEnabled = false; |
| 189 | + private static boolean featureFlaggingEnabled = false; |
187 | 190 |
|
188 | 191 | private static void safelySetContextClassLoader(ClassLoader classLoader) { |
189 | 192 | try { |
@@ -268,6 +271,7 @@ public static void start( |
268 | 271 | codeOriginEnabled = isFeatureEnabled(AgentFeature.CODE_ORIGIN); |
269 | 272 | agentlessLogSubmissionEnabled = isFeatureEnabled(AgentFeature.AGENTLESS_LOG_SUBMISSION); |
270 | 273 | llmObsEnabled = isFeatureEnabled(AgentFeature.LLMOBS); |
| 274 | + featureFlaggingEnabled = isFeatureEnabled(AgentFeature.FEATURE_FLAGGING); |
271 | 275 |
|
272 | 276 | // setup writers when llmobs is enabled to accomodate apm and llmobs |
273 | 277 | if (llmObsEnabled) { |
@@ -662,6 +666,7 @@ public void execute() { |
662 | 666 | maybeStartDebugger(instrumentation, scoClass, sco); |
663 | 667 | maybeStartRemoteConfig(scoClass, sco); |
664 | 668 | maybeStartAiGuard(); |
| 669 | + maybeStartFeatureFlagging(scoClass, sco); |
665 | 670 |
|
666 | 671 | if (telemetryEnabled) { |
667 | 672 | startTelemetry(instrumentation, scoClass, sco); |
@@ -1083,6 +1088,23 @@ private static void maybeStartLLMObs(Instrumentation inst, Class<?> scoClass, Ob |
1083 | 1088 | } |
1084 | 1089 | } |
1085 | 1090 |
|
| 1091 | + private static void maybeStartFeatureFlagging(final Class<?> scoClass, final Object sco) { |
| 1092 | + if (featureFlaggingEnabled) { |
| 1093 | + StaticEventLogger.begin("Feature Flagging"); |
| 1094 | + |
| 1095 | + try { |
| 1096 | + final Class<?> ffSysClass = |
| 1097 | + AGENT_CLASSLOADER.loadClass("com.datadog.featureflag.FeatureFlaggingSystem"); |
| 1098 | + final Method ffSysMethod = ffSysClass.getMethod("start", scoClass); |
| 1099 | + ffSysMethod.invoke(null, sco); |
| 1100 | + } catch (final Throwable e) { |
| 1101 | + log.warn("Not starting Feature Flagging subsystem", e); |
| 1102 | + } |
| 1103 | + |
| 1104 | + StaticEventLogger.end("Feature Flagging"); |
| 1105 | + } |
| 1106 | + } |
| 1107 | + |
1086 | 1108 | private static void maybeInstallLogsIntake(Class<?> scoClass, Object sco) { |
1087 | 1109 | if (agentlessLogSubmissionEnabled) { |
1088 | 1110 | StaticEventLogger.begin("Logs Intake"); |
|
0 commit comments