You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
hello,when i was Initializing the client and setting the instrumentation key ,i got the error like this,
my background is put magento2's log to Azure application insights,magento2 is a framework made by php,so I found this github project.Does anyone konw what i should to fix it out?
I'm new to php, i'm a python and java programmer,so if i made some Low-level mistakes, please tell me ,thank you so much!
[2019-10-23 03:03:42] main.ERROR: Client error: POST https://dc.services.visualstudio.com/v2/track resulted in a 400 Invalid instrumentation key response:
{"itemsReceived":1,"itemsAccepted":0,"errors":[{"index":0,"statusCode":400,"message":"Invalid instrumentation key"}]}
and my php code is like this:
use ApplicationInsights\Telemetry_Client;
$telemetryClient = new \ApplicationInsights\Telemetry_Client();
$context = $telemetryClient->getContext();
// Optionalmy
//$context->getSessionContext()->setId(session_id());
//$context->getUserContext()->setId('YOUR USER ID');
//$context->getApplicationContext()->setVer('YOUR VERSION');
//$context->getLocationContext()->setIp('YOUR IP');
// Start tracking
$telemetryClient->trackEvent('name of your event');
$telemetryClient->flush();
code Integrated into the magento2 is like this,
namespace Max\HelloWorld\Controller\Index;
use ApplicationInsights\Telemetry_Client;
use Magento\Framework\App\Action\Context;
use Magento\Framework\Logger\Handler\Debug;
use Magento\Framework\View\Result\PageFactory;
use Magento\Framework\Webapi\Exception;
use Monolog\Logger;
class Test extends \Magento\Framework\App\Action\Action
{
protected $_pageFactory;
public function __construct(
Context $context,
PageFactory $pageFactory
)
{
$this->_pageFactory = $pageFactory;
return parent::__construct($context);
}
public function execute()
{
echo "Hello World";
exit;
}
public function postLogger()
{
echo "Start";
$telemetryClient = new Telemetry_Client();
$context = $telemetryClient->getContext();
$context->setInstrumentationKey('myInstrumentationKey');
$telemetryClient->trackEvent("Zhou-loggerInfo", Logger::DEBUG);
//$telemetryClient->flush();
echo "End";
}
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
hello,when i was Initializing the client and setting the instrumentation key ,i got the error like this,
my background is put magento2's log to Azure application insights,magento2 is a framework made by php,so I found this github project.Does anyone konw what i should to fix it out?
I'm new to php, i'm a python and java programmer,so if i made some Low-level mistakes, please tell me ,thank you so much!
and my php code is like this:
The text was updated successfully, but these errors were encountered: