0.1.114 • Published 1 year ago

@azbake/ingredient-app-insights v0.1.114

Weekly downloads
498
License
MIT
Repository
-
Last release
1 year ago

Changelogs

Overview

The Application Insights ingredient is a plugin for Bake. When included in a recipe, this plugin will install a instance of an Application Insights resource. A region parameter is provided to allow for a deployment to a specific region. The Smart Detection settings within the arm.json ARM template will turn off the default email notification but still leave the Smart Detection alerts enabled. Also, the naming convention for the Failure Anomalies alert is very specific and a duplicate alert may result if it is modified. Lastly, Microsoft is deprecating Smart Detection settings so this will be updated as needed once that occurs.

Usage

Recipe for creating a resource

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')]"

Recipe for referencing a resource

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')]"

Utilities

Utility classes can be used inside of the bake.yaml file for parameter and source values.

appinsights class

functiondescription
get_resource_name()Gets a full App Insights resource name.
get_instrumentation_key()Gets an App Insights instrumentation key.

Function Details

get_resource_name()

Gets an full App Insights resource name by passing a short name. Returns in the format <environment_name>ai<shortname>. For example, prodaipayroll.

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

Returns

string

get_instrumentation_key()

Gets an App Insights instrumentation key by passing a short name and resource group short name.

This is useful inside of a recipe when another ingredient needs to reference an App Insights resource deployed in a different recipe. In the example below, the instrumentation key is returned from an App Insights resource named aiproperty that's in a resource group named appinsights.

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

Returns

string

##Addendum The package.json file of this ingredient includes a dependency on "@azure/ms-rest-js": "^1.8.1". This was added so the Event Hub and Service Bus Namespace will compile. Those ingredients reference version 3.2 of their respective Azure Javascript SDK packages (@azure/arm-eventhub, @azure/arm-servicebus). An alternative is to use version 3.1 of those two packages.

0.1.114

1 year ago

0.1.113

2 years ago

0.1.110

2 years ago

0.1.112

2 years ago

0.1.111

2 years ago

0.1.109

2 years ago

0.1.108

2 years ago

0.1.107

4 years ago

0.1.106

4 years ago

0.1.105

4 years ago

0.1.104

4 years ago

0.1.103

4 years ago

0.1.102

4 years ago

0.1.101

4 years ago

0.1.99

4 years ago

0.1.98

4 years ago

0.1.97

4 years ago

0.1.96

4 years ago

0.1.95

4 years ago

0.1.92

4 years ago

0.1.87

4 years ago

0.1.75

5 years ago

0.1.70

5 years ago

0.1.69

5 years ago

0.1.68

5 years ago

0.1.67

5 years ago

0.1.65

5 years ago

0.1.64

5 years ago

0.1.62

5 years ago

0.1.59

5 years ago

0.1.55

5 years ago

0.1.53

5 years ago

0.1.47

5 years ago

0.1.46

5 years ago

0.1.45

5 years ago

0.1.44

5 years ago

0.1.42

5 years ago

0.1.41

5 years ago

0.1.38

5 years ago

0.1.37

5 years ago

0.1.36

5 years ago

0.1.34

5 years ago

0.1.33

5 years ago

0.1.32

5 years ago

0.1.31

5 years ago

0.1.30

5 years ago

0.1.29

5 years ago

0.1.28

5 years ago

0.1.27

5 years ago

0.1.26

5 years ago

0.1.25

5 years ago