wso2 - Wso2 apim 自定义指标
问题描述
我们计划部署 apim 并按自定义指标(请求正文的属性之一中的字符数)向开发人员收费。是否可以在不修改 apim 源的情况下做到这一点?
解决方案
您可以使用以下方法执行此操作。
- 添加全局或 API 级别的自定义中介策略 - https://apim.docs.wso2.com/en/latest/learn/api-gateway/message-mediation/sharing-the-default-mediation-flow-of-api-请求/#creating-per-api-mediation-policies
您可以编写一个类中介来读取请求正文并进行任何计算。然后以异步方式将数据发布到另一个服务。
推荐阅读
- python - 从另一个字典的特定值创建新的 Python 字典
- python - 我想在嵌套列表 Python 中追加列表
- javascript - 如何为单词设置动画,使每个字母都改变颜色
- python - 每第 n 个 xtick 标签使 Matplotlib 日期 xtick 标签更加稀疏(散布)
- python - 当我在 Pycharm 中运行此代码时,我没有得到任何输出,它只是显示-----进程以退出代码 0 完成。请帮我解决这个问题
- sql - PostgreSQL。如果某列中的值出现两次或更多次,则排除行
- aws-lambda - DDB Stream 在本地调用 Lambda?
- python - 用 Python 编写 Discord 机器人 - 我有多个 client.events,但一次只有一个有效
- php - 我有一个 if 语句,但我有问题
- python - discord py - 如果用户收到新排名,则发送消息(on_member_update)