Application Insights custom telemetry in Azure Bot Service - botframework

I have managed to add the AI dependencies and able to import/using in .csx files, but I'm not seeing any telemetry on the Application Insights resource.
All usage, Browser, Servers charts are empty except Failed requests and one custom event 'Activity'.
In my project.json I mentioned all AI dependencies like below:
{ "frameworks": {
"net46":{
"dependencies": {
"Microsoft.Bot.Builder.Azure": "3.1",
"Microsoft.ApplicationInsights": "2.1.0",
"Microsoft.ApplicationInsights.Agent.Intercept": "1.2.1",
"Microsoft.ApplicationInsights.Azure.WebSites": "2.1.3",
"Microsoft.ApplicationInsights.DependencyCollector": "2.1.0",
"Microsoft.ApplicationInsights.PerfCounterCollector": "2.1.0",
"Microsoft.ApplicationInsights.TraceListener": "2.1.0",
"Microsoft.ApplicationInsights.Web": "2.1.0",
"Microsoft.ApplicationInsights.WindowsServer": "2.1.0",
"Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel": "2.1.0",
"Microsoft.Web.Infrastructure": "1.0.0.0"
}
}
}
}
Then I tried to use a method like below in the Dialog class under MessageReceivedAsync:
await context.PostAsync($"{this.count++}: You said {message.Text}");
TelemetryClient telemetry = new TelemetryClient();
telemetry.TrackEvent("MessageReceivedAsync");
context.Wait(MessageReceivedAsync);
Can anyone help with implementing it?

Here's a reference to a working sample using Application Insights.
https://github.com/christopheranderson/azure-functions-app-insights-sample/tree/master/cs-http
I hope this helps!

Related

How to run a previously built Canvas API project in simulator/smart-display?

