mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: start of InfluxDB implementation
This commit is contained in:
@@ -23,12 +23,14 @@
|
||||
"php": ">=8.2",
|
||||
"ext-ctype": "*",
|
||||
"ext-iconv": "*",
|
||||
"ext-simplexml": "*",
|
||||
"api-platform/core": "^3.3",
|
||||
"doctrine/dbal": "^3",
|
||||
"doctrine/doctrine-bundle": "^2.12",
|
||||
"doctrine/doctrine-migrations-bundle": "^3.3",
|
||||
"doctrine/orm": "^3.2",
|
||||
"eluceo/ical": "^2.14",
|
||||
"influxdata/influxdb-client-php": "^3.6",
|
||||
"knpuniversity/oauth2-client-bundle": "^2.18",
|
||||
"lexik/jwt-authentication-bundle": "^3.1",
|
||||
"nelmio/cors-bundle": "^2.5",
|
||||
@@ -87,13 +89,13 @@
|
||||
"symfony/zulip-notifier": "7.1.*",
|
||||
"symfonycasts/verify-email-bundle": "*",
|
||||
"twig/extra-bundle": "^2.12|^3.0",
|
||||
"twig/twig": "^2.12|^3.0",
|
||||
"ext-simplexml": "*"
|
||||
"twig/twig": "^2.12|^3.0"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"symfony/flex": true,
|
||||
"symfony/runtime": true
|
||||
"symfony/runtime": true,
|
||||
"php-http/discovery": true
|
||||
},
|
||||
"sort-packages": true
|
||||
},
|
||||
|
||||
444
composer.lock
generated
444
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "b4c19d3fdedbe8292195fc8016c97d8d",
|
||||
"content-hash": "29ad927d4b30a375b7f6b10bfe160d43",
|
||||
"packages": [
|
||||
{
|
||||
"name": "api-platform/core",
|
||||
@@ -227,6 +227,72 @@
|
||||
},
|
||||
"time": "2024-12-06T11:11:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "clue/stream-filter",
|
||||
"version": "v1.7.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/clue/stream-filter.git",
|
||||
"reference": "049509fef80032cb3f051595029ab75b49a3c2f7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/clue/stream-filter/zipball/049509fef80032cb3f051595029ab75b49a3c2f7",
|
||||
"reference": "049509fef80032cb3f051595029ab75b49a3c2f7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Clue\\StreamFilter\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Christian Lück",
|
||||
"email": "christian@clue.engineering"
|
||||
}
|
||||
],
|
||||
"description": "A simple and modern approach to stream filtering in PHP",
|
||||
"homepage": "https://github.com/clue/stream-filter",
|
||||
"keywords": [
|
||||
"bucket brigade",
|
||||
"callback",
|
||||
"filter",
|
||||
"php_user_filter",
|
||||
"stream",
|
||||
"stream_filter_append",
|
||||
"stream_filter_register"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/clue/stream-filter/issues",
|
||||
"source": "https://github.com/clue/stream-filter/tree/v1.7.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://clue.engineering/support",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/clue",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2023-12-20T15:40:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "composer/semver",
|
||||
"version": "3.4.3",
|
||||
@@ -1990,6 +2056,56 @@
|
||||
],
|
||||
"time": "2024-07-18T11:15:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "influxdata/influxdb-client-php",
|
||||
"version": "3.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/influxdata/influxdb-client-php.git",
|
||||
"reference": "3606b12214508f22126b7ed0565d53380674312a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/influxdata/influxdb-client-php/zipball/3606b12214508f22126b7ed0565d53380674312a",
|
||||
"reference": "3606b12214508f22126b7ed0565d53380674312a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"php": ">=7.2",
|
||||
"php-http/client-common": "^2.2.1",
|
||||
"php-http/discovery": "^1.9.1",
|
||||
"psr/http-client": "^1.0.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"guzzlehttp/psr7": "^2.0.0",
|
||||
"phpunit/phpunit": "^8.5.27",
|
||||
"squizlabs/php_codesniffer": "~3.7"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"InfluxDB2\\": "src/InfluxDB2"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "InfluxDB (v2+) Client Library for PHP",
|
||||
"homepage": "https://www.github.com/influxdata/influxdb-client-php",
|
||||
"keywords": [
|
||||
"influxdb"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/influxdata/influxdb-client-php/issues",
|
||||
"source": "https://github.com/influxdata/influxdb-client-php/tree/3.6.0"
|
||||
},
|
||||
"time": "2024-06-24T10:01:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "knpuniversity/oauth2-client-bundle",
|
||||
"version": "v2.18.3",
|
||||
@@ -2637,6 +2753,332 @@
|
||||
},
|
||||
"time": "2020-10-15T08:29:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "php-http/client-common",
|
||||
"version": "2.7.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-http/client-common.git",
|
||||
"reference": "0cfe9858ab9d3b213041b947c881d5b19ceeca46"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-http/client-common/zipball/0cfe9858ab9d3b213041b947c881d5b19ceeca46",
|
||||
"reference": "0cfe9858ab9d3b213041b947c881d5b19ceeca46",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0",
|
||||
"php-http/httplug": "^2.0",
|
||||
"php-http/message": "^1.6",
|
||||
"psr/http-client": "^1.0",
|
||||
"psr/http-factory": "^1.0",
|
||||
"psr/http-message": "^1.0 || ^2.0",
|
||||
"symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0 || ^7.0",
|
||||
"symfony/polyfill-php80": "^1.17"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/instantiator": "^1.1",
|
||||
"guzzlehttp/psr7": "^1.4",
|
||||
"nyholm/psr7": "^1.2",
|
||||
"phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
|
||||
"phpspec/prophecy": "^1.10.2",
|
||||
"phpunit/phpunit": "^7.5.20 || ^8.5.33 || ^9.6.7"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-json": "To detect JSON responses with the ContentTypePlugin",
|
||||
"ext-libxml": "To detect XML responses with the ContentTypePlugin",
|
||||
"php-http/cache-plugin": "PSR-6 Cache plugin",
|
||||
"php-http/logger-plugin": "PSR-3 Logger plugin",
|
||||
"php-http/stopwatch-plugin": "Symfony Stopwatch plugin"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Http\\Client\\Common\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Márk Sági-Kazár",
|
||||
"email": "mark.sagikazar@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Common HTTP Client implementations and tools for HTTPlug",
|
||||
"homepage": "http://httplug.io",
|
||||
"keywords": [
|
||||
"client",
|
||||
"common",
|
||||
"http",
|
||||
"httplug"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-http/client-common/issues",
|
||||
"source": "https://github.com/php-http/client-common/tree/2.7.2"
|
||||
},
|
||||
"time": "2024-09-24T06:21:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "php-http/discovery",
|
||||
"version": "1.20.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-http/discovery.git",
|
||||
"reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-http/discovery/zipball/82fe4c73ef3363caed49ff8dd1539ba06044910d",
|
||||
"reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-plugin-api": "^1.0|^2.0",
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"conflict": {
|
||||
"nyholm/psr7": "<1.0",
|
||||
"zendframework/zend-diactoros": "*"
|
||||
},
|
||||
"provide": {
|
||||
"php-http/async-client-implementation": "*",
|
||||
"php-http/client-implementation": "*",
|
||||
"psr/http-client-implementation": "*",
|
||||
"psr/http-factory-implementation": "*",
|
||||
"psr/http-message-implementation": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "^1.0.2|^2.0",
|
||||
"graham-campbell/phpspec-skip-example-extension": "^5.0",
|
||||
"php-http/httplug": "^1.0 || ^2.0",
|
||||
"php-http/message-factory": "^1.0",
|
||||
"phpspec/phpspec": "^5.1 || ^6.1 || ^7.3",
|
||||
"sebastian/comparator": "^3.0.5 || ^4.0.8",
|
||||
"symfony/phpunit-bridge": "^6.4.4 || ^7.0.1"
|
||||
},
|
||||
"type": "composer-plugin",
|
||||
"extra": {
|
||||
"class": "Http\\Discovery\\Composer\\Plugin",
|
||||
"plugin-optional": true
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Http\\Discovery\\": "src/"
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"src/Composer/Plugin.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Márk Sági-Kazár",
|
||||
"email": "mark.sagikazar@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations",
|
||||
"homepage": "http://php-http.org",
|
||||
"keywords": [
|
||||
"adapter",
|
||||
"client",
|
||||
"discovery",
|
||||
"factory",
|
||||
"http",
|
||||
"message",
|
||||
"psr17",
|
||||
"psr7"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-http/discovery/issues",
|
||||
"source": "https://github.com/php-http/discovery/tree/1.20.0"
|
||||
},
|
||||
"time": "2024-10-02T11:20:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "php-http/httplug",
|
||||
"version": "2.4.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-http/httplug.git",
|
||||
"reference": "5cad731844891a4c282f3f3e1b582c46839d22f4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-http/httplug/zipball/5cad731844891a4c282f3f3e1b582c46839d22f4",
|
||||
"reference": "5cad731844891a4c282f3f3e1b582c46839d22f4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0",
|
||||
"php-http/promise": "^1.1",
|
||||
"psr/http-client": "^1.0",
|
||||
"psr/http-message": "^1.0 || ^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friends-of-phpspec/phpspec-code-coverage": "^4.1 || ^5.0 || ^6.0",
|
||||
"phpspec/phpspec": "^5.1 || ^6.0 || ^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Http\\Client\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Eric GELOEN",
|
||||
"email": "geloen.eric@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Márk Sági-Kazár",
|
||||
"email": "mark.sagikazar@gmail.com",
|
||||
"homepage": "https://sagikazarmark.hu"
|
||||
}
|
||||
],
|
||||
"description": "HTTPlug, the HTTP client abstraction for PHP",
|
||||
"homepage": "http://httplug.io",
|
||||
"keywords": [
|
||||
"client",
|
||||
"http"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-http/httplug/issues",
|
||||
"source": "https://github.com/php-http/httplug/tree/2.4.1"
|
||||
},
|
||||
"time": "2024-09-23T11:39:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "php-http/message",
|
||||
"version": "1.16.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-http/message.git",
|
||||
"reference": "06dd5e8562f84e641bf929bfe699ee0f5ce8080a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-http/message/zipball/06dd5e8562f84e641bf929bfe699ee0f5ce8080a",
|
||||
"reference": "06dd5e8562f84e641bf929bfe699ee0f5ce8080a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"clue/stream-filter": "^1.5",
|
||||
"php": "^7.2 || ^8.0",
|
||||
"psr/http-message": "^1.1 || ^2.0"
|
||||
},
|
||||
"provide": {
|
||||
"php-http/message-factory-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ergebnis/composer-normalize": "^2.6",
|
||||
"ext-zlib": "*",
|
||||
"guzzlehttp/psr7": "^1.0 || ^2.0",
|
||||
"laminas/laminas-diactoros": "^2.0 || ^3.0",
|
||||
"php-http/message-factory": "^1.0.2",
|
||||
"phpspec/phpspec": "^5.1 || ^6.3 || ^7.1",
|
||||
"slim/slim": "^3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-zlib": "Used with compressor/decompressor streams",
|
||||
"guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories",
|
||||
"laminas/laminas-diactoros": "Used with Diactoros Factories",
|
||||
"slim/slim": "Used with Slim Framework PSR-7 implementation"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/filters.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Http\\Message\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Márk Sági-Kazár",
|
||||
"email": "mark.sagikazar@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "HTTP Message related tools",
|
||||
"homepage": "http://php-http.org",
|
||||
"keywords": [
|
||||
"http",
|
||||
"message",
|
||||
"psr-7"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-http/message/issues",
|
||||
"source": "https://github.com/php-http/message/tree/1.16.2"
|
||||
},
|
||||
"time": "2024-10-02T11:34:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "php-http/promise",
|
||||
"version": "1.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-http/promise.git",
|
||||
"reference": "fc85b1fba37c169a69a07ef0d5a8075770cc1f83"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-http/promise/zipball/fc85b1fba37c169a69a07ef0d5a8075770cc1f83",
|
||||
"reference": "fc85b1fba37c169a69a07ef0d5a8075770cc1f83",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friends-of-phpspec/phpspec-code-coverage": "^4.3.2 || ^6.3",
|
||||
"phpspec/phpspec": "^5.1.2 || ^6.2 || ^7.4"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Http\\Promise\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Joel Wurtz",
|
||||
"email": "joel.wurtz@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Márk Sági-Kazár",
|
||||
"email": "mark.sagikazar@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Promise used for asynchronous HTTP requests",
|
||||
"homepage": "http://httplug.io",
|
||||
"keywords": [
|
||||
"promise"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-http/promise/issues",
|
||||
"source": "https://github.com/php-http/promise/tree/1.3.1"
|
||||
},
|
||||
"time": "2024-03-15T13:55:21+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-common",
|
||||
"version": "2.2.0",
|
||||
|
||||
10
config/packages/http_discovery.yaml
Normal file
10
config/packages/http_discovery.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
services:
|
||||
Psr\Http\Message\RequestFactoryInterface: '@http_discovery.psr17_factory'
|
||||
Psr\Http\Message\ResponseFactoryInterface: '@http_discovery.psr17_factory'
|
||||
Psr\Http\Message\ServerRequestFactoryInterface: '@http_discovery.psr17_factory'
|
||||
Psr\Http\Message\StreamFactoryInterface: '@http_discovery.psr17_factory'
|
||||
Psr\Http\Message\UploadedFileFactoryInterface: '@http_discovery.psr17_factory'
|
||||
Psr\Http\Message\UriFactoryInterface: '@http_discovery.psr17_factory'
|
||||
|
||||
http_discovery.psr17_factory:
|
||||
class: Http\Discovery\Psr17Factory
|
||||
@@ -19,6 +19,12 @@ parameters:
|
||||
|
||||
outgoing_ip: '%env(string:OUTGOING_IP)%'
|
||||
|
||||
influxdb_enable: '%env(bool:INFLUXDB_ENABLE)'
|
||||
influxdb_url: '%env(string:INFLUXDB_URL)%'
|
||||
influxdb_token: '%env(string:INFLUXDB_TOKEN)%'
|
||||
influxdb_bucket: '%env(string:INFLUXDB_BUCKET)%'
|
||||
influxdb_org: '%env(string:INFLUXDB_ORG)%'
|
||||
|
||||
services:
|
||||
# default configuration for services in *this* file
|
||||
_defaults:
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Notifier;
|
||||
|
||||
use App\Config\WebhookScheme;
|
||||
use App\Entity\Domain;
|
||||
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
||||
use Symfony\Component\Mime\Address;
|
||||
@@ -24,8 +23,6 @@ class DomainOrderErrorNotification extends DomainWatchdogNotification
|
||||
|
||||
public function asChatMessage(?RecipientInterface $recipient = null, ?string $transport = null): ?ChatMessage
|
||||
{
|
||||
$webhookScheme = WebhookScheme::from($transport);
|
||||
|
||||
$ldhName = $this->domain->getLdhName();
|
||||
$this->subject("Error: Domain Order $ldhName")
|
||||
->content("Domain name $ldhName tried to be purchased. The attempt failed.")
|
||||
|
||||
51
src/Service/InfluxdbService.php
Normal file
51
src/Service/InfluxdbService.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use App\Entity\Domain;
|
||||
use App\Entity\RdapServer;
|
||||
use InfluxDB2\Client;
|
||||
use InfluxDB2\Model\WritePrecision;
|
||||
use InfluxDB2\Point;
|
||||
use InfluxDB2\WriteType;
|
||||
|
||||
readonly class InfluxdbService
|
||||
{
|
||||
private Client $client;
|
||||
|
||||
public function __construct(
|
||||
private string $influxdbUrl = 'http://influxdb:8086',
|
||||
private string $influxdbToken = '',
|
||||
private string $influxdbBucket = 'domainwatchdog',
|
||||
private string $influxdbOrg = 'domainwatchdog',
|
||||
) {
|
||||
$this->client = new Client([
|
||||
'url' => $this->influxdbUrl,
|
||||
'token' => $this->influxdbToken,
|
||||
'bucket' => $this->influxdbBucket,
|
||||
'org' => $this->influxdbOrg,
|
||||
'precision' => WritePrecision::MS,
|
||||
]);
|
||||
}
|
||||
|
||||
public function addRdapRequest(RdapServer $rdapServer, Domain $domain, bool $success): void
|
||||
{
|
||||
$this->writePoints(new Point('rdap_request', [
|
||||
'domain' => $domain->getLdhName(),
|
||||
'tld' => $domain->getTld()->getTld(),
|
||||
'rdap_server' => $rdapServer->getUrl(),
|
||||
], [
|
||||
'success' => $success,
|
||||
]));
|
||||
}
|
||||
|
||||
public function writePoints(Point ...$points): void
|
||||
{
|
||||
$writeApi = $this->client->createWriteApi(['writeType' => WriteType::BATCHING, 'batchSize' => count($points)]);
|
||||
foreach ($points as $point) {
|
||||
$writeApi->write($point);
|
||||
}
|
||||
|
||||
$writeApi->close();
|
||||
}
|
||||
}
|
||||
@@ -87,6 +87,8 @@ readonly class RDAPService
|
||||
private EntityManagerInterface $em,
|
||||
private LoggerInterface $logger,
|
||||
private StatService $statService,
|
||||
private InfluxdbService $influxService,
|
||||
private bool $influxdbEnable = false,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -156,6 +158,10 @@ readonly class RDAPService
|
||||
$this->em->flush();
|
||||
}
|
||||
|
||||
if ($this->influxdbEnable) {
|
||||
$this->influxService->addRdapRequest($rdapServer, $domain, false);
|
||||
}
|
||||
|
||||
throw new NotFoundHttpException('The domain name is not present in the WHOIS database.');
|
||||
}
|
||||
|
||||
@@ -348,6 +354,10 @@ readonly class RDAPService
|
||||
$this->em->persist($domain);
|
||||
$this->em->flush();
|
||||
|
||||
if ($this->influxdbEnable) {
|
||||
$this->influxService->addRdapRequest($rdapServer, $domain, true);
|
||||
}
|
||||
|
||||
return $domain;
|
||||
}
|
||||
|
||||
|
||||
12
symfony.lock
12
symfony.lock
@@ -88,6 +88,18 @@
|
||||
"config/packages/nelmio_cors.yaml"
|
||||
]
|
||||
},
|
||||
"php-http/discovery": {
|
||||
"version": "1.20",
|
||||
"recipe": {
|
||||
"repo": "github.com/symfony/recipes",
|
||||
"branch": "main",
|
||||
"version": "1.18",
|
||||
"ref": "f45b5dd173a27873ab19f5e3180b2f661c21de02"
|
||||
},
|
||||
"files": [
|
||||
"config/packages/http_discovery.yaml"
|
||||
]
|
||||
},
|
||||
"phpstan/phpstan": {
|
||||
"version": "1.11",
|
||||
"recipe": {
|
||||
|
||||
Reference in New Issue
Block a user