Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobertoPrevato/6920fd94e2477744e84df16927a3b72f to your computer and use it in GitHub Desktop.
Save RobertoPrevato/6920fd94e2477744e84df16927a3b72f to your computer and use it in GitHub Desktop.
Postman Collections
{
"info": {
"_postman_id": "e5e56cc1-5903-495f-81f3-999e84f1e682",
"name": "Application Insights",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Track Event",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "[\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.Event\",\r\n \"time\": \"{{isoTime}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"EventData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"name\": \"Test event\",\r\n \"properties\": {\r\n \"foo\": \"bar\"\r\n },\r\n \"measurements\": {\r\n \"baz\": 42\r\n }\r\n }\r\n }\r\n }\r\n]"
},
"url": {
"raw": "https://dc.services.visualstudio.com/v2/track",
"protocol": "https",
"host": [
"dc",
"services",
"visualstudio",
"com"
],
"path": [
"v2",
"track"
]
}
},
"response": []
},
{
"name": "Track Exception",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "[\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.Exception\",\r\n \"time\": \"{{isoTime}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"ExceptionData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"exceptions\": [\r\n {\r\n \"id\": 1,\r\n \"outerId\": 0,\r\n \"typeName\": \"ZeroDivisionError\",\r\n \"message\": \"division by zero\",\r\n \"hasFullStack\": true,\r\n \"parsedStack\": [\r\n {\r\n \"level\": 0,\r\n \"method\": \"run\",\r\n \"assembly\": \"Main\",\r\n \"fileName\": \"C:/Root/personal/AiPlayground/main.py\",\r\n \"line\": 79\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n }\r\n }\r\n]"
},
"url": {
"raw": "https://dc.services.visualstudio.com/v2/track",
"protocol": "https",
"host": [
"dc",
"services",
"visualstudio",
"com"
],
"path": [
"v2",
"track"
]
}
},
"response": []
},
{
"name": "Track Message",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "[\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.Message\",\r\n \"time\": \"{{isoTime}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"MessageData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"message\": \"Something went wrong!\",\r\n \"severityLevel\": 2,\r\n \"properties\": {\r\n \"foo\": \"bar\"\r\n }\r\n }\r\n }\r\n }\r\n]"
},
"url": {
"raw": "https://dc.services.visualstudio.com/v2/track",
"protocol": "https",
"host": [
"dc",
"services",
"visualstudio",
"com"
],
"path": [
"v2",
"track"
]
}
},
"response": []
},
{
"name": "Track Metric",
"event": [
{
"listen": "prerequest",
"script": {
"id": "5407d0e0-09ec-41a7-b1e8-e3ebf65b579b",
"exec": [
"postman.setEnvironmentVariable('randomValue', Math.random() * (1500 - 75) + 75);"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "[\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.Metric\",\r\n \"time\": \"{{isoTime}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"MetricData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"metrics\": [\r\n {\r\n \"name\": \"ExampleMetric\",\r\n \"kind\": 1,\r\n \"value\": 252778.1572073296,\r\n \"count\": 500,\r\n \"min\": 0.35264551425273627,\r\n \"max\": 997.8918102173251,\r\n \"stdDev\": 286.73591883739743\r\n }\r\n ],\r\n \"properties\": {\r\n \"foo\": \"bar\"\r\n }\r\n }\r\n }\r\n }\r\n]"
},
"url": {
"raw": "https://dc.services.visualstudio.com/v2/track",
"protocol": "https",
"host": [
"dc",
"services",
"visualstudio",
"com"
],
"path": [
"v2",
"track"
]
}
},
"response": []
},
{
"name": "Track Metric Single",
"event": [
{
"listen": "prerequest",
"script": {
"id": "001970b5-297e-4ae7-a237-7db248ca4fa7",
"exec": [
"postman.setEnvironmentVariable('randomValue', Math.random() * (1500 - 75) + 75);"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "[\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.Metric\",\r\n \"time\": \"{{isoTime}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"MetricData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"metrics\": [\r\n {\r\n \"name\": \"ExampleMetric\",\r\n \"kind\": 1,\r\n \"value\": {{randomValue}},\r\n \"count\": 1,\r\n \"min\": null,\r\n \"max\": null,\r\n \"stdDev\": null\r\n }\r\n ],\r\n \"properties\": {\r\n \"foo\": \"bar\"\r\n }\r\n }\r\n }\r\n }\r\n]"
},
"url": {
"raw": "https://dc.services.visualstudio.com/v2/track",
"protocol": "https",
"host": [
"dc",
"services",
"visualstudio",
"com"
],
"path": [
"v2",
"track"
]
}
},
"response": []
},
{
"name": "Track PageView",
"event": [
{
"listen": "prerequest",
"script": {
"id": "ec839936-e8b1-47b1-9243-78fa2f7a6e33",
"exec": [
"postman.setEnvironmentVariable('randomDuration', Math.floor(Math.random() * (1500 - 75) + 75));"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "[\r\n {\r\n \"name\": \"Microsoft.ApplicationInsights.{{key}}.Pageview\",\r\n \"time\": \"{{isoTime}}\",\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.session.id\": \"+ikJK\",\r\n \"ai.device.id\": \"browser\",\r\n \"ai.device.type\": \"Browser\",\r\n \"ai.internal.sdkVersion\": \"javascript:1.0.20\",\r\n \"ai.user.id\": \"qYxbC\",\r\n \"ai.operation.id\": \"KrBHD\",\r\n \"ai.operation.name\": \"/\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"PageviewData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"name\": \"PageTitle - Homepage\",\r\n \"url\": \"https://mycats.eu/#/\",\r\n \"duration\": \"00:00:00.530\",\r\n \"id\": \"KrBHD\"\r\n }\r\n }\r\n },\r\n {\r\n \"time\": \"{{isoTime}}\",\r\n \"iKey\": \"{{key}}\",\r\n \"name\": \"Microsoft.ApplicationInsights.{{key}}.PageviewPerformance\",\r\n \"tags\": {\r\n \"ai.session.id\": \"+ikJK\",\r\n \"ai.device.id\": \"browser\",\r\n \"ai.device.type\": \"Browser\",\r\n \"ai.internal.sdkVersion\": \"javascript:1.0.20\",\r\n \"ai.user.id\": \"qYxbC\",\r\n \"ai.operation.id\": \"KrBHD\",\r\n \"ai.operation.name\": \"/\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"PageviewPerformanceData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"name\": \"PageTitle - Homepage\",\r\n \"url\": \"https://mycats.eu/#/\",\r\n \"duration\": \"00:00:00.530\",\r\n \"perfTotal\": \"00:00:00.530\",\r\n \"networkConnect\": \"00:00:00.120\",\r\n \"sentRequest\": \"00:00:00.052\",\r\n \"receivedResponse\": \"00:00:00.004\",\r\n \"domProcessing\": \"00:00:00.354\"\r\n }\r\n }\r\n }\r\n]"
},
"url": {
"raw": "https://dc.services.visualstudio.com/v2/track",
"protocol": "https",
"host": [
"dc",
"services",
"visualstudio",
"com"
],
"path": [
"v2",
"track"
]
}
},
"response": []
},
{
"name": "Track Operation with Correlations",
"event": [
{
"listen": "prerequest",
"script": {
"id": "ec839936-e8b1-47b1-9243-78fa2f7a6e33",
"exec": [
"var now = new Date(), nowTime = now.getTime();",
"postman.setEnvironmentVariable('isoTime1',(new Date(nowTime + 120)).toISOString());",
"postman.setEnvironmentVariable('isoTime2',(new Date(nowTime + 220)).toISOString());",
"postman.setEnvironmentVariable('isoTime3',(new Date(nowTime + 320)).toISOString());",
"postman.setEnvironmentVariable('isoTime4',(new Date(nowTime + 520)).toISOString());",
"postman.setEnvironmentVariable('isoTime5',(new Date(nowTime + 650)).toISOString());",
"",
"postman.setEnvironmentVariable('random_request_duration', Math.floor(Math.random() * (1500 - 75) + 75));",
"postman.setEnvironmentVariable('page_view_duration', Math.floor(Math.random() * (1500 - 75) + 75));",
"",
"var duration = ((Math.random() * (59 - 1) + 1)/100).toString();",
"postman.setEnvironmentVariable('dependency_duration', duration.substr(0, duration.indexOf('.')+7));",
"",
"duration = ((Math.random() * (59 - 1) + 1)/100).toString();",
"postman.setEnvironmentVariable('dependency_duration2', duration.substr(0, duration.indexOf('.')+7));",
"",
"duration = ((Math.random() * (59 - 1) + 1)/100).toString();",
"postman.setEnvironmentVariable('dependency_duration3', duration.substr(0, duration.indexOf('.')+7));",
"",
"function guid() {",
" function s4() {",
" return Math.floor((1 + Math.random()) * 0x10000)",
" .toString(16)",
" .substring(1);",
" }",
" return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();",
"}",
"",
"function pick(arr) {",
" return arr[Math.floor(Math.random() * arr.length)];",
"}",
"",
"postman.setEnvironmentVariable('operation_id', guid());",
"postman.setEnvironmentVariable('dependency_id', guid());",
"postman.setEnvironmentVariable('dependency_id2', guid());",
"postman.setEnvironmentVariable('dependency_id3', guid());",
"postman.setEnvironmentVariable('request_id', guid());",
"postman.setEnvironmentVariable('page_view_id', guid());",
"postman.setEnvironmentVariable('user_id', 'Derpina');",
"postman.setEnvironmentVariable('user_sex', 'F');",
"postman.setEnvironmentVariable('session_id', (new Date().toLocaleDateString()));",
"postman.setEnvironmentVariable('device_id', 'ServerOne');",
"postman.setEnvironmentVariable('cloud_role', 'MyRole');",
"postman.setEnvironmentVariable('cloud_role_instance', 'MyRoleInstance');",
"",
"var browsers = ['Chrome', 'Firefox', 'Edge', 'Explorer', 'Opera'];",
"var countries = ['Italy', 'Denmark', 'Poland'];",
"",
"postman.setEnvironmentVariable('browser_type', pick(browsers));",
"postman.setEnvironmentVariable('country', 'Poland')//pick(countries));",
"",
"",
"",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "[\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.PageView\",\r\n \"time\": \"{{isoTime}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.device.id\": \"browser\",\r\n \"ai.device.type\": \"Browser\",\r\n \"ai.device.model\": \"{{browser_type}}\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\",\r\n \"ai.user.id\": \"{{user_id}}\",\r\n \"ai.session.id\": \"{{session_id}}\",\r\n \"ai.operation.id\": \"{{operation_id}}\",\r\n \"ai.operation.parentId\": \"{{operation_id}}\",\r\n \"ai.operation.name\": \"/cats-list\",\r\n \"ai.location.country\": \"{{country}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"PageViewData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"url\": \"/Cats-list\",\r\n \"name\": \"PageTitle - Cats List\",\r\n \"duration\": {{page_view_duration}},\r\n \"properties\": {\r\n \t\"user_sex\": \"{{user_sex}}\"\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"time\": \"{{isoTime1}}\",\r\n \"iKey\": \"{{key}}\",\r\n \"name\": \"Microsoft.ApplicationInsights.PageviewPerformance\",\r\n \"tags\": {\r\n \"ai.session.id\": \"{{session_id}}\",\r\n \"ai.device.id\": \"browser\",\r\n \"ai.device.type\": \"Browser\",\r\n \"ai.device.model\": \"{{browser_type}}\",\r\n \"ai.internal.sdkVersion\": \"javascript:1.0.20\",\r\n \"ai.user.id\": \"{{user_id}}\",\r\n \"ai.operation.id\": \"{{operation_id}}\",\r\n \"ai.operation.name\": \"/Cats-list\",\r\n \"ai.location.country\": \"{{country}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"PageviewPerformanceData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"name\": \"PageTitle - Cats List\",\r\n \"url\": \"https://myCats.eu/Cats-list\",\r\n \"duration\": \"00:00:00.530\",\r\n \"perfTotal\": \"00:00:00.530\",\r\n \"networkConnect\": \"00:00:00.120\",\r\n \"sentRequest\": \"00:00:00.052\",\r\n \"receivedResponse\": \"00:00:00.004\",\r\n \"domProcessing\": \"00:00:00.354\",\r\n \"properties\": {\r\n \t \"user_sex\": \"{{user_sex}}\"\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.RemoteDependency\",\r\n \"time\": \"{{isoTime1}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.user.id\": \"{{user_id}}\",\r\n \"ai.session.id\": \"{{session_id}}\",\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\",\r\n \"ai.operation.id\": \"{{operation_id}}\",\r\n \"ai.operation.parentId\": \"{{operation_id}}\",\r\n \"ai.location.country\": \"{{country}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"RemoteDependencyData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"name\": \"GET /all-cats\",\r\n \"id\": \"{{dependency_id}}\",\r\n \"resultCode\": \"200\",\r\n \"duration\": \"00.00:00:{{dependency_duration}}\",\r\n \"success\": true,\r\n \"data\": \"GET /all-cats?anything-in-query=foo\",\r\n \"target\": \"animals-demo-api.fake\",\r\n \"type\": \"Ajax\",\r\n \"properties\": {\r\n \t \"user_sex\": \"{{user_sex}}\"\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.Request\",\r\n \"time\": \"{{isoTime2}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.user.id\": \"{{user_id}}\",\r\n \"ai.session.id\": \"{{session_id}}\",\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\",\r\n \"ai.operation.id\": \"{{operation_id}}\",\r\n \"ai.operation.parentId\": \"{{dependency_id}}\",\r\n \"ai.cloud.role\": \"{{cloud_role}}\",\r\n \"ai.cloud.roleInstance\": \"{{cloud_role_instance}}\",\r\n \"ai.location.country\": \"{{country}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"RequestData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"id\": \"{{request_id}}\",\r\n \"name\": \"GetAllCats\",\r\n \"duration\": \"00:00:00.{{random_request_duration}}\",\r\n \"responseCode\": \"200\",\r\n \"success\": true,\r\n \"url\": \"/api/v1/all-cats\",\r\n \"properties\": {\r\n \t \"user_sex\": \"{{user_sex}}\"\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.RemoteDependency\",\r\n \"time\": \"{{isoTime3}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.user.id\": \"{{user_id}}\",\r\n \"ai.session.id\": \"{{session_id}}\",\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\",\r\n \"ai.operation.id\": \"{{operation_id}}\",\r\n \"ai.operation.parentId\": \"{{request_id}}\",\r\n \"ai.cloud.role\": \"{{cloud_role}}\",\r\n \"ai.cloud.roleInstance\": \"{{cloud_role_instance}}\",\r\n \"ai.location.country\": \"{{country}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"RemoteDependencyData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"name\": \"GET /table/all-cats\",\r\n \"id\": \"{{dependency_id2}}\",\r\n \"resultCode\": \"200\",\r\n \"duration\": \"00.00:00:{{dependency_duration2}}\",\r\n \"success\": true,\r\n \"data\": \"Example\",\r\n \"target\": \"https://example/table/allcats\",\r\n \"type\": \"Azure table\",\r\n \"properties\": {\r\n \t \"user_sex\": \"{{user_sex}}\"\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.RemoteDependency\",\r\n \"time\": \"{{isoTime4}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.user.id\": \"{{user_id}}\",\r\n \"ai.session.id\": \"{{session_id}}\",\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\",\r\n \"ai.operation.id\": \"{{operation_id}}\",\r\n \"ai.operation.parentId\": \"{{request_id}}\",\r\n \"ai.cloud.role\": \"{{cloud_role}}\",\r\n \"ai.cloud.roleInstance\": \"{{cloud_role_instance}}\",\r\n \"ai.location.country\": \"{{country}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"RemoteDependencyData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"name\": \"/queue/cats-seen\",\r\n \"id\": \"{{dependency_id3}}\",\r\n \"resultCode\": \"200\",\r\n \"duration\": \"00.00:00:{{dependency_duration3}}\",\r\n \"success\": true,\r\n \"data\": \"Example\",\r\n \"target\": \"https://example/queue/seenanimals\",\r\n \"type\": \"Azure queue\",\r\n \"properties\": {\r\n \t \"user_sex\": \"{{user_sex}}\"\r\n }\r\n }\r\n }\r\n }\r\n]"
},
"url": {
"raw": "https://dc.services.visualstudio.com/v2/track",
"protocol": "https",
"host": [
"dc",
"services",
"visualstudio",
"com"
],
"path": [
"v2",
"track"
]
}
},
"response": []
},
{
"name": "Track Operation with Correlations Copy",
"event": [
{
"listen": "prerequest",
"script": {
"id": "ec839936-e8b1-47b1-9243-78fa2f7a6e33",
"exec": [
"var now = new Date(), nowTime = now.getTime();",
"postman.setEnvironmentVariable('isoTime1',(new Date(nowTime + 120)).toISOString());",
"postman.setEnvironmentVariable('isoTime2',(new Date(nowTime + 220)).toISOString());",
"postman.setEnvironmentVariable('isoTime3',(new Date(nowTime + 320)).toISOString());",
"postman.setEnvironmentVariable('isoTime4',(new Date(nowTime + 520)).toISOString());",
"postman.setEnvironmentVariable('isoTime5',(new Date(nowTime + 650)).toISOString());",
"",
"postman.setEnvironmentVariable('random_request_duration', Math.floor(Math.random() * (1500 - 75) + 75));",
"postman.setEnvironmentVariable('page_view_duration', Math.floor(Math.random() * (1500 - 75) + 75));",
"",
"var duration = ((Math.random() * (59 - 1) + 1)/100).toString();",
"postman.setEnvironmentVariable('dependency_duration', duration.substr(0, duration.indexOf('.')+7));",
"",
"duration = ((Math.random() * (59 - 1) + 1)/100).toString();",
"postman.setEnvironmentVariable('dependency_duration2', duration.substr(0, duration.indexOf('.')+7));",
"",
"duration = ((Math.random() * (59 - 1) + 1)/100).toString();",
"postman.setEnvironmentVariable('dependency_duration3', duration.substr(0, duration.indexOf('.')+7));",
"",
"function guid() {",
" function s4() {",
" return Math.floor((1 + Math.random()) * 0x10000)",
" .toString(16)",
" .substring(1);",
" }",
" return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();",
"}",
"",
"function pick(arr) {",
" return arr[Math.floor(Math.random() * arr.length)];",
"}",
"",
"postman.setEnvironmentVariable('operation_id', guid());",
"postman.setEnvironmentVariable('dependency_id', guid());",
"postman.setEnvironmentVariable('dependency_id2', guid());",
"postman.setEnvironmentVariable('dependency_id3', guid());",
"postman.setEnvironmentVariable('request_id', guid());",
"postman.setEnvironmentVariable('page_view_id', guid());",
"postman.setEnvironmentVariable('user_id', 'Derp');",
"postman.setEnvironmentVariable('user_sex', 'M');",
"postman.setEnvironmentVariable('session_id', (new Date().toLocaleDateString()));",
"postman.setEnvironmentVariable('device_id', 'ServerOne');",
"postman.setEnvironmentVariable('cloud_role', 'MyRole');",
"postman.setEnvironmentVariable('cloud_role_instance', 'MyRoleInstance');",
"",
"var browsers = ['Chrome', 'Firefox', 'Edge', 'Explorer', 'Opera'];",
"var countries = ['Italy', 'Denmark', 'Poland'];",
"",
"postman.setEnvironmentVariable('browser_type', pick(browsers));",
"postman.setEnvironmentVariable('country', 'Poland')//pick(countries));",
"",
"",
"",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "[\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.PageView\",\r\n \"time\": \"{{isoTime}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.device.id\": \"browser\",\r\n \"ai.device.type\": \"Browser\",\r\n \"ai.device.model\": \"{{browser_type}}\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\",\r\n \"ai.user.id\": \"{{user_id}}\",\r\n \"ai.session.id\": \"{{session_id}}\",\r\n \"ai.operation.id\": \"{{operation_id}}\",\r\n \"ai.operation.parentId\": \"{{operation_id}}\",\r\n \"ai.operation.name\": \"/dogs-list\",\r\n \"ai.location.country\": \"{{country}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"PageViewData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"url\": \"/dogs-list\",\r\n \"name\": \"PageTitle - dogs List\",\r\n \"duration\": {{page_view_duration}},\r\n \"properties\": {\r\n \t\"user_sex\": \"{{user_sex}}\"\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"time\": \"{{isoTime1}}\",\r\n \"iKey\": \"{{key}}\",\r\n \"name\": \"Microsoft.ApplicationInsights.PageviewPerformance\",\r\n \"tags\": {\r\n \"ai.session.id\": \"{{session_id}}\",\r\n \"ai.device.id\": \"browser\",\r\n \"ai.device.type\": \"Browser\",\r\n \"ai.device.model\": \"{{browser_type}}\",\r\n \"ai.internal.sdkVersion\": \"javascript:1.0.20\",\r\n \"ai.user.id\": \"{{user_id}}\",\r\n \"ai.operation.id\": \"{{operation_id}}\",\r\n \"ai.operation.name\": \"/dogs-list\",\r\n \"ai.location.country\": \"{{country}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"PageviewPerformanceData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"name\": \"PageTitle - dogs List\",\r\n \"url\": \"https://mydogs.eu/dogs-list\",\r\n \"duration\": \"00:00:00.530\",\r\n \"perfTotal\": \"00:00:00.530\",\r\n \"networkConnect\": \"00:00:00.120\",\r\n \"sentRequest\": \"00:00:00.052\",\r\n \"receivedResponse\": \"00:00:00.004\",\r\n \"domProcessing\": \"00:00:00.354\",\r\n \"properties\": {\r\n \t \"user_sex\": \"{{user_sex}}\"\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.RemoteDependency\",\r\n \"time\": \"{{isoTime1}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.user.id\": \"{{user_id}}\",\r\n \"ai.session.id\": \"{{session_id}}\",\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\",\r\n \"ai.operation.id\": \"{{operation_id}}\",\r\n \"ai.operation.parentId\": \"{{operation_id}}\",\r\n \"ai.location.country\": \"{{country}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"RemoteDependencyData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"name\": \"GET /all-dogs\",\r\n \"id\": \"{{dependency_id}}\",\r\n \"resultCode\": \"200\",\r\n \"duration\": \"00.00:00:{{dependency_duration}}\",\r\n \"success\": true,\r\n \"data\": \"GET /all-dogs?anything-in-query=foo\",\r\n \"target\": \"animals-demo-api.fake\",\r\n \"type\": \"Ajax\",\r\n \"properties\": {\r\n \t \"user_sex\": \"{{user_sex}}\"\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.Request\",\r\n \"time\": \"{{isoTime2}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.user.id\": \"{{user_id}}\",\r\n \"ai.session.id\": \"{{session_id}}\",\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\",\r\n \"ai.operation.id\": \"{{operation_id}}\",\r\n \"ai.operation.parentId\": \"{{dependency_id}}\",\r\n \"ai.cloud.role\": \"{{cloud_role}}\",\r\n \"ai.cloud.roleInstance\": \"{{cloud_role_instance}}\",\r\n \"ai.location.country\": \"{{country}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"RequestData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"id\": \"{{request_id}}\",\r\n \"name\": \"GetAlldogs\",\r\n \"duration\": \"00:00:00.{{random_request_duration}}\",\r\n \"responseCode\": \"200\",\r\n \"success\": true,\r\n \"url\": \"/api/v1/all-dogs\",\r\n \"properties\": {\r\n \t \"user_sex\": \"{{user_sex}}\"\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.RemoteDependency\",\r\n \"time\": \"{{isoTime3}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.user.id\": \"{{user_id}}\",\r\n \"ai.session.id\": \"{{session_id}}\",\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\",\r\n \"ai.operation.id\": \"{{operation_id}}\",\r\n \"ai.operation.parentId\": \"{{request_id}}\",\r\n \"ai.cloud.role\": \"{{cloud_role}}\",\r\n \"ai.cloud.roleInstance\": \"{{cloud_role_instance}}\",\r\n \"ai.location.country\": \"{{country}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"RemoteDependencyData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"name\": \"GET /table/all-dogs\",\r\n \"id\": \"{{dependency_id2}}\",\r\n \"resultCode\": \"200\",\r\n \"duration\": \"00.00:00:{{dependency_duration2}}\",\r\n \"success\": true,\r\n \"data\": \"Example\",\r\n \"target\": \"https://example/table/alldogs\",\r\n \"type\": \"Azure table\",\r\n \"properties\": {\r\n \t \"user_sex\": \"{{user_sex}}\"\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.RemoteDependency\",\r\n \"time\": \"{{isoTime4}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.user.id\": \"{{user_id}}\",\r\n \"ai.session.id\": \"{{session_id}}\",\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\",\r\n \"ai.operation.id\": \"{{operation_id}}\",\r\n \"ai.operation.parentId\": \"{{request_id}}\",\r\n \"ai.cloud.role\": \"{{cloud_role}}\",\r\n \"ai.cloud.roleInstance\": \"{{cloud_role_instance}}\",\r\n \"ai.location.country\": \"{{country}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"RemoteDependencyData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"name\": \"/queue/dogs-seen\",\r\n \"id\": \"{{dependency_id3}}\",\r\n \"resultCode\": \"200\",\r\n \"duration\": \"00.00:00:{{dependency_duration3}}\",\r\n \"success\": true,\r\n \"data\": \"Example\",\r\n \"target\": \"https://example/queue/seenanimals\",\r\n \"type\": \"Azure queue\",\r\n \"properties\": {\r\n \t \"user_sex\": \"{{user_sex}}\"\r\n }\r\n }\r\n }\r\n }\r\n]"
},
"url": {
"raw": "https://dc.services.visualstudio.com/v2/track",
"protocol": "https",
"host": [
"dc",
"services",
"visualstudio",
"com"
],
"path": [
"v2",
"track"
]
}
},
"response": []
},
{
"name": "Track Dependency",
"event": [
{
"listen": "prerequest",
"script": {
"id": "b5a14b0e-8161-4b06-abd3-be3384b6981d",
"exec": [
"var duration = (Math.random() * (59 - 1) + 1).toString();",
"postman.setEnvironmentVariable('randomDuration', duration.substr(0, duration.indexOf('.')+7));"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "[\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.RemoteDependency\",\r\n \"time\": \"{{isoTime}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"RemoteDependencyData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"name\": \"FooDependency\",\r\n \"id\": \"8a1d9d02-d1be-4789-b71b-ae9ceb2e901f\",\r\n \"resultCode\": \"200\",\r\n \"duration\": \"00.00:00:{{randomDuration}}\",\r\n \"success\": true,\r\n \"data\": \"Example\",\r\n \"target\": \"https://dependency-location-example.pl\",\r\n \"type\": \"Azure table\",\r\n \"properties\": {\r\n \"foo\": \"bar\"\r\n },\r\n \"measurements\": {\r\n \"baz\": 55\r\n }\r\n }\r\n }\r\n }\r\n]"
},
"url": {
"raw": "https://dc.services.visualstudio.com/v2/track",
"protocol": "https",
"host": [
"dc",
"services",
"visualstudio",
"com"
],
"path": [
"v2",
"track"
]
}
},
"response": []
},
{
"name": "Track Request",
"event": [
{
"listen": "prerequest",
"script": {
"id": "bc150486-8dfe-4469-b696-c2dd890e2d0c",
"exec": [
"postman.setEnvironmentVariable('randomDuration', Math.floor(Math.random() * (1500 - 75) + 75));",
"",
"function guid() {",
" function s4() {",
" return Math.floor((1 + Math.random()) * 0x10000)",
" .toString(16)",
" .substring(1);",
" }",
" return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();",
"}",
"",
"postman.setEnvironmentVariable('requestId', guid());"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "[\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.Request\",\r\n \"time\": \"{{isoTime}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"RequestData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"id\": \"{{requestId}}\",\r\n \"name\": \"GetCats\",\r\n \"duration\": \"00:00:00.{{randomDuration}}\",\r\n \"responseCode\": \"200\",\r\n \"success\": true,\r\n \"url\": \"/api/v1/cats\",\r\n \"properties\": {\r\n \"foo\": \"bar\"\r\n },\r\n \"measurements\": {\r\n \"baz\": 55\r\n }\r\n }\r\n }\r\n }\r\n]"
},
"url": {
"raw": "https://dc.services.visualstudio.com/v2/track",
"protocol": "https",
"host": [
"dc",
"services",
"visualstudio",
"com"
],
"path": [
"v2",
"track"
]
}
},
"response": []
},
{
"name": "Track Failed Request",
"event": [
{
"listen": "prerequest",
"script": {
"id": "f98d2a67-7da1-44df-91e3-67c93cb697c2",
"exec": [
"postman.setEnvironmentVariable('randomDuration', Math.floor(Math.random() * (1500 - 75) + 75));",
"",
"function guid() {",
" function s4() {",
" return Math.floor((1 + Math.random()) * 0x10000)",
" .toString(16)",
" .substring(1);",
" }",
" return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();",
"}",
"",
"postman.setEnvironmentVariable('requestId', guid());"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "[\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.Request\",\r\n \"time\": \"{{isoTime}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"RequestData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"id\": \"{{requestId}}\",\r\n \"name\": \"GetCat\",\r\n \"duration\": \"00:00:00.{{randomDuration}}\",\r\n \"responseCode\": \"404\",\r\n \"success\": false,\r\n \"url\": \"/api/v1/cat/rum%20tum%20tugger\"\r\n }\r\n }\r\n }\r\n]"
},
"url": {
"raw": "https://dc.services.visualstudio.com/v2/track",
"protocol": "https",
"host": [
"dc",
"services",
"visualstudio",
"com"
],
"path": [
"v2",
"track"
]
}
},
"response": []
},
{
"name": "Track Availability",
"event": [
{
"listen": "prerequest",
"script": {
"id": "5dd4f3b8-2043-47b6-90bc-59a7d18c4c00",
"exec": [
"postman.setEnvironmentVariable('randomDuration', Math.floor(Math.random() * (1500 - 75) + 75));",
"",
"function guid() {",
" function s4() {",
" return Math.floor((1 + Math.random()) * 0x10000)",
" .toString(16)",
" .substring(1);",
" }",
" return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();",
"}",
"",
"postman.setEnvironmentVariable('requestId', guid());"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "[\r\n {\r\n \"ver\": 1,\r\n \"name\": \"Microsoft.ApplicationInsights.Availability\",\r\n \"time\": \"{{isoTime}}\",\r\n \"sampleRate\": 100.0,\r\n \"iKey\": \"{{key}}\",\r\n \"tags\": {\r\n \"ai.device.id\": \"{{device_id}}\",\r\n \"ai.device.locale\": \"en_GB\",\r\n \"ai.device.osVersion\": \"10.0.15063\",\r\n \"ai.device.type\": \"Other\",\r\n \"ai.internal.sdkVersion\": \"{{sdk_version}}\"\r\n },\r\n \"data\": {\r\n \"baseType\": \"AvailabilityData\",\r\n \"baseData\": {\r\n \"ver\": 2,\r\n \"id\": \"{{requestId}}\",\r\n \"name\": \"IsAlive\",\r\n \"duration\": \"00:00:02.{{randomDuration}}\",\r\n \"success\": true,\r\n \"runLocation\": \"West Europe\",\r\n \"message\": \"All good!\"\r\n }\r\n }\r\n }\r\n]"
},
"url": {
"raw": "https://dc.services.visualstudio.com/v2/track",
"protocol": "https",
"host": [
"dc",
"services",
"visualstudio",
"com"
],
"path": [
"v2",
"track"
]
}
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "ceab8a5c-f278-41be-929b-3f42be0794c5",
"type": "text/javascript",
"exec": [
"postman.setEnvironmentVariable('isoTime',(new Date()).toISOString());",
""
]
}
},
{
"listen": "test",
"script": {
"id": "018c193a-99bb-48f3-baa8-7a95232e121a",
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"id": "f63bdafd-20b6-4e7d-b958-c09b5a8f70c5",
"key": "key",
"value": "74fa8682-1c8a-4f45-9d16-960eb08819f1",
"type": "string"
},
{
"id": "a00c40e3-b642-4e63-b3b8-32fe74a67e74",
"key": "device_id",
"value": "ExampleDevice",
"type": "string"
},
{
"id": "5384bf56-58c7-4923-8ee2-af06b73651fb",
"key": "sdk_version",
"value": "postman:0.0.1",
"type": "string"
}
]
}
@RobertoPrevato
Copy link
Author

Postman collection to play with Azure Application Insights.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment