Giter VIP home page Giter VIP logo

Comments (9)

norberttech avatar norberttech commented on July 17, 2024 1

hey @CurlyBytes could you maybe show what is not working for you? Maybe I can help with that

from client.

CurlyBytes avatar CurlyBytes commented on July 17, 2024 1

Hi @norberttech , thanks for the reply, I didn't try the solution, but based on the snippets you may now close this ticket

All the best ^^

from client.

CurlyBytes avatar CurlyBytes commented on July 17, 2024

+1 on this , even a simple index.php file with basic composer call is not working

from client.

CurlyBytes avatar CurlyBytes commented on July 17, 2024

hi, thank you for your reply @norberttech , ill tell you everything that i did on my end

Objective - Application insights to log everything in PHP ( trace, dependency, request, metrics, etc)
I started out on this one first https://packagist.org/packages/app-insights-php/monolog-handler but i don't see any documentation on how to use this one properly, did check directly in the class file itself, and this and found it uses ** Client ** Class as a parameter in the construction

appinsight1

upon checking the required dependency, it is already bundling the https://packagist.org/packages/app-insights-php/client the wrapper library itself

appinsight2

so upon reading this dependency wrapper library there obvious documentation on how to use it
so i did add this on on the head of the class

appinsight3

then implement base on the documentation, I did even instantiate basic instantiate but an error occurred
appinsight4
image

now I did try to update the use
Appinsight5

but still, the error is the same, if you check the folder directory of vendor composer library, the dependency wrapper of Client is present
Appinsight6

This is why im asking how to use correctly the Client wrapper, im aware this is intended for Symfony PHP framework but it doesn't make sense it would not work accordingly because this Client wrapper is another wrapper for this app-insights-php/app-insights-php-bundle. and there is no dependency related to this wrapper aside from azure application insights and client wrapper itself, if you could help me out to achieve just like this one https://github.com/app-insights-php/app-insights-php-bundle to a non-Symfony framework/components, that would be great

FYI im using docker php 7.4 nginx, codeigniter via composer, attempting to overwrite the core log instead of using file base logging and tracking, it should use appication insights

from client.

CurlyBytes avatar CurlyBytes commented on July 17, 2024

and lastly i did try this one
image

but the error return goes like this
image

I don't know what to supply the remaining LoggerInterface and CacheInterface?
image

kindly enlighten me, thanks

from client.

CurlyBytes avatar CurlyBytes commented on July 17, 2024

@norberttech , may i have your thoughts on this one? thanks

from client.

norberttech avatar norberttech commented on July 17, 2024

sorry @CurlyBytes I have a bit hard time understanding what you are trying to achieve. Could you maybe prepare a code sample that I could run locally and reproduce your problem?

from client.

CurlyBytes avatar CurlyBytes commented on July 17, 2024

To simplify, how to use AppClientFactor class to a nonSymfony PHP, as you can see in the constructor, it is asking 4 parameters, TelemetryClient,Configuration,FailureCache and LoggerInterface, what will I put to FailureCache and loggerInterface to a nonSymfony, please advise

from client.

norberttech avatar norberttech commented on July 17, 2024

It's certainly possible to use this library without Symfony Framework, that's why this repository is standalone.

Very minimum setup you will need to run it requires the following dependencies:

{
    "name": "norzechowicz/scratchpad",
    "require": {
        "app-insights-php/client": "^0.2.5",
        "symfony/cache": "^5.2",
        "monolog/monolog": "^2.1"
    }
}

If you don't want to use symfony/cache or monolog/monolog packages from my example below you find more adapters for psr/simple-cache and psr/log:

<?php

use AppInsightsPHP\Client\ClientFactory;
use AppInsightsPHP\Client\Configuration;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Symfony\Component\Cache\Adapter\ArrayAdapter;
use Symfony\Component\Cache\Psr16Cache;

require_once __DIR__ . '/vendor/autoload.php';

new ClientFactory(
    \getenv('AZURE_INSTRUMENTATION_KEY'),
    Configuration::createDefault(),
    new Psr16Cache(new ArrayAdapter()),
    new Logger('logger', [new StreamHandler(__DIR__ . '/failure.log')])
);

from client.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.