Summary
The AgentFrameworkInstrumentor calls enable_instrumentation() with no arguments, which means enable_sensitive_data defaults to False. There is no way to pass enable_sensitive_data=True through the distro's instrumentation_options API.
Current Behavior
# In AgentFrameworkInstrumentor._instrument():
from agent_framework.observability import enable_instrumentation
enable_instrumentation() # No kwargs forwarded
The only ways to enable sensitive data capture are:
- Set
ENABLE_SENSITIVE_DATA=true env var before use_microsoft_opentelemetry() is called (ordering-dependent, undocumented)
- Call
enable_instrumentation(enable_sensitive_data=True) separately after setup (bypasses the distro API)
Expected Behavior
instrumentation_options should support forwarding enable_sensitive_data to enable_instrumentation():
use_microsoft_opentelemetry(
instrumentation_options={
"agent_framework": {"enabled": True, "enable_sensitive_data": True}
},
)
This would keep the default as False (secure by default) while providing a discoverable, documented opt-in path through the existing API surface.
Suggested Fix
In AgentFrameworkInstrumentor._instrument(), read the option from kwargs and forward it:
def _instrument(self, **kwargs: Any) -> None:
try:
from agent_framework.observability import enable_instrumentation
options = kwargs.get("instrumentation_options", {}).get("agent_framework", {})
enable_sensitive_data = options.get("enable_sensitive_data", False)
enable_instrumentation(enable_sensitive_data=enable_sensitive_data)
self._af_instrumentation_enabled = True
except ImportError as exc:
...
Note: The distro's _setup_instrumentations currently calls instrumentor().instrument(skip_dep_check=True) without forwarding instrumentation_options, so the plumbing to pass options through would also need updating in _distro.py.
Rationale
- The distro is meant to be the single-entry-point setup API. Abstracting
enabled but not enable_sensitive_data is inconsistent.
- The env var workaround has a subtle ordering dependency that's easy to get wrong.
- Default remains secure (
False); this just adds discoverability.
Environment
microsoft-opentelemetry 1.0.0
agent-framework 1.2.2
- Python 3.10
Summary
The
AgentFrameworkInstrumentorcallsenable_instrumentation()with no arguments, which meansenable_sensitive_datadefaults toFalse. There is no way to passenable_sensitive_data=Truethrough the distro'sinstrumentation_optionsAPI.Current Behavior
The only ways to enable sensitive data capture are:
ENABLE_SENSITIVE_DATA=trueenv var beforeuse_microsoft_opentelemetry()is called (ordering-dependent, undocumented)enable_instrumentation(enable_sensitive_data=True)separately after setup (bypasses the distro API)Expected Behavior
instrumentation_optionsshould support forwardingenable_sensitive_datatoenable_instrumentation():This would keep the default as
False(secure by default) while providing a discoverable, documented opt-in path through the existing API surface.Suggested Fix
In
AgentFrameworkInstrumentor._instrument(), read the option from kwargs and forward it:Note: The distro's
_setup_instrumentationscurrently callsinstrumentor().instrument(skip_dep_check=True)without forwardinginstrumentation_options, so the plumbing to pass options through would also need updating in_distro.py.Rationale
enabledbut notenable_sensitive_datais inconsistent.False); this just adds discoverability.Environment
microsoft-opentelemetry1.0.0agent-framework1.2.2