9 Replies Latest reply on Nov 30, 2018 5:07 AM by Stephen Crocker

    Azure Application insights

    Stephen Crocker

      Has anyone every connected to Azure Application Insights?  I've been asked to connect to this and get information into tableau?

        • 1. Re: Azure Application insights
          Patrick A Van Der Hyde

          Hello Stephen, 

           

          Did you encounter any issues trying to connect to this data source?   is Azure Application insights something different than one of the other Azure connections supported? 

           

          Using Tableau with Microsoft Azure: Resources and case studies

           

          Patrick 

          • 2. Re: Azure Application insights
            Stephen Crocker

            I was able to get the data coming back into tableau.  I still have a question on the amount of data and how to get around it,   I'm only getting last 7 days I have tried last 30 days and it doesn't bring back that much information.  but the code is working fine.

            • 3. Re: Azure Application insights
              Mark Powell

              Did you build your own connector for Tableau or is there one available to use?

              • 4. Re: Azure Application insights
                Stephen Crocker

                I ended up creating my own connector.  it was a bit weird and out of the ordinary and doesn't do exactly what I want but it's working for now.  it's not keeping All of the history but i'm getting over 30 days right now so hopefully it's good.  I'll have to wait it out.  I think I might be clearing my array when I run it, which is why it's not keeping all of the data.  Azure only let's you pull 500 records at a time so I've filtered a ton of junk out of the return statement.

                1 of 1 people found this helpful
                • 5. Re: Azure Application insights
                  Mark Powell

                  OK thanks, I wondered if a custom connector was the only way or if there was one publicly available

                  • 6. Re: Azure Application insights
                    Stephen Crocker

                    Nope so far I had to roll-my-own

                    • 7. Re: Azure Application insights
                      Louise van Loo

                      I am also looking to connect to Azure Application Insights to Tableau and apparently they have a REST API that lets you connect to it like Odata. https://dev.applicationinsights.io/documentation/Using-the-API/Events

                      Anyone has experience with this?

                      • 8. Re: Azure Application insights
                        Mark Powell

                        I have only through using Power Query to connect via Excel and Power BI (sorry not Tableau yet!), but next step is to connect to Tableau.

                         

                        You might find the Power Query export handy as it does give you the API endpoint for the data you are wanting to query

                        Export to Power BI from Azure Application Insights | Microsoft Docs

                        • 9. Re: Azure Application insights
                          Stephen Crocker

                          Here is the code I'm using just attach this to your html file and replace the url and key and you should be good to go.

                           

                          (function () {

                           

                              //1: *******************************

                              // Create the connector object

                              var myConnector = tableau.makeConnector();

                           

                              //2: *******************************

                              // Define the schema

                              myConnector.getSchema = function (schemaCallback) {

                                  var cols = [{

                                      id: "timestamp",

                                      alias: "Accessed Date",

                                      dataType: tableau.dataTypeEnum.string

                                  }, {

                                      id: "userID",

                                      alias: "Name",

                                      dataType: tableau.dataTypeEnum.string

                                  }, {

                                      id: "url",

                                      alias: "url",

                                      dataType: tableau.dataTypeEnum.string

                                  }];

                           

                                  var tableSchema = {

                                      id: "Analytics",

                                      alias: "DoITrade-Analytics",

                                      columns: cols

                                  };

                           

                                  schemaCallback([tableSchema]);

                              };

                           

                              //3: ******************************

                              // Fetch and Download the data

                              myConnector.getData = function (table, doneCallback) {

                                  var settings = {

                                      "async": true,

                                      "crossDomain": true,

                                      "url": "<your url with the query in the url here>",

                                 

                                      "method": "GET",

                                      "headers": {

                                          "x-api-key": "<your key here>",

                                          "Cache-Control": "no-cache"

                                      }

                                  };

                           

                                  $.ajax(settings).done(function (resp) {

                                      console.log(resp);

                                      var feat = resp.value,

                                          tableData = [];

                           

                                      // Iterate over the JSON object

                                      for (var i = 0, len = feat.length; i < len; i++) {

                                          tableData.push({

                                              "timestamp": feat[i].timestamp,

                                              "userID": feat[i].user.id,

                                              "url": feat[i].request.url

                                          });

                                      }

                           

                                      table.appendRows(tableData);

                                      doneCallback();

                                  });

                              };

                           

                              //4: *************************************

                              tableau.registerConnector(myConnector);

                           

                              //5: ***************************************************

                              // Create event listeners for when the user submits the form

                              $(document).ready(function () {

                                  $("#submitButton").click(function () {

                                      tableau.connectionName = "DoITradeAnalytics"; // This will be the data source name in Tableau

                                      tableau.submit(); // This sends the connector object to Tableau

                                  });

                              });

                          })();

                           

                           

                          Hope this helps

                          1 of 1 people found this helpful