Metrics v4 draft overview #1533
Replies: 4 comments 3 replies
-
I don't see one. Or am I blind?
As long as you are clear how I have to change my workflow file (.yml) I am happy with the changes. |
Beta Was this translation helpful? Give feedback.
-
It probs is worth for me to put the mastodon plugin on hold until a first working version of v4 is usable, so that I can move things over... |
Beta Was this translation helpful? Give feedback.
-
Sounds great! I hope I don't break my head figuring out the TS. I'm still a newbie. |
Beta Was this translation helpful? Give feedback.
-
Seems really dope ! If you need any help to migrate plugins, don't hesite to ping me or something. To be honest, the current architecture was scaring me a bit, but seeing TypeScript coming to the scene makes me wanting to contribute a lot to metrics and become a maintainer maybe ? but I'm not sure if I'm qualified enough ^^'. |
Beta Was this translation helpful? Give feedback.
-
Metrics v4 - Draft
metrics will undergo significant changes in next release in order to be more performant, portable, ergonomic, powerful and maintainable.
It will switch to deno runtime and will be rewritten in TypeScript, and the way to pass options will change entirely.
New concepts and usage
metrics will still be based on plugins, but will also introduce actions and transformers. Additionally, templates will now be merged with plugins, and the presets will offer more possibilities
The action will require a config file instead of accepting directly inputs.
Presets
Plugins, actions and transformers
Actions
Web server
The web server will behave similarly, except that presets cannot be defined on the fly (they need to be defined by the administrator).
The syntax will ba a lax-YAML one:
Privacy and security
The new version will retest all plugins with GitHub fine-grained token, in order to make sure they're compatible (and are able to properly handle missing scopes without dying) to give users more control on how their data are accessed and processed.
As it'll be based on deno, security flags will superseed
extras.features
option and be even more powerful.For example you will be able to run metrics with
--allow-net=api.github.com --allow-write=/tmp --allow-run=git,licensed
to ensure your data are not leaded anywhere.You'll be able to run external plugins (and even official ones) with a peaceful mind.
Portability
The new engine is designed to be extremely versatile and can be run more easily as standalone.
It'll be able to be run as a GitHub action and server (like currently), and a proper CLI will be offered later one (maybe even a single binary thanks to
deno compile
, but to be seen)The new engine is expected to uncouple the dependencies on base/core plugins to not only make rendering faster, but also to make it possible to be able to run metrics on serverless services - such as Vercel or Deno deploy - for most plugins (some time/cpu intensive ones, or binaries-based one probably won't make the cut though).
Setting up metrics will also be more easy, as the only requirement will be to install the deno runtime (single executable).
As plugin dependencies are URL based, native tree-shaking will also users to not download all dependencies requiring minimal setup and configuration.
Reusability
metrics will also be designed so that third-parties app and scripts can plug to it directly:
This will (hopefully) increase contributors engagement and expand the metrics ecosystem to make it more accessible and maintainable, in the hope that this project can live on even with me not being around
Also, thanks to decentralized dependencies, plugins authors will now be able to load any external dependency (or even load a different version of a dependency).
Since deno only load dependency at upon usage, they won't impact performance and size of the app.
For example the RSS plugin:
Stability and new features
Plugins will be retested as they're being migrated, and they'll be simplified.
Templates will also be simplified/normalized in order to be both lightweight and easily editable using injected CSS / JS (similarly to
extras.css
andextras.js
options)New options and features will also be progressively added during this refactor (see migration guide below)
Inputs and outputs validation
Data validation will be delegated to Zod, which is able to both validate content at runtime but also infer typing during developpment. In addition, metrics will start normalizing and validating outputs, which mean that plugins results can be safely used in other applications.
metadata.yml
will be removed, but documentation will still be generated (probably using zod-to-json-schema)Below is an example of data validation looks like:
Improved testing and coverage
Currently, testing metrics is pretty painful as we need to rebuild the docker container, spawn a fake web instance and simulate different environments against it. It's hyper slow (~30 min) which is also frustrating.
Thanks to the engine rework, it's now insanely faster, and we're also able to provide code coverage.
Data mocking has also been reworked to be way less hacky than currently, making it also more robust for testing:
TypeScript and linting will prevent basic errors.
PRs will be integrated better with serverless application to offer proper previewing.
What for now ?
There is no ETA for this, but a pre-release will eventually come out as I'm rewritting the engine.
v3.35 will probably just be replaced by v4
Once the engine is rewritten with a few plugins, the rest of features will be progressively migrated until v4 is on par with v3.
I'll accept PRs for plugins migrations (and if you're interested to eventually be a maintainer in the future, let me know)
metrics.lecoq.io will probably be migrated to either Deno deploy or Vercel, and even if
@main
/@master
/@latest
are bumped to v4, a "configuration transpiler" will be implemented (which will also be offered to users to convert to the future new config format).I'm still experimenting with what can be done, but I'm open to feedback.
The migration guide below will also act as a progress list
Thanks for reading up until there 💕 !
Beta Was this translation helpful? Give feedback.
All reactions