Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Future add data source #489

Open
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

evgenybukharev
Copy link

@evgenybukharev evgenybukharev commented Jun 23, 2022

Q A
Is bugfix?
New feature? ✔️
Breaks BC? ✔️

* add data storage

* add data storage

* add data storage

* fix type hints
@evgenybukharev
Copy link
Author

Another debug data storage support

@evgenybukharev evgenybukharev marked this pull request as ready for review June 23, 2022 13:43
@bizley bizley added the pr:missing usecase It is not clear what is the use case for the pull request. label Jun 23, 2022
@yii-bot
Copy link

yii-bot commented Jun 23, 2022

Thank you for putting effort in the improvement of the Yii framework.
We have reviewed your pull request.

Unfortunately a use case is missing. It is required to get a better understanding of the pull request and helps us to determine the necessity and applicability of the suggested change to the framework.

Could you supply us with a use case please? Please be as detailed as possible and show some code!

Thanks!

This is an automated comment, triggered by adding the label pr:missing usecase.

@evgenybukharev
Copy link
Author

evgenybukharev commented Jun 23, 2022

The functionality of data storage of the debug panel is implemented not only in file storage, an interface has been added that allows users to implement any convenient storage for data, whether it is a database or redis. The cache data storage is also implemented

sorry for my english

#73

@bizley bizley removed the pr:missing usecase It is not clear what is the use case for the pull request. label Jun 23, 2022
@bizley bizley requested a review from samdark June 23, 2022 16:28
@samdark samdark added the type:enhancement Enhancement label Jun 30, 2022
src/LogTarget.php Outdated Show resolved Hide resolved
Copy link
Member

@samdark samdark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks like a good thing but requires major release since public API changes. Need a line for CHANGELOG and UPGRADE instructions.

@samdark samdark mentioned this pull request Nov 18, 2022
5 tasks
@SamMousa
Copy link
Contributor

I like the idea of this PR but I'm not convinced on the architectural choices.

In my opinion storing data is the task of a log target. By limiting your changes only to a new LogTarget we don't have to break BC which is a big win.

Also I don't see the benefit of introducing a new interface, which will see few implementors.
Instead just tie this to our CacheInterface and any implementor can easily implement that.

My unfinished proof of concept: #495 achieves similar functionality with just a new target. Meaning no BC break.

Also this PR suffers from the same shortcoming as my PoC for mail files: they are still stored on disk.
For the mail files I'll create a new issue since maybe we can solve that outside of this one.

@evgenybukharev
Copy link
Author

@samdark Hi, I added line to CHANGELOG and added instructions to README

src/Module.php Outdated Show resolved Hide resolved
src/LogTarget.php Show resolved Hide resolved
src/LogTarget.php Outdated Show resolved Hide resolved
src/LogTarget.php Outdated Show resolved Hide resolved
src/Module.php Outdated Show resolved Hide resolved
$data = $this->cache->get($this->cacheDebugDataKey . $tag);
if (empty($data)) {
return [];
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is new component, let's stop this nonsense with returns in the if-else.

$manifest = $this->cache->get($this->cacheDebugManifestKey);
if (empty($manifest)) {
return [];
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is new component, let's stop this nonsense with returns in the if-else.

src/components/data/DataStorage.php Show resolved Hide resolved
src/components/data/DataStorage.php Outdated Show resolved Hide resolved
src/components/data/FileDataStorage.php Show resolved Hide resolved
@bizley
Copy link
Member

bizley commented Jan 28, 2023

And we need tests.

@samdark samdark added this to the 2.2.0 milestone Feb 20, 2023
@samdark samdark removed this from the 2.2.0 milestone May 22, 2023
@samdark samdark added the pr:request for unit tests Unit tests are needed. label May 22, 2023
@yii-bot
Copy link

yii-bot commented May 22, 2023

Thank you for putting effort in the improvement of the Yii framework.
We have reviewed your pull request.

In order for the framework and your solution to remain stable in the future, we have a unit test requirement in place. Therefore we can only accept your pull request if it is covered by unit tests.

Could you add these please?

Thanks!

P.S. If you have any questions about the creation of unit tests? Don't hesitate to ask for support. More information about unit tests

This is an automated comment, triggered by adding the label pr:request for unit tests.


/**
* The Yii Debug Module provides the debug toolbar and debugger
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @since 2.0
* @since 2.0

Data Storage
-----

You can save debug data in any storage, for this you need to implement the yii\debug\components\data\DataStorage interface, and configure the module.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can save debug data in any storage, for this you need to implement the yii\debug\components\data\DataStorage interface, and configure the module.
You can save debug data in any storage, for this you need to implement the `yii\debug\components\data\DataStorage` interface, and configure the module.

@@ -226,7 +220,8 @@ public static function setYiiLogo($logo)
public function init()
{
parent::init();
$this->dataPath = Yii::getAlias($this->dataPath);

$this->dataStorage = Instance::ensure($this->dataStorageConfig + ['module' => $this],'yii\debug\components\data\DataStorage');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->dataStorage = Instance::ensure($this->dataStorageConfig + ['module' => $this],'yii\debug\components\data\DataStorage');
$this->dataStorage = Instance::ensure($this->dataStorageConfig + ['module' => $this], 'yii\debug\components\data\DataStorage');

}

/**
* @param string $tag
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need phpdoc here and in every other method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:request for unit tests Unit tests are needed. type:enhancement Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants