处理遥测-j9九游会登录
http://localhost:{port},localhost是本地主机ip:127.0.0.1。
使用遥测 api 订阅后,扩展会自动开始通过遥测侦听器接收来自functiongraph的遥测数据。每个 post 请求正文都包含 event 对象数组。
订阅事件类型包括三大类:platform、function、extension。
|
类别 |
event type |
描述 |
|---|---|---|
|
平台事件 |
platform |
函数的执行情况 |
|
函数日志 |
function |
来自函数代码的日志 |
|
扩展日志 |
extension |
来自扩展代码的日志 |
platform类型事件包括以下几类:
|
类别 |
子类型 |
含义 |
数据结构 |
示例 |
|---|---|---|---|---|
|
开始调用事件 |
platform.initstart |
表示函数初始化阶段已开始 |
event: object - name: string = platform.initstart --事件类型 - starttime: string --开始时间 - traceid: string --调用id |
{ "name":"platform.initstart ", "starttime": "2023-02-01t00:03:50.000z ", "traceid": "69be64a7-0233-11e8-82e4-e5d37911193e" } |
|
platform.start |
表示函数调用阶段已开始 |
|||
|
platform.restorestart |
表示函数环境还原事件已启动 |
|||
|
调用完成事件 |
platform.initruntimedone, |
表示函数初始化阶段已完成 |
event: object - name: string = platform.initruntimedone --事件类型 - starttime: string --开始时间 - traceid: string --调用id - status: string --调用状态 |
{ "name": " platform.initruntimedone", "starttime": "2023-02-01t00:03:50.000z", "traceid": "69be64a7-0233-11e8-82e4-e5d37911193e", "status":" success ", } |
|
platform.runtimedone |
表示函数调用阶段已完成 |
|||
|
platform.restoreruntimedone |
表示函数环境还原事件已完成 |
|||
|
调用报告 |
platform.initreport |
包含函数初始化阶段的总体报告 |
event: object - name: string = platform.initreport | platform.report | platform.restorereport --事件类型 - starttime: string --开始时间 - traceid: string --调用id - endtime: string --结束时间 - status: string --调用状态 - metrics: reportmetrics --调用数据 reportmetrics: object - durationms: float64 --调用时长 - billingdurationms: float64 --计费时长 - memoryused: float64 --内存使用大小 - memorysize: int --内存大小 - podname: string --pod名 |
{ "name": " platform.initreport", "starttime": "2023-02-01t00:03:50.000z", "traceid": "69be64a7-0233-11e8-82e4-e5d37911193e", "endtime":" 2023-02-02t00:03:50.000z ", "status":" success ", "reportmetrics": { "durationms": 10.6, "billingdurationms": 11, "memoryused": 23.4, " memorysize ": 128, "podname": pool22-300-128-fusion-64774779-4g77v, } } |
|
platform.report |
包含函数调用阶段的总体报告 |
|||
|
platform.restorereport |
包含函数还原事件的总体报告 |
function类型事件:
|
类型 |
数据结构 |
示例 |
|---|---|---|
|
function |
event: object - name: string --事件类型 - starttime: string --开始时间 - logs: string --日志内容 |
对于需要采集的日志内容需要在日志中添加[function],例如:[function]this is a simple log. { "name": "function", "starttime": "2023-02-01t00:03:50.000z", "logs": "[function]this is a simple log." } |
extension类型事件:
|
类型 |
数据结构 |
示例 |
|---|---|---|
|
extension |
event: object - name: string --事件类型 - starttime: string --开始时间 - logs: string --日志内容 |
对于需要采集的日志内容需要在日志中添加[extension],例如:[extension]this is a simple log. { "name": "extension", "starttime": "2023-02-01t00:03:50.000z", "logs": "[extension]this is a simple log." } |
相关文档
意见反馈
文档内容是否对您有帮助?
如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