[Trace] add opentelemetry (#2852)

* add opentelemetry

* add opentelemetry

* add opentelemetry on dequeue

* add opentelemetry on dequeue

* add opentelemetry on dequeue

---------

Co-authored-by: Jiang-Jia-Jun <163579578+Jiang-Jia-Jun@users.noreply.github.com>
This commit is contained in:
sg263
2025-07-16 15:33:25 +08:00
committed by GitHub
parent dda4a9f848
commit 42b80182e0
6 changed files with 181 additions and 5 deletions

View File

@@ -19,6 +19,9 @@ import re
import sys
import paddle
import subprocess
from setuptools import setup
from setuptools.command.install import install
from pathlib import Path
from pathlib import Path
from setuptools import Extension, find_packages, setup
from setuptools.command.build_ext import build_ext
@@ -140,6 +143,14 @@ class CMakeBuild(build_ext):
cwd=build_temp,
check=True)
class PostInstallCommand(install):
"""在标准安装完成后执行自定义命令"""
def run(self):
# 先执行标准安装步骤
install.run(self)
# 执行自定义命令
subprocess.check_call(["opentelemetry-bootstrap", "-a", "install"])
subprocess.check_call(["pip", "install", "opentelemetry-instrumentation-fastapi"])
def load_requirements():
"""Load dependencies from requirements.txt"""
@@ -183,6 +194,7 @@ def get_name():
cmdclass_dict = {'bdist_wheel': CustomBdistWheel}
cmdclass_dict['build_ext'] = CMakeBuild
FASTDEPLOY_VERSION = os.environ.get("FASTDEPLOY_VERSION", "2.0.0-dev")
cmdclass_dict['build_optl'] = PostInstallCommand
setup(
name=get_name(),
@@ -226,3 +238,4 @@ setup(
python_requires=">=3.7",
extras_require={"test": ["pytest>=6.0"]},
)