Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Add tags for Horizon
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Manuel Cardona committed Apr 1, 2019
1 parent 8428e45 commit 2b04a61
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Scraper/Events/InvalidConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,22 @@ public function __construct(ScrapeRequest $scrapeRequest)
{
$this->scrapeRequest = $scrapeRequest;
}

/**
* Get the tags that should be assigned to the job.
*
* Only if you are using Horizon
*
* @see https://laravel.com/docs/5.8/horizon#tags
*
* @return array
*/
public function tags()
{
$type = $this->scrapeRequest->type;

return [
"reconfigure_type:$type",
];
}
}
18 changes: 18 additions & 0 deletions src/Scraper/Events/ScrapeFailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,22 @@ public function __construct(ScrapeRequest $scrapeRequest)
{
$this->scrapeRequest = $scrapeRequest;
}

/**
* Get the tags that should be assigned to the job.
*
* Only if you are using Horizon
*
* @see https://laravel.com/docs/5.8/horizon#tags
*
* @return array
*/
public function tags()
{
$type = $this->scrapeRequest->type;

return [
"failed_type:$type",
];
}
}
18 changes: 18 additions & 0 deletions src/Scraper/Events/ScrapeRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,22 @@ public function __construct(string $url, string $type)
$this->url = $url;
$this->type = $type;
}

/**
* Get the tags that should be assigned to the job.
*
* Only if you are using Horizon
*
* @see https://laravel.com/docs/5.8/horizon#tags
*
* @return array
*/
public function tags()
{
$type = $this->type;

return [
"request_type:$type",
];
}
}
20 changes: 20 additions & 0 deletions src/Scraper/Events/Scraped.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,24 @@ public function __construct(ScrapeRequest $scrapeRequest, array $data, string $v
$this->data = $data;
$this->variant = $variant;
}

/**
* Get the tags that should be assigned to the job.
*
* Only if you are using Horizon
*
* @see https://laravel.com/docs/5.8/horizon#tags
*
* @return array
*/
public function tags()
{
$type = $this->scrapeRequest->type;
$variant = $this->variant;

return [
"scraped_type:$type",
"scraped_variant:$variant",
];
}
}

0 comments on commit 2b04a61

Please sign in to comment.