Giter VIP home page Giter VIP logo

Comments (14)

armetiz avatar armetiz commented on August 18, 2024

I could be very cool !

from leezypheanstalkbundle.

Maxwell2022 avatar Maxwell2022 commented on August 18, 2024

I'm facing the problem that there is no way to get the collection of connection. I'll try to make it work with the default connection but it's something that we should look into.

Is there any reason this has not been implemented and that you are using the connection finder in your commands?

from leezypheanstalkbundle.

armetiz avatar armetiz commented on August 18, 2024

I've just added a new ConnectionLocator to replace ConnectionFinder : 7d71b79

$pheanstalkConnectionLocator = $this->get("leezy.pheanstalk.connection_locator");
$pheanstalkConnectionLocator->getConnections();

from leezypheanstalkbundle.

Maxwell2022 avatar Maxwell2022 commented on August 18, 2024

thanks,

I've started implementing it. It looks quite simple except that I have problem setting up the DataCollector service to the profiler.

If I configure the service in the service.xml I can't inject leezy.pheanstalk.connection_locator in it because it's not yet defined. So I've tried to setup the service using DependencyInjection\Definition like you are doing for your ConnectionLocator. Everything looks fine, if I dump the argument in the DataCollector I have an instance of Leezy\PheanstalkBundle\ConnectionLocator which is correct.

However later on, when the profiler is loading it appears that this object disappears :|
I really don't know why at the moment. I'll try to look into it later today.

In the mean time I've created a new branch Profiler in my forked repo if anyone wants to have a look.
Here is the DependencyInjection Extension: https://github.com/Maxwell2022/LeezyPheanstalkBundle/blob/profiler/DependencyInjection/LeezyPheanstalkExtension.php

from leezypheanstalkbundle.

armetiz avatar armetiz commented on August 18, 2024

@Maxwell2022, you can inject leezy.pheanstalk.connection_locator on any service defined in service.xml. There is no need to defined it manually with Definition.

Regards,

from leezypheanstalkbundle.

Maxwell2022 avatar Maxwell2022 commented on August 18, 2024

If I do it I have the following error:

RuntimeException: The definition for "4a9b71937182c71843f6b77fdd9f3923_1" 
has no class. If you intend to inject this service dynamically at runtime, please 
mark it as synthetic=true. If this is an abstract definition solely used by child 
definitions, please add abstract=true, otherwise specify a class to get rid of this 
error.
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
    <services>
        <service id="leezy.data_collector.pheanstalk" class="Leezy\PheanstalkBundle\Profiler\DataCollector\PheanstalkDataCollector">
            <argument type="service">leezy.pheanstalk.connection_locator</argument>
            <tag id="pheanstalk" template="LeezyPheanstalkBundle:Profiler:pheanstalk" name="data_collector"></tag>
        </service>
    </services>
</container>

Also if I try to access the service I've setup in a controller, ti's working perfectly:

$dataCollector = $this->get('leezy.data_collector.pheanstalk');
$c = $dataCollector->getConnections();
var_dump($c);
die;

I've spent few hours trying to debug it but could not find anything. I've looked into the scope trying to change it but I could not. I'm really stuck here.

from leezypheanstalkbundle.

armetiz avatar armetiz commented on August 18, 2024

You have made a mistake.
Try this :

<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
    <services>
        <service id="leezy.data_collector.pheanstalk" class="Leezy\PheanstalkBundle\Profiler\DataCollector\PheanstalkDataCollector">
            <argument type="service" id="leezy.pheanstalk.connection_locator" />
            <tag id="pheanstalk" template="LeezyPheanstalkBundle:Profiler:pheanstalk" name="data_collector" />
        </service>
    </services>
</container>

from leezypheanstalkbundle.

Maxwell2022 avatar Maxwell2022 commented on August 18, 2024

so now there is no more exceptions but I have the same problem than before. The connection_locator is null. No idea what's happening.

from leezypheanstalkbundle.

Maxwell2022 avatar Maxwell2022 commented on August 18, 2024

I think the data collector has be be trigger somehow otherwise it's returning nothing. I'm investigating.

from leezypheanstalkbundle.

Maxwell2022 avatar Maxwell2022 commented on August 18, 2024

Ok, I finally found it. It's because the DataCollector is serialised after each request so the object is losing its dependencies. See in the profiler how it's collecting the data.

I've done a simple test and it looks awesome, can't wait to have it work :)

from leezypheanstalkbundle.

armetiz avatar armetiz commented on August 18, 2024

Can you make a Pull Request when ready ;)

from leezypheanstalkbundle.

Maxwell2022 avatar Maxwell2022 commented on August 18, 2024

Sure! Maybe tomorrow (Sydney time)

from leezypheanstalkbundle.

Maxwell2022 avatar Maxwell2022 commented on August 18, 2024

I've been faster than expected. Have a look and let me know but I think it's really cool ;)

Actually there is few things that I want to add / update:

  • enable / disable the profiler from the config
  • move the jobs table at the top of the Profiler panel
  • display empty message when no jobs ready
  • ...

from leezypheanstalkbundle.

armetiz avatar armetiz commented on August 18, 2024

Done

from leezypheanstalkbundle.

Related Issues (20)

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.