@azbake/ingredient-app-insights

中文文档
0.1.115发布于 2024/07/25MITTypeScriptCommonJS近 30 天下载 4116

用于部署应用程序 Insights 资源实例的组件

中文使用文档
文档目录8 节
  1. 更改日志
  2. 概览
  3. 使用量
  4. 创建资源的路径
  5. 引用资源指南
  6. 公用事业
  7. appinsights 类
  8. 函数细节

更改日志

概览

应用程序 Insights 成份为 Bake 的插件. 当包含在食谱中时, 此插件将安装一个应用程序 Insights 资源实例 。 提供了一个区域参数,以便部署到特定区域。 arm.json ARM模板中的智能检测设置将关闭默认的电子邮件通知,但仍会启用智能检测提醒. 此外,《公约》的命名公约 故障异常 警报非常具体,如果修改,可能会产生重复警报。 最后,微软正在贬低智能检测设置,一旦发生,将视需要更新.

使用量

创建资源的路径

name: Deploys all Application Insights resources
#shortName will be a component of the resource group name.  ie <env><shortName> --> prodappinsights
shortName: appinsights
version: 0.0.2
ingredients:
  - "@azbake/ingredient-app-insights@~0"
resourceGroup: true
recipe:
  appinsights-property:
    properties:
      type: "@azbake/ingredient-app-insights"
      source: ""
      parameters:
        #App Insights resource name
        appInsightsName: "[appinsights.get_resource_name('property')]"

  appinsights-payroll:
    properties:
      type: "@azbake/ingredient-app-insights"
      source: ""
      parameters:
        #App Insights resource name
        appInsightsName: "[appinsights.get_resource_name('payroll')]"

引用资源指南

name: Deploys all Application Insights resources
#shortName will be a component of the resource group name.  ie <env><shortName> --> prodappinsights
shortName: propertywebappcontainer
version: 0.0.2
ingredients:
  - "@azbake/ingredient-webapp-container@~0"
  - "@azbake/ingredient-app-insights@~0"
resourceGroup: true
recipe:
  mypkg-web-site:
    properties:
      type: "@azbake/ingredient-webapp-container"
      source: "[coreutils.get_app_svc_name('ngapp')]"
      tokens:
        BASE_URL: "[coreutils.variable('svc_base_url')]"
        PROPERTY: "some value"
        APPINSIGHTS_INSTRUMENTATIONKEY: "[appinsights.get_instrumentation_key('property','appinsights')]"
      parameters:
        container_image_name: "myregistry.azurecr.io/mypkg:latest"
        container_registry_url: "[coreutils.variable('container_registry_url')]"
        container_registry_user: "[coreutils.variable('container_registry_user')]"
        container_registry_password: "[coreutils.variable('container_registry_password')]"

公用事业

工具课可以在烘焙内部使用. 参数和源值的 Yaml 文件 .

appinsights 类

函数说明
获取资源 名称 ()获得完整的 App Insights 资源名 .
获取 仪器 key ()获得 App Insights 仪器密钥.

函数细节

获取资源 名称 ()

通过传递一个短名获得一个完整的 App Insights 资源名. 格式返回 <environment_name>ai<shortname>。例如, prodaipayroll。 。 。 .

...
parameters:
  appInsightsName: "[appinsights.get_resource_name('payroll')]"
...

回返

字符串

获取 仪器 key ()

通过传递一个短名和资源组短名来获得 App Insights 仪器密钥.

当另一种成分需要参考在另一种配方中部署的 App Insights 资源时,这在配方内部是有用的. 在下面的例子中,仪器密钥是从一个名为"Aiproperty"的App Insights资源返回的,该资源属于一个名为"appinsights"的资源组.

...
      tokens:
        APPINSIGHTS_INSTRUMENTATIONKEY: "[appinsights.get_instrumentation_key('property','appinsights')]"
...

回返

字符串

□ 增编 此成分的 packet.json 文件包括依赖"@azure/ms-rest-js":"^1.8.1". 添加后, 事件枢纽和服务巴士命名空间将编译 。 这些成分参考版本为各自Azure Javascript SDK包的3.2 (@azure/arm-eventhub,@azure/arm-servicebus). 另一种办法是使用这两个包的第3.1版.

版本与发布记录

@azbake/ingredient-app-insights 共发布 52 个版本,首次发布于 2019/03/08;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.1.115latest2024/07/252 年前
0.1.1142023/02/023 年前
0.1.1132022/04/054 年前
0.1.1122022/04/054 年前
0.1.1112022/04/054 年前
0.1.1102022/04/054 年前

关于 @azbake/ingredient-app-insights 的常见问题

@azbake/ingredient-app-insights 是什么?

用于部署应用程序 Insights 资源实例的组件

如何安装 @azbake/ingredient-app-insights?

在项目目录运行 npm install @azbake/ingredient-app-insights,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@azbake/core(*)、@azure/ms-rest-nodeauth(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@azbake/ingredient-app-insights 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@azbake/ingredient-app-insights 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@azbake/ingredient-app-insights 可以商用吗?

@azbake/ingredient-app-insights 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@azbake/ingredient-app-insights 的下载量有多少?

根据 npm 官方下载统计,@azbake/ingredient-app-insights 在 2026/10/08 – 2026/11/06 这 30 天内被下载 4,116 次,日均约 137 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@azbake/ingredient-app-insights 还在维护吗?

最新版本 0.1.115 发布于 2024/07/25(2 年前);至今共发布 52 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/03/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。