arkaitzgarro/elastic-apm-laravel

View on GitHub

Showing 12 of 176 total issues

Method registerEventListeners has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function registerEventListeners(): void
    {
        $this->app->events->listen(JobProcessing::class, function (JobProcessing $event) {
            if ($this->app->runningInConsole()) {
                // Since the application starts only once for async queues, make sure
Severity: Minor
Found in src/Collectors/JobCollector.php - About 1 hr to fix

    Method registerEventListeners has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function registerEventListeners(): void
        {
            $this->app->events->listen(ScheduledTaskStarting::class, function (ScheduledTaskStarting $event) {
                $transaction_name = $this->getTransactionName($event);
                if ($transaction_name) {
    Severity: Minor
    Found in src/Collectors/ScheduledTaskCollector.php - About 1 hr to fix

      Method onQueryExecutedEvent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function onQueryExecutedEvent(QueryExecuted $query): void
          {
              if ('auto' === $this->config->get('elastic-apm-laravel.spans.querylog.enabled')) {
                  if ($query->time < $this->config->get('elastic-apm-laravel.spans.querylog.threshold')) {
                      return;
      Severity: Minor
      Found in src/Collectors/DBQueryCollector.php - About 1 hr to fix

        Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                Config $config,
                ContextCollection $sharedContext,
                Connector $connector,
                EventFactoryInterface $eventFactory,
                TransactionsStore $transactionsStore,
        Severity: Minor
        Found in src/Agent.php - About 45 mins to fix

          Method addMeasure has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  string $label,
                  float $start,
                  float $end,
                  string $type = 'request',
                  ?string $action = 'request',
          Severity: Minor
          Found in src/Collectors/EventDataCollector.php - About 45 mins to fix

            Function getController has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function getController(): ?string
                {
                    $router = $this->app['router'];
            
                    $route = $router->current();
            Severity: Minor
            Found in src/Collectors/HttpRequestCollector.php - About 45 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method pushMeasure has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    string $label,
                    float $start,
                    float $end,
                    string $type = 'request',
                    ?string $action = 'request',
            Severity: Minor
            Found in src/Collectors/EventDataCollector.php - About 45 mins to fix

              Method startMeasure has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      string $name,
                      string $type = 'request',
                      ?string $action = null,
                      ?string $label = null,
                      ?float $start_time = null
              Severity: Minor
              Found in src/Services/ApmCollectorService.php - About 35 mins to fix

                Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    final public function __construct(Application $app, Config $config, RequestStartTime $start_time, EventCounter $event_counter, EventClock $event_clock)
                Severity: Minor
                Found in src/Collectors/EventDataCollector.php - About 35 mins to fix

                  Method newAgent has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          Config $config,
                          ContextCollection $sharedContext,
                          Connector $connector,
                          EventFactoryInterface $eventFactory,
                          TransactionsStore $transactionsStore): ApmAgent
                  Severity: Minor
                  Found in src/AgentBuilder.php - About 35 mins to fix

                    Method startMeasure has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            string $name,
                            string $type = 'request',
                            ?string $action = null,
                            ?string $label = null,
                            ?float $start_time = null
                    Severity: Minor
                    Found in src/Collectors/EventDataCollector.php - About 35 mins to fix

                      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              string $name,
                              string $type = 'request',
                              ?string $action = null,
                              ?string $label = null,
                              ?float $start_time = null
                      Severity: Minor
                      Found in src/Events/StartMeasuring.php - About 35 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language