Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions lib/services/applicationinsightsQuery/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#git
.git
.gitignore
#gulp
gulpfile.js
#documentation
doc/
docs/
#dependencies
node_modules/
#samples
sample/
samples/
#tests
test/
tests/
coverage/
#tools and scripts
tools/
scripts/
#IDE settings
*.sln
.vscode/
.idea
.editorconfig
.ntvs_analysis.*
#build tools
.travis.yml
.jenkins.yml
.codeclimate.yml
appveyor.yml
# Nuget packages #
.nuget/
packages/
packages.config
90 changes: 90 additions & 0 deletions lib/services/applicationinsightsQuery/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Microsoft Azure SDK for isomorphic javascript - ApplicationInsightsDataClient
This project provides an isomorphic javascript package for accessing Azure. Right now it supports:
- node.js version 6.x.x or higher
- browser javascript

## How to Install

- nodejs
```
npm install
```
- browser
```html
<script type="text/javascript" src="https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/lib/services//applicationInsightsDataClientBundle.js"></script>
```

## How to use

### nodejs - Authentication, client creation and get metrics as an example written in TypeScript.

```javascript
import * as msRest from "ms-rest-js";
import * as msRestAzure from "ms-rest-azure-js";
import * as msRestNodeAuth from "ms-rest-nodeauth";
import { ApplicationInsightsDataClient, ApplicationInsightsDataModels, ApplicationInsightsDataMappers } from "";
const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"];

msRestNodeAuth.interactiveLogin().then((creds) => {
const client = new ApplicationInsightsDataClient(creds, subscriptionId);
const appId = "testappId";
const metricId = "requests/count";
const timespan = "testtimespan";
const interval = "P1Y2M3DT4H5M6S";
const aggregation = ["min"];
const segment = ["applicationBuild"];
const top = 1;
const orderby = "testorderby";
const filter = "testfilter";
client.metrics.get(appId, metricId, timespan, interval, aggregation, segment, top, orderby, filter).then((result) => {
console.log("The result is:");
console.log(result);
});
}).catch((err) => {
console.log('An error ocurred:');
console.dir(err, {depth: null, colors: true});
});
```

### browser - Authentication, client creation and get metrics as an example written in javascript.

- index.html
```html
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Todos</title>
<script type="text/javascript" src="https://raw.githubusercontent.com/Azure/ms-rest-js/master/msRestBundle.js"></script>
<script type="text/javascript" src="https://raw.githubusercontent.com/Azure/ms-rest-js/master/msRestAzureBundle.js"></script>
<script type="text/javascript" src="https://raw.githubusercontent.com/Azure/azure-sdk-for-js/master/lib/services//applicationInsightsDataClientBundle.js"></script>
<script type="text/javascript">
document.write('hello world');
const subscriptionId = "<Subscription_Id>";
const token = "<access_token>";
const creds = new msRest.TokenCredentials(token);
const client = new ApplicationInsightsDataClient(creds, undefined, subscriptionId);
const appId = "testappId";
const metricId = "requests/count";
const timespan = "testtimespan";
const interval = "P1Y2M3DT4H5M6S";
const aggregation = ["min"];
const segment = ["applicationBuild"];
const top = 1;
const orderby = "testorderby";
const filter = "testfilter";
client.metrics.get(appId, metricId, timespan, interval, aggregation, segment, top, orderby, filter).then((result) => {
console.log("The result is:");
console.log(result);
}).catch((err) => {
console.log('An error ocurred:');
console.dir(err, { depth: null, colors: true});
});
</script>
</head>
<body>
</body>
</html>
```

# Related projects
- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js)
Loading