# apm-tutorial-python **Repository Path**: baihr/apm-tutorial-python ## Basic Information - **Project Name**: apm-tutorial-python - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-26 - **Last Updated**: 2026-05-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # apm-tutorial-python > 本项目修改自 [apm-tutorial-python](https://github.com/DataDog/apm-tutorial-python), 删除 PG 依赖,重构逻辑,增加 API 使用示例。 ## 克隆项目 ```bash mkdir ~/workspace cd ~/workspace git clone https://gitee.com/baihr/apm-tutorial-python.git ``` ## 部署 Python3 暂略 ## 创建运行环境 ```bash cd ~/workspace/apm-tutorial-python # 创建虚拟环境 python3 -m venv venv # 激活虚拟环境 source venv/bin/activate # 安装依赖 pip install -r requirements.txt ``` ## 启动程序 ```bash cd ~/workspace/apm-tutorial-python # 不启用追踪 bash scripts/start-notes.sh bash scripts/start-calendar.sh # 启用追踪 bash scripts/start-notes-with-trace.sh bash scripts/start-calendar-with-trace.sh ``` ## REST APIs ### Calendar Application ```bash # 返回一个随机日期 # GET /calendar # {"status":"success","date":"3/22/2022"} curl "http://localhost:9090/calendar" ``` ## Notes Application ```bash # 返回笔记列表 # GET /notes/ # [{ "id": 0, "description": "Hello, this is a note." }] curl "http://localhost:8080/notes" # 新增笔记 # POST /notes # { "id": 1, "description": "ImANote" } curl -X POST "http://localhost:8080/notes?desc=ImANote" # 新增笔记,但是从 Calendar 服务获取时间 # { "id": 2, "description": "HiImANoteWithDate. Message Date: 09/21/2022" } curl -X POST "http://localhost:8080/notes?desc=ImANoteWithDate&add_date=y" # 根据 ID 返回笔记 # GET /notes?id # { "id": 1, "description": "ImANote" } curl "http://localhost:8080/notes?id=1" # 更新笔记 # PUT /notes?id # { "id": 1, "description": "UpdatedNote" } curl -X PUT "http://localhost:8080/notes?id=1&desc=UpdatedNote" # 删除笔记 # DELETE /notes?id # { "message": "note with id 4 deleted." } curl -X DELETE "http://localhost:8080/notes?id=1" ```