Zend_Service_WindowsAzure_Manager.xml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.service.windowsazure.diagnostics.manager">
  4. <title>Zend_Service_WindowsAzure_Diagnostics_Manager</title>
  5. <para>
  6. Blob Storage stores sets of binary data. Blob storage offers the following three
  7. Windows Azure Diagnostics enables you to collect diagnostic data from a service
  8. running in Windows Azure. It can be used for tasks like debugging and
  9. troubleshooting, measuring performance, monitoring resource usage, traffic
  10. analysis, capacity planning, and auditing. Once collected, diagnostic data can be
  11. transferred to a Windows Azure storage account for persistence. Transfers can
  12. either be scheduled or on-demand.
  13. </para>
  14. <para>
  15. You can configure Windows Azure Diagnostics from code running within a role. You
  16. can also configure it remotely from an application running outside of the Windows
  17. Azure; for example, you can manage Windows Azure Diagnostics from a custom
  18. dashboard application running locally. By managing Windows Azure Diagnostics
  19. remotely, you can start your service with an initial diagnostic configuration,
  20. and then tweak that configuration from code running outside of your service,
  21. without having to upgrade your service.
  22. </para>
  23. <para>
  24. More information on which logs, performance counters, crash dumps, ...
  25. can be monitored can be found on the <ulink
  26. url="http://msdn.microsoft.com/en-us/library/ee758705(v=MSDN.10).aspx">
  27. corresponding MSDN web page</ulink>.
  28. </para>
  29. <para>
  30. Note: Diagnostics are configured on a per-role basis. This means that each
  31. role should be configured separately. Specifying diagnostics instructions
  32. for one role instance does not imply this configuration is loaded on other
  33. role instances.
  34. </para>
  35. <para>
  36. Note: Diagnostics are configured on a per-role basis. This means that each
  37. The Diagnostics API in the Windows Azure SDK for PHP can only be used when
  38. the DiagnosticsMonitor has been started during role startup. Currently,
  39. this is only supported when an application is packaged with the Windows
  40. Azure Command-line Tools for PHP Developers.
  41. </para>
  42. <sect2 id="zend.service.windowsazure.diagnostics.manager.api">
  43. <title>API Examples</title>
  44. <para>
  45. This topic lists some examples of using the
  46. <classname>Zend_Service_WindowsAzure_Diagnostics_Manager</classname> class. Other features are
  47. available in the download package, as well as a detailed API documentation of those
  48. features.
  49. </para>
  50. <sect3 id="zend.service.windowsazure.diagnostics.manager.api.config-exists">
  51. <title>Checking if a diagnostics configuration for the current role instance exists</title>
  52. <para>
  53. Using the following code, you can check if a diagnostics configuration for the
  54. current role instance exists.
  55. </para>
  56. <example id="zend.service.windowsazure.diagnostics.manager.api.config-exists.example">
  57. <title>Checking if a diagnostics configuration for the current role instance exists</title>
  58. <programlisting language="php"><![CDATA[
  59. /** Zend_Service_WindowsAzure_Storage_Blob */
  60. require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
  61. /** Zend_Service_WindowsAzure_Diagnostics_Manager */
  62. require_once 'Zend/Service/WindowsAzure/Diagnostics/Manager.php';
  63. $storageClient = new Zend_Service_WindowsAzure_Storage_Blob();
  64. $manager = new Zend_Service_WindowsAzure_Diagnostics_Manager($storageClient);
  65. $configurationExists = $manager->configurationForCurrentRoleInstanceExists();
  66. echo 'The configuration ' . ($configurationExists ? 'exists' : 'does not exist';
  67. ]]></programlisting>
  68. </example>
  69. </sect3>
  70. <sect3 id="zend.service.windowsazure.diagnostics.manager.api.config-load">
  71. <title>Loading the current role instance diagnostics configuration</title>
  72. <para>
  73. Using the following code, you can load the current role instance diagnostics
  74. configuration.
  75. </para>
  76. <example id="zend.service.windowsazure.diagnostics.manager.api.config-load.example">
  77. <title>Loading the current role instance diagnostics configuration</title>
  78. <programlisting language="php"><![CDATA[
  79. /** Zend_Service_WindowsAzure_Storage_Blob */
  80. require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
  81. /** Zend_Service_WindowsAzure_Diagnostics_Manager */
  82. require_once 'Zend/Service/WindowsAzure/Diagnostics/Manager.php';
  83. $storageClient = new Zend_Service_WindowsAzure_Storage_Blob();
  84. $manager = new Zend_Service_WindowsAzure_Diagnostics_Manager($storageClient);
  85. $configuration = $manager->getConfigurationForCurrentRoleInstance();
  86. ]]></programlisting>
  87. </example>
  88. </sect3>
  89. <sect3 id="zend.service.windowsazure.diagnostics.manager.api.config-store">
  90. <title>Storing the current role instance diagnostics configuration</title>
  91. <para>
  92. Using the following code, you can store the current role instance diagnostics
  93. configuration.
  94. </para>
  95. <example id="zend.service.windowsazure.diagnostics.manager.api.config-store.example">
  96. <title>Storing the current role instance diagnostics configuration</title>
  97. <programlisting language="php"><![CDATA[
  98. /** Zend_Service_WindowsAzure_Storage_Blob */
  99. require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
  100. /** Zend_Service_WindowsAzure_Diagnostics_Manager */
  101. require_once 'Zend/Service/WindowsAzure/Diagnostics/Manager.php';
  102. $storageClient = new Zend_Service_WindowsAzure_Storage_Blob();
  103. $manager = new Zend_Service_WindowsAzure_Diagnostics_Manager($storageClient);
  104. $configuration = // ...;
  105. $manager->setConfigurationForCurrentRoleInstance($configuration);
  106. ]]></programlisting>
  107. </example>
  108. </sect3>
  109. <sect3 id="zend.service.windowsazure.diagnostics.manager.api.config-perf">
  110. <title>Subscribing to a performance counter</title>
  111. <para>
  112. Using the following code, you can subscribe to a performance counter.
  113. </para>
  114. <example id="zend.service.windowsazure.diagnostics.manager.api.config-perf.example">
  115. <title>Subscribing to a performance counter</title>
  116. <programlisting language="php"><![CDATA[
  117. /** Zend_Service_WindowsAzure_Storage_Blob */
  118. require_once 'Zend/Service/WindowsAzure/Storage/Blob.php';
  119. /** Zend_Service_WindowsAzure_Diagnostics_Manager */
  120. require_once 'Zend/Service/WindowsAzure/Diagnostics/Manager.php';
  121. $storageClient = new Zend_Service_WindowsAzure_Storage_Blob();
  122. $manager = new Zend_Service_WindowsAzure_Diagnostics_Manager($storageClient);
  123. $configuration = $manager->getConfigurationForCurrentRoleInstance();
  124. // Subscribe to \Processor(*)\% Processor Time
  125. $configuration->DataSources->PerformanceCounters->addSubscription('\Processor(*)\% Processor Time', 1);
  126. $manager->setConfigurationForCurrentRoleInstance($configuration);
  127. ]]></programlisting>
  128. </example>
  129. </sect3>
  130. <sect3 id="zend.service.windowsazure.diagnostics.manager.api.config-roleid">
  131. <title>Getting the current role instance id</title>
  132. <para>
  133. The current role instance id is defined in the server variable
  134. RdRoleId. It will only be available when the application is run in
  135. Development Fabric or Windows Azure Fabric.
  136. </para>
  137. <example id="zend.service.windowsazure.diagnostics.manager.api.config-roleid.example">
  138. <title>Getting the current role instance id</title>
  139. <programlisting language="php"><![CDATA[
  140. echo 'The role instance id is ' . $_SERVER['RdRoleId'];
  141. ]]></programlisting>
  142. </example>
  143. </sect3>
  144. </sect2>
  145. </sect1>