[Question][GitHub] How to create a new metric using PR description extraction
Question
We are enforcing "AI Usage" stats to be present in PR description. Example of stats:
AI Usage:
- AI lines: 20
- Human lines: 80
I would like to create a new metric by extracting this information from PR descriptions and display. How can I achieve this?
Screenshots
If applicable, add screenshots to help explain.
Additional context
Add any other context here.
You can extract "AI Usage" stats from PR descriptions and display them as a new metric in DevLake by following these steps:
-
Add custom fields: Use the customize plugin/service to create new columns (e.g.,
x_ai_lines,x_human_lines) in the relevant PR metrics table. This is supported by the backend service, which manages dynamic schema changes for custom metrics "customize plugin service". -
Extract values from PR descriptions: Implement a parser (typically using regex) in your data ingestion pipeline or as a plugin extension to extract the "AI lines" and "Human lines" values from the PR description and populate the custom fields during ingestion. The project settings UI and linker plugin show how regex-based extraction from PR descriptions is supported for other use cases "project settings UI".
-
Store and access the metrics: Once extracted, these values are stored in your database and can be queried like any other metric. DevLake recommends creating a dedicated table per data stream for new metrics, following naming and indexing conventions "plugin/table conventions".
-
Visualize in dashboards: After the data is collected, you can create or modify Grafana dashboard panels to visualize your new metrics. All data is stored in MySQL, and you can use custom SQL queries in Grafana to aggregate and display the extracted "AI Usage" stats "custom dashboards" "dashboard SQL example".
This approach lets you track and visualize "AI lines" and "Human lines" from PR descriptions alongside your other engineering metrics.
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
I think you could write your own plugin for your purpose—check out the DORA plugin; it does something similar.
@klesh thank you for your answer. I will try out the suggestion you mentioned.
This issue has been automatically marked as stale because it has been inactive for 60 days. It will be closed in next 7 days if no further activity occurs.
This issue has been closed because it has been inactive for a long time. You can reopen it if you encounter the similar problem in the future.