From 6b26ede3f29d83d9dbf5b6eb8c36ce75efb58e5c Mon Sep 17 00:00:00 2001 From: jerevoss Date: Mon, 22 May 2023 16:22:32 -0700 Subject: [PATCH] Separated attach. Need to include new test location for repo auto tests --- .../CHANGELOG.md | 6 ++ .../autoinstrumentation/__init__.py | 0 .../autoinstrumentation/_configurator.py | 0 .../autoinstrumentation/_distro.py | 0 .../autoinstrumentation/_version.py | 7 ++ .../tests/autoinstrumentation/test_distro.py | 0 .../setup.py | 100 ++++++++++++++++++ azure-monitor-opentelemetry/setup.py | 8 -- 8 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 azure-monitor-opentelemetry-autoinstrumentation/CHANGELOG.md rename {azure-monitor-opentelemetry => azure-monitor-opentelemetry-autoinstrumentation}/azure/monitor/opentelemetry/autoinstrumentation/__init__.py (100%) rename {azure-monitor-opentelemetry => azure-monitor-opentelemetry-autoinstrumentation}/azure/monitor/opentelemetry/autoinstrumentation/_configurator.py (100%) rename {azure-monitor-opentelemetry => azure-monitor-opentelemetry-autoinstrumentation}/azure/monitor/opentelemetry/autoinstrumentation/_distro.py (100%) create mode 100644 azure-monitor-opentelemetry-autoinstrumentation/azure/monitor/opentelemetry/autoinstrumentation/_version.py rename {azure-monitor-opentelemetry => azure-monitor-opentelemetry-autoinstrumentation/azure/monitor/opentelemetry/autoinstrumentation}/tests/autoinstrumentation/test_distro.py (100%) create mode 100644 azure-monitor-opentelemetry-autoinstrumentation/setup.py diff --git a/azure-monitor-opentelemetry-autoinstrumentation/CHANGELOG.md b/azure-monitor-opentelemetry-autoinstrumentation/CHANGELOG.md new file mode 100644 index 00000000..829abc24 --- /dev/null +++ b/azure-monitor-opentelemetry-autoinstrumentation/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog + +## 1.0.0b1 (Unreleased) + +- Separate from distro + ([#286](https://github.com/microsoft/ApplicationInsights-Python/pull/286)) \ No newline at end of file diff --git a/azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/__init__.py b/azure-monitor-opentelemetry-autoinstrumentation/azure/monitor/opentelemetry/autoinstrumentation/__init__.py similarity index 100% rename from azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/__init__.py rename to azure-monitor-opentelemetry-autoinstrumentation/azure/monitor/opentelemetry/autoinstrumentation/__init__.py diff --git a/azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/_configurator.py b/azure-monitor-opentelemetry-autoinstrumentation/azure/monitor/opentelemetry/autoinstrumentation/_configurator.py similarity index 100% rename from azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/_configurator.py rename to azure-monitor-opentelemetry-autoinstrumentation/azure/monitor/opentelemetry/autoinstrumentation/_configurator.py diff --git a/azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/_distro.py b/azure-monitor-opentelemetry-autoinstrumentation/azure/monitor/opentelemetry/autoinstrumentation/_distro.py similarity index 100% rename from azure-monitor-opentelemetry/azure/monitor/opentelemetry/autoinstrumentation/_distro.py rename to azure-monitor-opentelemetry-autoinstrumentation/azure/monitor/opentelemetry/autoinstrumentation/_distro.py diff --git a/azure-monitor-opentelemetry-autoinstrumentation/azure/monitor/opentelemetry/autoinstrumentation/_version.py b/azure-monitor-opentelemetry-autoinstrumentation/azure/monitor/opentelemetry/autoinstrumentation/_version.py new file mode 100644 index 00000000..045176f5 --- /dev/null +++ b/azure-monitor-opentelemetry-autoinstrumentation/azure/monitor/opentelemetry/autoinstrumentation/_version.py @@ -0,0 +1,7 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License in the project root for +# license information. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/azure-monitor-opentelemetry/tests/autoinstrumentation/test_distro.py b/azure-monitor-opentelemetry-autoinstrumentation/azure/monitor/opentelemetry/autoinstrumentation/tests/autoinstrumentation/test_distro.py similarity index 100% rename from azure-monitor-opentelemetry/tests/autoinstrumentation/test_distro.py rename to azure-monitor-opentelemetry-autoinstrumentation/azure/monitor/opentelemetry/autoinstrumentation/tests/autoinstrumentation/test_distro.py diff --git a/azure-monitor-opentelemetry-autoinstrumentation/setup.py b/azure-monitor-opentelemetry-autoinstrumentation/setup.py new file mode 100644 index 00000000..b0dce15e --- /dev/null +++ b/azure-monitor-opentelemetry-autoinstrumentation/setup.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python + +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + + +import os +import re + +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-monitor-opentelemetry-autoinstrumentation" +PACKAGE_PPRINT_NAME = ( + "Azure Monitor Opentelemetry Distro for Auto-Instrumentation" +) + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace("-", "/") + + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + + try: + ver = azure.__version__ + raise Exception( + "This package is incompatible with azure=={}. ".format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, "_version.py"), "r") as fd: + version = re.search( + r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE + ).group(1) + +if not version: + raise RuntimeError("Cannot find version information") + +setup( + name=PACKAGE_NAME, + version=version, + description="Microsoft {} Client Library for Python".format( + PACKAGE_PPRINT_NAME + ), + long_description=open("README.md", "r").read(), + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="ascl@microsoft.com", + url="https://github.com/microsoft/ApplicationInsights-Python/tree/main/azure-monitor-opentelemetry", + classifiers=[ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "License :: OSI Approved :: MIT License", + ], + zip_safe=False, + packages=find_packages( + exclude=[ + "tests", + "samples", + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + "azure.monitor", + "azure.monitor.opentelemetry", + ] + ), + include_package_data=True, + package_data={ + "pytyped": ["py.typed"], + }, + python_requires=">=3.7", + install_requires=[ + "azure-monitor-opentelemetry>=1.0.0b12", + ], + entry_points={ + "opentelemetry_distro": [ + "azure_monitor_opentelemetry_distro = azure.monitor.opentelemetry.autoinstrumentation._distro:AzureMonitorDistro" + ], + "opentelemetry_configurator": [ + "azure_monitor_opentelemetry_configurator = azure.monitor.opentelemetry.autoinstrumentation._configurator:AzureMonitorConfigurator" + ], + }, +) diff --git a/azure-monitor-opentelemetry/setup.py b/azure-monitor-opentelemetry/setup.py index b53f370b..26237361 100644 --- a/azure-monitor-opentelemetry/setup.py +++ b/azure-monitor-opentelemetry/setup.py @@ -96,12 +96,4 @@ "opentelemetry-api==1.17.0", "opentelemetry-sdk==1.17.0", ], - entry_points={ - "opentelemetry_distro": [ - "azure_monitor_opentelemetry_distro = azure.monitor.opentelemetry.autoinstrumentation._distro:AzureMonitorDistro" - ], - "opentelemetry_configurator": [ - "azure_monitor_opentelemetry_configurator = azure.monitor.opentelemetry.autoinstrumentation._configurator:AzureMonitorConfigurator" - ], - }, )