microsoft-agents-a365-observability-extensions-semantic-kernel 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ # Copyright (c) Microsoft. All rights reserved.
@@ -0,0 +1,26 @@
1
+ # Copyright (c) Microsoft. All rights reserved.
2
+
3
+ # Custom Span Processor
4
+
5
+ from microsoft_agents_a365.observability.core.constants import GEN_AI_OPERATION_NAME_KEY
6
+ from microsoft_agents_a365.observability.core.inference_operation_type import InferenceOperationType
7
+ from microsoft_agents_a365.observability.core.utils import extract_model_name
8
+ from opentelemetry.sdk.trace.export import SpanProcessor
9
+
10
+
11
+ class SemanticKernelSpanProcessor(SpanProcessor):
12
+ """
13
+ SpanProcessor for SK
14
+ """
15
+
16
+ def __init__(self, service_name: str | None = None):
17
+ self.service_name = service_name
18
+
19
+ def on_start(self, span, parent_context):
20
+ if span.name.startswith("chat."):
21
+ span.set_attribute(GEN_AI_OPERATION_NAME_KEY, InferenceOperationType.CHAT.value.lower())
22
+ model_name = extract_model_name(span.name)
23
+ span.update_name(f"{InferenceOperationType.CHAT.value.lower()} {model_name}")
24
+
25
+ def on_end(self, span):
26
+ pass
@@ -0,0 +1,49 @@
1
+ # Copyright (c) Microsoft. All rights reserved.
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import Collection
6
+ from typing import Any
7
+
8
+ from microsoft_agents_a365.observability.core.config import get_tracer_provider, is_configured
9
+ from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
10
+
11
+ from microsoft_agents_a365.observability.extensions.semantickernel.span_processor import (
12
+ SemanticKernelSpanProcessor,
13
+ )
14
+
15
+ # -----------------------------
16
+ # 3) The Instrumentor class
17
+ # -----------------------------
18
+ _instruments = ("semantic-kernel >= 1.0.0",)
19
+
20
+
21
+ class SemanticKernelInstrumentor(BaseInstrumentor):
22
+ """
23
+ Instruments Semantic Kernel:
24
+ • Installs your custom OTel SpanProcessor
25
+ • (Optionally) attaches an SK function-invocation filter to enrich spans
26
+ """
27
+
28
+ def __init__(self):
29
+ if not is_configured():
30
+ raise RuntimeError(
31
+ "Microsoft Agent 365 (or your telemetry config) is not initialized. Configure it before instrumenting."
32
+ )
33
+ super().__init__()
34
+
35
+ def instrumentation_dependencies(self) -> Collection[str]:
36
+ return _instruments
37
+
38
+ def _instrument(self, **kwargs: Any) -> None:
39
+ """
40
+ kwargs (all optional):
41
+ """
42
+
43
+ # Ensure we have an SDK TracerProvider
44
+ provider = get_tracer_provider()
45
+ self._processor = SemanticKernelSpanProcessor()
46
+ provider.add_span_processor(self._processor)
47
+
48
+ def _uninstrument(self, **kwargs: Any) -> None:
49
+ pass
@@ -0,0 +1,70 @@
1
+ Metadata-Version: 2.4
2
+ Name: microsoft-agents-a365-observability-extensions-semantic-kernel
3
+ Version: 0.1.0
4
+ Summary: Semantic Kernel observability and tracing extensions for Microsoft Agent 365
5
+ Author-email: Microsoft <support@microsoft.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/microsoft/Agent365-python
8
+ Project-URL: Repository, https://github.com/microsoft/Agent365-python
9
+ Project-URL: Issues, https://github.com/microsoft/Agent365-python/issues
10
+ Project-URL: Documentation, https://github.com/microsoft/Agent365-python/tree/main/libraries/microsoft-agents-a365-observability-extensions-semantickernel
11
+ Keywords: observability,telemetry,tracing,opentelemetry,semantic-kernel,agents,ai
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: System :: Monitoring
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ Requires-Dist: microsoft-agents-a365-observability-core>=0.0.0
24
+ Requires-Dist: semantic-kernel>=1.0.0
25
+ Requires-Dist: opentelemetry-api>=1.36.0
26
+ Requires-Dist: opentelemetry-sdk>=1.36.0
27
+ Requires-Dist: opentelemetry-instrumentation>=0.47b0
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
30
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
31
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
32
+ Requires-Dist: black>=23.0.0; extra == "dev"
33
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
34
+ Provides-Extra: test
35
+ Requires-Dist: pytest>=7.0.0; extra == "test"
36
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
37
+
38
+ # microsoft-agents-a365-observability-extensions-semantickernel
39
+
40
+ [![PyPI](https://img.shields.io/pypi/v/microsoft-agents-a365-observability-extensions-semantickernel?label=PyPI&logo=pypi)](https://pypi.org/project/microsoft-agents-a365-observability-extensions-semantickernel)
41
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/microsoft-agents-a365-observability-extensions-semantickernel?label=Downloads&logo=pypi)](https://pypi.org/project/microsoft-agents-a365-observability-extensions-semantickernel)
42
+
43
+ Observability extensions for Semantic Kernel framework. This package provides OpenTelemetry tracing integration for Semantic Kernel-based applications with automatic instrumentation for kernel functions, plugins, and planners.
44
+
45
+ ## Installation
46
+
47
+ ```bash
48
+ pip install microsoft-agents-a365-observability-extensions-semantickernel
49
+ ```
50
+
51
+ ## Usage
52
+
53
+ For usage examples and detailed documentation, see the [Observability documentation](https://learn.microsoft.com/microsoft-agent-365/developer/observability?tabs=python) on Microsoft Learn.
54
+
55
+ ## Support
56
+
57
+ For issues, questions, or feedback:
58
+
59
+ - File issues in the [GitHub Issues](https://github.com/microsoft/Agent365-python/issues) section
60
+ - See the [main documentation](../../../README.md) for more information
61
+
62
+ ## Trademarks
63
+
64
+ *Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.*
65
+
66
+ ## License
67
+
68
+ Copyright (c) Microsoft Corporation. All rights reserved.
69
+
70
+ Licensed under the MIT License - see the [LICENSE](../../../LICENSE.md) file for details.
@@ -0,0 +1,7 @@
1
+ microsoft_agents_a365/observability/extensions/semantickernel/__init__.py,sha256=DtZPd4kiyAs3JNTgaJG_EyOMEvsiZEACMWjkesPCIEI,48
2
+ microsoft_agents_a365/observability/extensions/semantickernel/span_processor.py,sha256=N6liidrM2DqqdJSnKdsrguiVnBCabimuTSmX1-EIrz4,968
3
+ microsoft_agents_a365/observability/extensions/semantickernel/trace_instrumentor.py,sha256=fK5m0HjEQyMMpRxeiefd2T01lnixW90-Qu5B8GilJDI,1526
4
+ microsoft_agents_a365_observability_extensions_semantic_kernel-0.1.0.dist-info/METADATA,sha256=RQeQoPuRF46VYwiBJUW8AKA-KDRsO_UtCngzsFfX4KA,3714
5
+ microsoft_agents_a365_observability_extensions_semantic_kernel-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ microsoft_agents_a365_observability_extensions_semantic_kernel-0.1.0.dist-info/top_level.txt,sha256=G3c2_4sy5_EM_BWO67SbK2tKj4G8XFn-QXRbh8g9Lgk,22
7
+ microsoft_agents_a365_observability_extensions_semantic_kernel-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+