diff --git a/agentops/client.py b/agentops/client.py index fd1247ff..7463e6dd 100644 --- a/agentops/client.py +++ b/agentops/client.py @@ -69,6 +69,7 @@ def configure( auto_start_session: Optional[bool] = None, skip_auto_end_session: Optional[bool] = None, env_data_opt_out: Optional[bool] = None, + otel: Optional[OTELConfig] = None, ): if self.has_sessions: return logger.warning( @@ -87,6 +88,7 @@ def configure( auto_start_session=auto_start_session, skip_auto_end_session=skip_auto_end_session, env_data_opt_out=env_data_opt_out, + telemetry=otel, ) def initialize(self) -> Union[Session, None]: @@ -107,7 +109,7 @@ def initialize(self) -> Union[Session, None]: self._llm_tracker.override_api() # Initialize telemetry with configuration - self.telemetry.initialize(self._config.otel) + self.telemetry.initialize(self._config.telemetry) session = None if self._config.auto_start_session: diff --git a/agentops/config.py b/agentops/config.py index 5dc48d6b..5f0c809c 100644 --- a/agentops/config.py +++ b/agentops/config.py @@ -17,7 +17,7 @@ def __init__(self): self.auto_start_session: bool = True self.skip_auto_end_session: bool = False self.env_data_opt_out: bool = False - self.otel: OTELConfig = OTELConfig() # Default OTEL configuration + self.telemetry: OTELConfig = OTELConfig() # Default OTEL configuration def configure( self, @@ -32,7 +32,7 @@ def configure( auto_start_session: Optional[bool] = None, skip_auto_end_session: Optional[bool] = None, env_data_opt_out: Optional[bool] = None, - otel: Optional[OTELConfig] = None, # New parameter + telemetry: Optional[OTELConfig] = None, # New parameter ): if api_key is not None: try: @@ -77,5 +77,5 @@ def configure( self.env_data_opt_out = env_data_opt_out # OTEL configuration - if otel is not None: - self.otel = otel + if telemetry is not None: + self.telemetry = telemetry diff --git a/agentops/telemetry/client.py b/agentops/telemetry/client.py index 265823d8..0823b9dc 100644 --- a/agentops/telemetry/client.py +++ b/agentops/telemetry/client.py @@ -26,7 +26,7 @@ def __init__(self): self._session_exporters: Dict[UUID, ExportManager] = {} self.config: Optional[OTELConfig] = None - def initialize(self, config: Configuration) -> None: + def initialize(self, config: OTELConfig) -> None: """Initialize telemetry components""" # Check for environment variables if no exporters configured if not config.otel.additional_exporters: diff --git a/tests/test_telemetry_config.py b/tests/test_telemetry_config.py index af14804f..e071873a 100644 --- a/tests/test_telemetry_config.py +++ b/tests/test_telemetry_config.py @@ -13,10 +13,10 @@ def test_configuration_with_otel(): otel_config = OTELConfig(additional_exporters=[exporter]) config = Configuration() - config.configure(None, otel=otel_config) + config.configure(None, telemetry=otel_config) - assert config.otel == otel_config - assert config.otel.additional_exporters == [exporter] + assert config.telemetry == otel_config + assert config.telemetry.additional_exporters == [exporter] def test_init_accepts_telemetry_config(): @@ -75,7 +75,7 @@ def test_multiple_exporters_in_config(): telemetry = OTELConfig(additional_exporters=[exporter1, exporter2]) config = Configuration() - config.configure(None, otel=telemetry) + config.configure(None, telemetry=telemetry) - assert len(config.otel.additional_exporters) == 2 - assert config.otel.additional_exporters == [exporter1, exporter2] \ No newline at end of file + assert len(config.telemetry.additional_exporters) == 2 + assert config.telemetry.additional_exporters == [exporter1, exporter2]