Skip to content

Commit e06a40a

Browse files
authored
Merge pull request #6 from microsoft/nikhilc/AddIntegrationTests
add integration tests
2 parents 8826464 + e7b7109 commit e06a40a

File tree

25 files changed

+1463
-840
lines changed

25 files changed

+1463
-840
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,20 @@ jobs:
112112
run: |
113113
A365_SDK_VERSION=${{ needs.version-number.outputs.PYTHON_PACKAGE_VERSION }} uv build --all-packages --wheel
114114
115-
- name: Run tests
115+
- name: Run unit tests
116116
run: |
117-
uv run --frozen python -m pytest tests/ -v --tb=short
117+
uv run --frozen python -m pytest tests/ -v --tb=short -m "not integration"
118+
119+
- name: Run integration tests
120+
# Only run integration tests if secrets are available
121+
if: ${{ vars.RUN_INTEGRATION_TESTS == 'true' }}
122+
run: |
123+
uv run --frozen python -m pytest tests/integration/ -v --tb=short -m integration
124+
env:
125+
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
126+
AZURE_OPENAI_ENDPOINT: ${{ vars.AZURE_OPENAI_ENDPOINT }}
127+
AZURE_OPENAI_DEPLOYMENT: ${{ vars.AZURE_OPENAI_DEPLOYMENT }}
128+
AZURE_OPENAI_API_VERSION: ${{ vars.AZURE_OPENAI_API_VERSION }}
118129

119130
# Copy package and samples to drop folder
120131
- name: Copy package and samples to drop folder

libraries/microsoft-agents-a365-observability-extensions-langchain/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The Microsoft Agent 365 LangChain Observability Extensions automatically instrum
4444

4545
```python
4646
from microsoft_agents_a365.observability.core.config import configure
47-
from microsoft_agents_a365.observability.extensions.langchain import KairoInstrumentorLangChain
47+
from microsoft_agents_a365.observability.extensions.langchain import CustomLangChainInstrumentor
4848

4949
# Configure observability
5050
configure(
@@ -53,7 +53,7 @@ configure(
5353
)
5454

5555
# Enable automatic instrumentation
56-
instrumentor = KairoInstrumentorLangChain()
56+
instrumentor = CustomLangChainInstrumentor()
5757
instrumentor.instrument()
5858

5959
# Your LangChain code is now automatically traced
@@ -84,7 +84,7 @@ instrumentor.instrument()
8484
```properties
8585
# Core observability settings
8686
ENABLE_OBSERVABILITY=true
87-
ENABLE_KAIRO_EXPORTER=true
87+
ENABLE_A365_OBSERVABILITY_EXPORTER=true
8888
PYTHON_ENVIRONMENT=production
8989

9090
# LangChain-specific settings

libraries/microsoft-agents-a365-observability-extensions-langchain/microsoft_agents_a365/observability/extensions/langchain/tracer_instrumentor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
import langchain_core
1010
import opentelemetry.trace as optel_trace
1111
from langchain_core.callbacks import BaseCallbackManager
12-
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
13-
from opentelemetry.trace import Span
14-
from wrapt import wrap_function_wrapper
15-
1612
from microsoft_agents_a365.observability.core.config import (
1713
get_tracer,
1814
get_tracer_provider,
1915
is_configured,
2016
)
17+
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
18+
from opentelemetry.trace import Span
19+
from wrapt import wrap_function_wrapper
20+
2121
from microsoft_agents_a365.observability.extensions.langchain.tracer import CustomLangChainTracer
2222

2323
_INSTRUMENTS: str = "langchain_core >= 0.1.0"
@@ -48,7 +48,7 @@ def _instrument(self, **kwargs: Any) -> None:
4848
tracer_name: str | None = kwargs.get("tracer_name")
4949
tracer_version: str | None = kwargs.get("tracer_version")
5050

51-
# Prefer the Kairo tracer; fall back to OpenTelemetry’s default if needed.
51+
# Prefer the Agent365 tracer; fall back to OpenTelemetry’s default if needed.
5252
try:
5353
tracer = get_tracer(tracer_name, tracer_version)
5454
except Exception:

