This commit is contained in:
Sergey Kanzhelev 2018-09-05 14:21:10 -07:00
Родитель b528e31668
Коммит a2a16da51a
4 изменённых файлов: 44 добавлений и 31 удалений

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

@ -99,7 +99,7 @@ class Telemetry_Context
$this->_locationContext->setIp($_SERVER['REMOTE_ADDR']);
}
$this->_internalContext->setSdkVersion('php:0.4.4');
$this->_internalContext->setSdkVersion('php:0.4.5');
}
/**

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

@ -1,19 +1,25 @@
# Changelog
## 0.4.5 (unreleased)
- TODO / unreleased
## 0.4.4
- Initialize `name` and operation id for requests telemetry.
- Updated to the latest schemas. Few properties are no longer available.
- Enum `Dependency_Type` and `async` argument of `TrackDependency` were removed.
- New event type `Availability_Data`.
- Use `Cloud` context instead of `Device` context to set role name and role instance of an application.
- Use `Cloud` context instead of `Device` context to set role name and role
instance of an application.
## 0.4.3
- Support tracking Throwable and Error, not only Exceptions.
- Support for internal context and override of SDK version.
- Fix duration serialization for `trackPageView` call.
- Do not send `User-Agent` when uploading telemetry to avoid misclassification of server telemetry as client telemetry.
- Do not send `User-Agent` when uploading telemetry to avoid misclassification
of server telemetry as client telemetry.
## 0.4.2

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

@ -1,6 +1,8 @@
# How to Contribute
If you're interested in contributing, take a look at the general [contributor's guide](https://github.com/Microsoft/ApplicationInsights-Home/blob/master/CONTRIBUTING.md) first.
If you're interested in contributing, take a look at the general [contributor's
guide](https://github.com/Microsoft/ApplicationInsights-Home/blob/master/CONTRIBUTING.md)
first.
## Build and Unit Test
@ -8,7 +10,7 @@ Unit tests uses `phpunit`. You'd need to install dependencies using composer.
From the root folder:
```
``` sh
brew install composer
composer install
composer selfupdate
@ -17,14 +19,23 @@ brew install phpunit
phpunit -c phpunit.xml Tests/
```
When submitting PR - make sure to include description of a change in [CHANGELOG.md](CHANGELOG.md). This will help produce release notes.
When submitting PR - make sure to include description of a change in
[CHANGELOG.md](CHANGELOG.md). This will help produce release notes.
## Releasing of a new version (for maintainers only)
1. Create a release tag. Make sure tag name is incremented version from the previous release. Use [CHANGELOG.md](CHANGELOG.md) for release description.
2. [Packagist.org](https://packagist.org/packages/microsoft/application-insights) will pick up the new version from tags.
3. Bump versions in [CHANGELOG.md](CHANGELOG.md) and [Telemetry_Context.php](ApplicationInsights/Telemetry_Context.php).
1. Create a release tag. Make sure tag name is incremented version from the
previous release. Use [CHANGELOG.md](CHANGELOG.md) for release description.
2. [Packagist.org](https://packagist.org/packages/microsoft/application-insights)
will pick up the new version from tags.
3. Bump versions in [CHANGELOG.md](CHANGELOG.md) and
[Telemetry_Context.php](ApplicationInsights/Telemetry_Context.php).
## Code of conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
This project has adopted the [Microsoft Open Source Code of
Conduct](https://opensource.microsoft.com/codeofconduct/). For more information
see the [Code of Conduct
FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact
[opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional
questions or comments.

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

@ -39,8 +39,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.
**Initializing the client and setting the instrumentation key and other optional
configurations**
### Initializing the client and setting the instrumentation key and other optional configurations
```php
$telemetryClient = new \ApplicationInsights\Telemetry_Client();
@ -60,7 +59,7 @@ $telemetryClient->trackEvent('name of your event');
$telemetryClient->flush();
```
**Setup Operation context**
### Setup Operation context
For correct Application Insights reporting you need to setup Operation Context,
reference to Request
@ -70,14 +69,14 @@ $telemetryClient->getContext()->getOperationContext()->setId('XX');
$telemetryClient->getContext()->getOperationContext()->setName('GET Index');
```
**Sending a simple event telemetry item with event name**
### 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
$telemetryClient->trackEvent('name of your event', ['MyCustomProperty' => 42, 'MyCustomProperty2' => 'test'], ['duration', 42]);
@ -93,37 +92,35 @@ $telemetryClient->trackEvent('name of your second event');
$telemetryClient->flush();
```
**Sending a simple page view telemetry item with page name and url**
### 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**
### 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***
### 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**
### 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**
### Sending a simple message telemetry item with message
```php
$telemetryClient->trackMessage('myMessage', \ApplicationInsights\Channel\Contracts\Message_Severity_Level::INFORMATION, ['InlineProperty' => 'test_value']);
@ -138,15 +135,14 @@ $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**
### 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();
```
**Sending an exception telemetry, with custom properties and metrics**
### Sending an exception telemetry, with custom properties and metrics
```php
try
@ -160,13 +156,13 @@ catch (\Exception $ex)
}
```
**Set the Client to gzip the data before sending**
### Set the Client to gzip the data before sending
```php
$telemetryClient->getChannel()->setSendGzipped(true);
```
**Registering an exception handler**
### Registering an exception handler
```php
class Handle_Exceptions
@ -192,28 +188,28 @@ class Handle_Exceptions
}
```
**Sending a successful SQL dependency telemetry item**
### Sending a successful SQL dependency telemetry item
```php
$telemetryClient->trackDependency('Query table', "SQL", 'SELECT * FROM table;', time(), 122, true);
$telemetryClient->flush();
```
**Sending a failed HTTP dependency telemetry item**
### Sending a failed HTTP dependency telemetry item
```php
$telemetryClient->trackDependency('method', "HTTP", "http://example.com/api/method", time(), 324, false, 503);
$telemetryClient->flush();
```
**Sending any other kind dependency telemetry item**
### Sending any other kind dependency telemetry item
```php
$telemetryClient->trackDependency('Name of operation', "service", 'Arguments', time(), 23, true);
$telemetryClient->flush();
```
**Changing the operation id (which links actions together)**
### Changing the operation id (which links actions together)
```php
$telemetryClient->trackMetric('interestingMetric', 10);