Adding support for documentation generation and added some documentation to the main readme.

This commit is contained in:
Jakub Oleksy 2014-12-19 18:42:46 -08:00
Родитель 00d0cc5ed2
Коммит 9866f16a85
3 изменённых файлов: 68 добавлений и 5 удалений

Просмотреть файл

@ -24,7 +24,6 @@ Make sure you add the require statement to pull in the library:
require_once 'vendor/autoload.php'; require_once 'vendor/autoload.php';
``` ```
## Usage ## ## Usage ##
Once installed, you can send telemetry to Application Insights. Here are a few samples. Once installed, you can send telemetry to Application Insights. Here are a few samples.
@ -32,7 +31,7 @@ Once installed, you can send telemetry to Application Insights. Here are a few s
>**Note**: before you can send data to you will need an instrumentation key. Please see the [Getting an Application Insights Instrumentation Key](https://github.com/Microsoft/AppInsights-Home/wiki#getting-an-application-insights-instrumentation-key) section for more information. >**Note**: before you can send data to you will need an instrumentation key. Please see the [Getting an Application Insights Instrumentation Key](https://github.com/Microsoft/AppInsights-Home/wiki#getting-an-application-insights-instrumentation-key) section for more information.
**Sending a simple event telemetry item** **Initializing the client and setting the instrumentation key**
```php ```php
$telemetryClient = new \ApplicationInsights\Telemetry_Client(); $telemetryClient = new \ApplicationInsights\Telemetry_Client();
$telemetryClient->getContext()->setInstrumentationKey('YOUR INSTRUMENTATION KEY'); $telemetryClient->getContext()->setInstrumentationKey('YOUR INSTRUMENTATION KEY');
@ -40,10 +39,57 @@ $telemetryClient->trackEvent('name of your event');
$telemetryClient->flush(); $telemetryClient->flush();
``` ```
**Sending a simple event telemetry item with event name**
```php
$telemetryClient->trackEvent('name of your event');
$telemetryClient->flush();
```
**Sending an event telemetry item with custom properties and measurements** **Sending an event telemetry item with custom properties and measurements**
```php ```php
$telemetryClient = new \ApplicationInsights\Telemetry_Client();
$telemetryClient->getContext()->setInstrumentationKey('YOUR INSTRUMENTATION KEY');
$telemetryClient->trackEvent('name of your event', ['MyCustomProperty' => 42, 'MyCustomProperty2' => 'test'], ['duration', 42]); $telemetryClient->trackEvent('name of your event', ['MyCustomProperty' => 42, 'MyCustomProperty2' => 'test'], ['duration', 42]);
$telemetryClient->flush(); $telemetryClient->flush();
``` ```
**Sending a simple page view telemetry item with page name and url**
```php
$telemetryClient->trackPageView('myPageView', 'http://www.foo.com');
$telemetryClient->flush();
```
**Sending a page view telemetry item with duration, custom properties and measurements**
```php
$telemetryClient->trackPageView('myPageView', 'http://www.foo.com', 256, ['InlineProperty' => 'test_value'], ['duration' => 42.0]);
$telemetryClient->flush();
```
**Sending a simple metric telemetry item with metric name and value***
```php
$telemetryClient->trackMetric('myMetric', 42.0);
$telemetryClient->flush();
```
**Sending a metric telemetry item with point type, count, min, max, standard deviation and measurements**
```php
$telemetryClient->trackMetric('myMetric', 42.0, \ApplicationInsights\Channel\Contracts\Data_Point_Type::Aggregation, 5, 0, 1, 0.2, ['InlineProperty' => 'test_value']);
$telemetryClient->flush();
```
**Sending a simple message telemetry item with message***
```php
$telemetryClient->trackMessage('myMessage', ['InlineProperty' => 'test_value']);
$telemetryClient->flush();
```
**Sending a simple request telemetry item with request name, url and start time***
```php
$telemetryClient->trackRequest('myRequest', 'http://foo.bar', time());
$telemetryClient->flush();
```
**Sending a request telemetry item with duration, http status code, whether or not the request succeeded, custom properties and measurements**
```php
$telemetryClient->trackRequest('myRequest', 'http://foo.bar', time(), 3754, 200, true, ['InlineProperty' => 'test_value'], ['duration_inner' => 42.0]);
$telemetryClient->flush();
```

Просмотреть файл

@ -10,7 +10,8 @@
"guzzlehttp/guzzle": "~5.0" "guzzlehttp/guzzle": "~5.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.3" "phpunit/phpunit": "~4.3",
"evert/phpdoc-md" : "~0.0.7"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

16
phpdoc.xml Normal file
Просмотреть файл

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<phpdoc>
<parser>
<target>data/output</target>
</parser>
<transformer>
<target>data/output</target>
</transformer>
<transformations>
<template name="xml"/>
</transformations>
<files>
<directory>ApplicationInsights</directory>
<ignore>ApplicationInsights/Tests/*</ignore>
</files>
</phpdoc>