libraries/microsoft-agents-a365-observability-extensions-langchain/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dependencies = [
3737
Homepage = "https://github.com/microsoft/Agent365"
3838
Repository = "https://github.com/microsoft/Agent365"
3939
Issues = "https://github.com/microsoft/Agent365/issues"
40-
Documentation = "https://github.com/microsoft/Agent365/tree/main/python/microsoft_kairo/observability/wrappers/langchain"
40+
Documentation = "https://github.com/microsoft/Agent365-python/tree/main/libraries/microsoft-agents-a365-observability-extensions-langchain"
4141

4242
[project.optional-dependencies]
4343
dev = [

libraries/microsoft-agents-a365-observability-extensions-openai/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ The Microsoft Agent 365 OpenAI Agents Observability Extensions automatically ins
4545

4646
```python
4747
from microsoft_agents_a365.observability.core.config import configure
48-
from microsoft_agents_a365.observability.extensions.openai_agents import KairoInstrumentorOpenAIAgents
48+
from microsoft_agents_a365.observability.extensions.openai_agents import OpenAIAgentsTraceInstrumentor
4949

5050
# Configure observability
5151
configure(
@@ -54,7 +54,7 @@ configure(
5454
)
5555

5656
# Enable automatic instrumentation
57-
instrumentor = KairoInstrumentorOpenAIAgents()
57+
instrumentor = OpenAIAgentsTraceInstrumentor()
5858
instrumentor.instrument()
5959

6060
# Your OpenAI Agents code is now automatically traced
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Copyright (c) Microsoft. All rights reserved.
22

33
"""
4-
Wraps the OpenAI Agents SDK tracer to integrate with our Kairo Telemetry Solution.
4+
Wraps the OpenAI Agents SDK tracer to integrate with our Agent365 Telemetry Solution.
55
"""
66

7-
from .trace_instrumentor import KairoInstrumentorOpenAIAgents
7+
from .trace_instrumentor import OpenAIAgentsTraceInstrumentor
88

9-
__all__ = ["KairoInstrumentorOpenAIAgents"]
9+
__all__ = ["OpenAIAgentsTraceInstrumentor"]

libraries/microsoft-agents-a365-observability-extensions-openai/microsoft_agents_a365/observability/extensions/openai/trace_instrumentor.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88

99
import opentelemetry.trace as optel_trace
1010
from agents import set_trace_processors
11+
from microsoft_agents_a365.observability.core import get_tracer, get_tracer_provider, is_configured
1112
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
1213
from opentelemetry.trace import Tracer
1314

14-
from microsoft_agents_a365.observability.core import get_tracer, get_tracer_provider, is_configured
15-
1615
from .trace_processor import OpenAIAgentsTraceProcessor
1716

1817
logging.basicConfig(level=logging.INFO)
@@ -21,51 +20,51 @@
2120
_instruments = ("openai-agents >= 0.2.6",)
2221

2322

24-
class KairoInstrumentorOpenAIAgents(BaseInstrumentor):
23+
class OpenAIAgentsTraceInstrumentor(BaseInstrumentor):
2524
"""
26-
Custom Trace Processor for OpenAI Agents SDK using Kairo.
27-
Forwards OpenAI Agents SDK traces and spans to Kairo's tracing scopes.
25+
Custom Trace Processor for OpenAI Agents SDK using Agent365.
26+
Forwards OpenAI Agents SDK traces and spans to Agent365's tracing scopes.
2827
2928
```
3029
"""
3130

3231
def __init__(self):
33-
"""Initialize the KairoInstrumentorOpenAIAgents.
34-
Raises: RuntimeError: If Kairo is not configured.
32+
"""Initialize the OpenAIAgentsTraceInstrumentor.
33+
Raises: RuntimeError: If Agent365 is not configured.
3534
"""
36-
# Verify if Kairo is configured
37-
kairo_status = is_configured()
38-
if not kairo_status:
35+
# Verify if Agent365 is configured
36+
Agent365_status = is_configured()
37+
if not Agent365_status:
3938
raise RuntimeError(
40-
"Kairo is not configured yet. Please configure Kairo before initializing this instrumentor."
39+
"Agent365 is not configured yet. Please configure Agent365 before initializing this instrumentor."
4140
)
4241
super().__init__()
4342

4443
def instrumentation_dependencies(self) -> Collection[str]:
4544
return _instruments
4645

4746
def _instrument(self, **kwargs: Any) -> None:
48-
"""Instruments the OpenAI Agents SDK with Kairo tracing."""
47+
"""Instruments the OpenAI Agents SDK with Agent365 tracing."""
4948
tracer_name = kwargs["tracer_name"] if kwargs.get("tracer_name") else None
5049
tracer_version = kwargs["tracer_version"] if kwargs.get("tracer_version") else None
5150

52-
# Get the configured Kairo Tracer
51+
# Get the configured Agent365 Tracer
5352
try:
5453
tracer = get_tracer(tracer_name, tracer_version)
5554
except Exception:
5655
# fallback
5756
tracer = optel_trace.get_tracer(tracer_name, tracer_version)
5857

59-
# Get the configured Kairo Tracer Provider instance
58+
# Get the configured Agent365 Tracer Provider instance
6059
try:
6160
get_tracer_provider()
6261
except Exception:
6362
# fallback
6463
optel_trace.get_tracer_provider()
6564

66-
kairo_tracer = cast(Tracer, tracer)
65+
agent365_tracer = cast(Tracer, tracer)
6766

68-
set_trace_processors([OpenAIAgentsTraceProcessor(kairo_tracer)])
67+
set_trace_processors([OpenAIAgentsTraceProcessor(agent365_tracer)])
6968

7069
def _uninstrument(self, **kwargs: Any) -> None:
7170
pass

libraries/microsoft-agents-a365-observability-extensions-openai/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependencies = [
3636
Homepage = "https://github.com/microsoft/Agent365"
3737
Repository = "https://github.com/microsoft/Agent365"
3838
Issues = "https://github.com/microsoft/Agent365/issues"
39-
Documentation = "https://github.com/microsoft/Agent365/tree/main/python/microsoft_kairo/observability/wrappers/openai_agents"
39+
Documentation = "https://github.com/microsoft/Agent365-python/tree/main/libraries/microsoft-agents-a365-observability-extensions-openai"
4040

4141
[project.optional-dependencies]
4242
dev = [

libraries/microsoft-agents-a365-observability-extensions-semantickernel/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The Microsoft Agent 365 Semantic Kernel Observability Extensions automatically i
4646

4747
```python
4848
from microsoft_agents_a365.observability.core.config import configure
49-
from microsoft_agents_a365.observability.extensions.semantic_kernel import KairoInstrumentorSemanticKernel
49+
from microsoft_agents_a365.observability.extensions.semantic_kernel import SemanticKernelInstrumentor
5050

5151
# Configure observability
5252
configure(
@@ -55,7 +55,7 @@ configure(
5555
)
5656

5757
# Enable automatic instrumentation
58-
instrumentor = KairoInstrumentorSemanticKernel()
58+
instrumentor = SemanticKernelInstrumentor()
5959
instrumentor.instrument()
6060

6161
# Your Semantic Kernel code is now automatically traced

libraries/microsoft-agents-a365-observability-extensions-semantickernel/microsoft_agents_a365/observability/extensions/semantickernel/trace_instrumentor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
from collections.abc import Collection
66
from typing import Any
77

8+
from microsoft_agents_a365.observability.core.config import get_tracer_provider, is_configured
89
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
910

10-
from microsoft_agents_a365.observability.core.config import get_tracer_provider, is_configured
1111
from microsoft_agents_a365.observability.extensions.semantickernel.span_processor import (
1212
SemanticKernelSpanProcessor,
1313
)
@@ -28,7 +28,7 @@ class SemanticKernelInstrumentor(BaseInstrumentor):
2828
def __init__(self):
2929
if not is_configured():
3030
raise RuntimeError(
31-
"Kairo (or your telemetry config) is not initialized. Configure it before instrumenting."
31+
"Agent365 (or your telemetry config) is not initialized. Configure it before instrumenting."
3232
)
3333
super().__init__()
3434

0 commit comments

Comments
 (0)