Skip to content

Commit

Permalink
[Azure Monitor Exporter] Add resource and outputs for ARM template to…
Browse files Browse the repository at this point in the history
… fix pipeline build (#16390)

* add resource and outputs for arm template

* fix

* update version

* fix pipeline

* stop server
  • Loading branch information
xiao-lix authored Jul 15, 2021
1 parent 1ea3955 commit ee94883
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ import http from "http";
* HTTP SERVER SETUP
**********************************************************************/
/** Starts a HTTP server that receives requests on sample server port. */
let server: http.Server;
function startServer(port: number) {
// Creates a server
const server = http.createServer(handleRequest);
server = http.createServer(handleRequest);
// Starts the server
server.listen(port, () => {
console.log(`Node HTTP listening on ${port}`);
Expand Down Expand Up @@ -74,6 +75,8 @@ function handleRequest(request: any, response: any) {
setTimeout(() => {
span.end();
response.end("Hello World!");
// terminate the process to stop CI pipeline from running forever
server.close();
}, 2000);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ const http = require("http");
* HTTP SERVER SETUP
**********************************************************************/
/** Starts a HTTP server that receives requests on sample server port. */
let server;
function startServer(port) {
// Creates a server
const server = http.createServer(handleRequest);
server = http.createServer(handleRequest);
// Starts the server
server.listen(port, () => {
console.log(`Node HTTP listening on ${port}`);
Expand Down Expand Up @@ -74,6 +75,8 @@ function handleRequest(request, response) {
setTimeout(() => {
span.end();
response.end("Hello World!");
// terminate the process to stop CI pipeline from running forever
server.close();
}, 2000);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ import http from "http";
* HTTP SERVER SETUP
**********************************************************************/
/** Starts a HTTP server that receives requests on sample server port. */
let server: http.Server;
function startServer(port: number) {
// Creates a server
const server = http.createServer(handleRequest);
server = http.createServer(handleRequest);
// Starts the server
server.listen(port, () => {
console.log(`Node HTTP listening on ${port}`);
Expand Down Expand Up @@ -74,6 +75,8 @@ function handleRequest(request: any, response: any) {
setTimeout(() => {
span.end();
response.end("Hello World!");
// terminate the process to stop CI pipeline from running forever
server.close();
}, 2000);
});
}
Expand Down
17 changes: 16 additions & 1 deletion sdk/monitor/test-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"logReaderRoleId": "73c42c96-874c-492b-b04d-ab87d138a893",
"metricPublisherRoleId": "3913510d-42f4-4e42-8a64-420c390055eb",
"workspaceName": "[concat(parameters('baseName'), '-logs')]",
"secondaryWorkspaceName": "[concat(parameters('baseName'), '-logs2')]"
"secondaryWorkspaceName": "[concat(parameters('baseName'), '-logs2')]",
"appInsightsName": "[concat(parameters('baseName'), '-ai')]"
},
"resources": [
{
Expand Down Expand Up @@ -92,6 +93,16 @@
"principalId": "[parameters('testApplicationOid')]",
"scope": "[resourceGroup().id]"
}
},
{
"type": "Microsoft.Insights/components",
"apiVersion": "2015-05-01",
"location": "[parameters('location')]",
"name": "[variables('appInsightsName')]",
"properties": {
"Application_Type": "web",
"applicationId": "[variables('appInsightsName')]"
}
}
],
"outputs": {
Expand All @@ -114,6 +125,10 @@
"METRICS_RESOURCE_NAMESPACE": {
"value": "Microsoft.OperationalInsights/workspaces",
"type": "string"
},
"APPLICATIONINSIGHTS_CONNECTION_STRING": {
"value": "[reference(resourceId('Microsoft.Insights/components', variables('appInsightsName')), '2015-05-01').ConnectionString]",
"type": "string"
}
}
}

0 comments on commit ee94883

Please sign in to comment.