I am trying to clone an application, which is given in their document under canvas API section. They have given an option for sample walkthrough [https://developers.google.com/actions/interactivecanvas/sample-walkthrough]. I have followed every step but I am getting an error that my intents are not handled.
You can see the code at [github.com/actions-on-google/dialogflow-snowman-nodejs.git].
I have tried seeing all the intent handlers, Also, i have tried changing all the packages to the lastest one, as i have mentioned in the question.
I am using following packages:
{
"name": "snowman-canvas-sample-functions",
"description": "Snowman Actions on Google Interactive Canvas Sample Functions",
"license": "Apache-2.0",
"private": true,
"engines": {
"node": "8"
},
"dependencies": {
"actions-on-google": "preview",
"firebase-admin": "~5.13.1",
"firebase-functions": "^2.0.2"
},
"scripts": {
"lint": "./node_modules/.bin/eslint --fix \"**/*.js\"",
"start": "firebase serve --only functions",
"deploy": "firebase deploy --only functions",
"test": "npm run lint"
},
"devDependencies": {
"eslint": "^6.0.1",
"eslint-config-google": "^0.13.0"
}
}
i am getting "Dialogflow IntentHandler not found for intent: Welcome at Function" error in the welcome intent itself. Please assist me what should i try next.
You need to make sure your Dialogflow intent name and your Firebase Function intent handler name are the same.
From here, you'd need to implement a handler:
const { dialogflow } = require('actions-on-google')
const app = dialogflow()
app.intent('Welcome', conv => {
conv.ask('Welcome!')
})

TypeError: require.extensions.hasOwnProperty is not a function - on running gulp

I was trying to run gulp inside my project directory. I have gone through so many articles. Also try running most of given commands (as solutions) in cmd. But the same problem occurs.
if (!require.extensions.hasOwnProperty(ext)) {
^
TypeError: require.extensions.hasOwnProperty is not a function
This is how my package.json looks like.
{
"private": true,
"devDependencies": {
"gulp": "^3.9.1",
"laravel-elixir": "^2.3.13"
},
"dependencies": {
"bower": "^1.5.2",
"require-dir": "^1.2.0"
}
}
It would be great if anyone can help me to solve this.
Finally found an answer.
I just changed the below code line in <project>/node_modules/laravel-elixir/node_modules/require-dir/index.js file.
if (!require.extensions.hasOwnProperty(ext)) {
as:
if (!Object.prototype.hasOwnProperty.call(require.extensions, ext)) {
And it finally works now.
I fixed this by using a lesser version of node. I was getting this error when using node v 8.9.1. Fixed it by downgrading to 6.5.0. I use NVM to swap behind versions

Invalid Container 'DOMAIN_INSTALLABLE' in manifest

I am getting the following error message when trying to publish an app to G Suite Marketplace from Chrome developer dashboard. I am following this documentation.
Below is my manifest.json file.
{
"name": "Test Publishing",
"version": "1.0",
"manifest_version": 2,
"api_console_project_id": "poj_id",
"container": ["DOMAIN_INSTALLABLE"],
"app": {
"urls": [
"https://example.com/"
],
"launch": {
"web_url": "https://example.com"
}
},
"icons": {
"128": "example_icon_128.png"
}
}
Any idea on how to fix this? Is this now changed?
As you may know, G Suite extensions are being migrated from the Chrome Web Store to the G Suite Marketplace.
Web apps can now be published to the G Suite Marketplace directly from the Cloud Console without having to publish them in the Chrome Web Store. See the note at the top of https://developers.google.com/gsuite/marketplace/listing-gsm.

Error when using Nativescript's RadSideDrawer

I am trying to add the nativescript-telerik-ui and use the side drawer in a blank project. The project builds properly, but I am getting the error shown below if I try to run the code on a connected device:
The project was running correctly until I tried to use the drawer on one of the pages.
Here is my package.json:
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.drawertest",
"tns-android": {
"version": "2.4.1"
}
},
"dependencies": {
"nativescript-telerik-ui": "^1.5.1",
"nativescript-theme-core": "^0.2.1",
"tns-core-modules": "2.4.4"
},
"devDependencies": {
"babel-traverse": "6.21.0",
"babel-types": "6.21.0",
"babylon": "6.14.1",
"lazy": "1.0.11",
"nativescript-dev-android-snapshot": "^0.*.*"
}
}
I also tried running it in Genymotion. Here is the error I am getting there:
An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.drawertest/com.tns.NativeScriptActivity}: com.tns.NativeScriptException:
Calling js method onCreate failed
Error: Building UI from XML. #file:///app/main-page.xml:20:5
> Module 'ui/rad-side-drawer' not found for element 'RadSideDrawer'.
> com.tns.NativeScriptException: Failed to find module: "ui/rad-side-drawer", relative to: app/tns_modules/
com.tns.Module.resolvePathHelper(Module.java:159)
com.tns.Module.resolvePath(Module.java:60)
com.tns.Runtime.callJSMethodNative(Native Method)
com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1022)
com.tns.Runtime.callJSMethodImpl(Runtime.java:907)
com.tns.Runtime.callJSMethod(Runtime.java:895)
com.tns.Runtime.callJSMethod(Runtime.java:879)
com.tns.Runtime.callJSMethod(Runtime.java:871)
com.tns.NativeScriptActivity.onCreate(android.app.Activity.java)
android.app.Activity.performCreate(
I should probably mention that I getting similar error when I am trying to run the same code on my mac using the ios emulator.
What am I missing?
Thank you.
EDIT: It turns out I had a syntax error. Once corrected, everything worked as expected.
From the error log it looks like you have declared an incorrect namespace for the RadSideDrawer component ("ui/rad-side-drawer"). That component is part of the nativescript-telerik-ui plugin which can be found in the nativescript-telerik-ui-pro/sidedrawer module in the node_modules folder.
For more details you can take a look at the official documentation here.
Simply declare this namespace and use it when declaring the RadSideDrawer in the XML:
xmlns:drawer="nativescript-telerik-ui-pro/sidedrawer"

MVC 6 - Razor Views in Class Library tag "Model" with a does not exist error

Visual Studio (2015) is underlining all my references to "Model" in the Class Library Razor views and giving this error message:
The name "Model" does not exist in the current context
I have seen a lot of questions asking this sort of thing in an earlier version of ASP.Net and MVC but not much for this version.
Since these Razor views are setup as an embedded resource they are compiling fine and running fine. They just give me errors in the editor.
In the project.json file I have a reference to Razor Tools that I thought should fix this:
"dependencies": {
"ApolloWeb.Common": "1.0.0-*",
"Microsoft.AspNet.Mvc": "5.2.3",
"Microsoft.AspNetCore.Mvc.ViewFeatures": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.Extensions.FileProviders.Embedded": "1.0.0",
"NETStandard.Library": "1.6.1-preview1-24530-04"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"net46": {}
},
"buildOptions": {
"embed": [ "_Views/**" ],
"preserveCompilationContext": true
}
I have discovered what my issue was.
I copied all the packages that the MVC template pulled into the Main MVC project and started removing them until I reached the one that reproduced the issue.
I was missing a dependency on this package:
"Microsoft.AspNetCore.Mvc": "1.0.1",

Resources