Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.
/ hyperf-metric Public archive
forked from hyperf/metric

[CORE-1049] Adaptação do hyperf/metric para a PicPay #1

Merged
merged 5 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @PicPay/core-transacional-orquestrador
13 changes: 0 additions & 13 deletions .github/workflows/close-pull-request.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/release.yml

This file was deleted.

8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/vendor/
composer.lock
*.cache
*.log
*.log
.idea/
clover-coverage-report.xml
coverage/
vendor/
97 changes: 97 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php

$header = <<<'EOF'
This file is part of Hyperf + PicPay.

@link https://github.com/PicPay/hyperf-metric
@document https://github.com/PicPay/hyperf-metric/wiki
@contact @PicPay
@license https://github.com/PicPay/hyperf-metric/blob/main/LICENSE
EOF;

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'@DoctrineAnnotation' => true,
'@PhpCsFixer' => true,
'header_comment' => [
'comment_type' => 'PHPDoc',
'header' => $header,
'separate' => 'none',
'location' => 'after_declare_strict',
],
'array_syntax' => [
'syntax' => 'short',
],
'list_syntax' => [
'syntax' => 'short',
],
'concat_space' => [
'spacing' => 'one',
],
'blank_line_before_statement' => [
'statements' => [
'declare',
],
],
'general_phpdoc_annotation_remove' => [
'annotations' => [
'author',
],
],
'ordered_imports' => [
'imports_order' => [
'class', 'function', 'const',
],
'sort_algorithm' => 'alpha',
],
'single_line_comment_style' => [
'comment_types' => [
],
],
'yoda_style' => [
'always_move_variable' => false,
'equal' => false,
'identical' => false,
],
'phpdoc_align' => [
'align' => 'left',
],
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'constant_case' => [
'case' => 'lower',
],
'class_attributes_separation' => true,
'combine_consecutive_unsets' => true,
'declare_strict_types' => true,
'linebreak_after_opening_tag' => true,
'lowercase_static_reference' => true,
'no_useless_else' => true,
'no_unused_imports' => true,
'not_operator_with_successor_space' => true,
'not_operator_with_space' => false,
'ordered_class_elements' => true,
'php_unit_strict' => false,
'phpdoc_separation' => false,
'single_quote' => true,
'standardize_not_equals' => true,
'multiline_comment_opening_closing' => true,
'php_unit_test_class_requires_covers' => false,
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
],
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('public')
->exclude('runtime')
->exclude('vendor')
->in(__DIR__)
)
->setUsingCache(true);
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) Hyperf
Copyright (c) Hyperf + PicPay

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.PHONY: default
default:
composer lint
composer test
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Hyperf Metric

## Como usar

### Configurando o repositório
```shell
composer config repositories.metric vcs https://github.com/PicPay/hyperf-metric
```

### Instalando
```shell
composer require hyperf/metric
```
ou se você já tem o `hyperf/metric` no projeto:
```shell
composer update hyperf/metric
```
35 changes: 35 additions & 0 deletions bin/phpunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env php
<?php

declare(strict_types=1);

ini_set('display_errors', 'on');
ini_set('display_startup_errors', 'on');

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

error_reporting(E_ALL);

Swoole\Runtime::enableCoroutine(true);

Swoole\Coroutine::set([
'hook_flags' => SWOOLE_HOOK_ALL,
'exit_condition' => static fn (): bool => Swoole\Coroutine::stats()['coroutine_num'] === 0,
]);

$code = 0;
Swoole\Coroutine\run(static function () use (&$code): void {
try {
$code = PHPUnit\TextUI\Command::main(false);
} catch (PHPUnit\TextUI\RuntimeException $e) {
if ($e->getMessage() === 'swoole exit') {
return;
}

throw $e;
} finally {
Swoole\Timer::clearAll();
Hyperf\Utils\Coordinator\CoordinatorManager::until(Hyperf\Utils\Coordinator\Constants::WORKER_EXIT)->resume();
}
});
exit($code);
23 changes: 19 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,28 @@
"metrics",
"influxdb"
],
"description": "hyperf metric component",
"description": "This is a hyperf/metric version suited for PicPay's Hyperf microservices needs.",
"require": {
"php": ">=8.0",
"hyperf/contract": "~3.0.0",
"hyperf/guzzle": "~3.0.0",
"hyperf/utils": "~3.0.0",
"hyperf/contract": "^2.2|^3.0",
"hyperf/guzzle": "^2.2|^3.0",
"hyperf/utils": "^2.2|^3.0",
"promphp/prometheus_client_php": "2.2.*",
"psr/container": "^1.0|^2.0",
"psr/event-dispatcher": "^1.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.13",
"hyperf/config": "^2.2|^3.0",
"hyperf/di": "^2.2",
"hyperf/event": "^2.2",
"hyperf/process": "^2.2",
"mockery/mockery": "^1.5",
"phpunit/phpunit": "^9.5",
"roave/security-advisories": "dev-latest",
"swoole/ide-helper": "^5.0"
},
"suggest": {
"slickdeals/statsd": "Required to use StatdD driver.",
"influxdb/influxdb-php": "Required to use InfluxDB driver.",
Expand All @@ -39,6 +50,10 @@
"HyperfTest\\Metric\\": "tests/"
}
},
"scripts": {
"test": "bin/phpunit",
"lint": "php-cs-fixer fix"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
Expand Down
Loading