diff --git a/.gitattributes.txt b/.gitattributes
similarity index 100%
rename from .gitattributes.txt
rename to .gitattributes
diff --git a/.gitignore.txt b/.gitignore
similarity index 100%
rename from .gitignore.txt
rename to .gitignore
diff --git a/src/Client_Instrumentation.php b/src/Client_Instrumentation.php
index 825c859..1b98140 100644
--- a/src/Client_Instrumentation.php
+++ b/src/Client_Instrumentation.php
@@ -5,6 +5,8 @@
defined('_JEXEC') or die;
+use Joomla\CMS\Factory;
+
/**
* Does client-side instrumentation using the Javascript SDK for Application Insights
* @copyright Copyright 2015. All rights re-served.
@@ -12,48 +14,47 @@
*/
class Client_Instrumentation
{
- /**
- * Add prefix
- *
- * @param string $_instrumentationkey
- *
- * @param string $_title
- */
- function addPrefix($_instrumentationkey, $_title) {
- $rawSnippet = '';
-
+ /**
+ * Add prefix
+ *
+ * @param string $_instrumentationkey
+ *
+ * @param string $_title
+ */
+ function addPrefix($_instrumentationkey, $_title)
+ {
+ $rawSnippet = <<addScriptDeclaration(preg_replace($patterns, $replacements, $rawSnippet));
}
}
diff --git a/src/Server_Instrumentation.php b/src/Server_Instrumentation.php
index fd2623a..7b01879 100644
--- a/src/Server_Instrumentation.php
+++ b/src/Server_Instrumentation.php
@@ -38,7 +38,13 @@ function endRequest()
$requestName = $this->getRequestName();
$startTime = $_SERVER["REQUEST_TIME"];
$duration = ($this->getMicrotime() - $this->_startTime) * 1000;
- $this->_telemetryClient->trackRequest($requestName, $url, $startTime, $duration);
+ $responseCode = http_response_code();
+ if ($responseCode >= 200 && $responseCode < 400 ) {
+ $succesFull = true;
+ } else {
+ $succesFull = false;
+ }
+ $this->_telemetryClient->trackRequest($requestName, $url, $startTime, $duration, $responseCode, $succesFull);
// Flush all telemetry items
$this->_telemetryClient->flush();