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

[#33] Provide more health metrics #35

Merged
merged 9 commits into from
Nov 7, 2024
Merged

[#33] Provide more health metrics #35

merged 9 commits into from
Nov 7, 2024

Conversation

Wail-LT
Copy link
Collaborator

@Wail-LT Wail-LT commented Aug 23, 2024

related to issue #33

@Wail-LT Wail-LT requested a review from amanteaux August 23, 2024 10:11
@Wail-LT Wail-LT self-assigned this Aug 23, 2024
@Wail-LT Wail-LT linked an issue Aug 23, 2024 that may be closed by this pull request
@lucas-amiaud
Copy link
Member

Ok pour moi !

Copy link
Member

@amanteaux amanteaux left a comment

Choose a reason for hiding this comment

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

Il faudrait aussi mettre à jour la documentation avec tout ça

@@ -16,12 +16,12 @@
public class HikariDataSources {

public static DataSource fromConfig(Config config, String prefix) {
Copy link
Member

Choose a reason for hiding this comment

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

Ce serait plus simple de retourner directement un HikariDataSource non ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

En effet !

C'est corrigé.

public MetricsCheckBuilder registerHikariMetrics(HikariDataSource hikariDataSource) {
hikariDataSource.setMetricRegistry(this.metricRegistry);
return this;
}
Copy link
Member

Choose a reason for hiding this comment

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

Il faudrait ajouter un test d'intégration avec ça pour vérifier qu'on récupère bien toutes les métriques et que c'est ok. Tu peux voir avec chatgpt pour t'aider à écrire le test :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes j'ajoute ça !

@Wail-LT Wail-LT force-pushed the more-metrics branch 6 times, most recently from 1ef1d28 to 3706925 Compare October 14, 2024 14:53
* Expose a {@link HikariDataSource} Object through dependency injection.
*/
@Singleton
public class HikariDataSourceProvider implements DataSourceProvider {
Copy link
Member

Choose a reason for hiding this comment

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

Ce serait pas plus simple de juste garder DataSourceProvider et mettre le code de cette classe dedans ?

Copy link
Collaborator Author

@Wail-LT Wail-LT Oct 14, 2024

Choose a reason for hiding this comment

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

On ne veut pas laisser le choix d'avoir un autre Datasource que Hikari ?

Copy link
Member

Choose a reason for hiding this comment

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

Si si on va le permettre, il suffira juste d'implémenter son propre Provider<DataSource>. Par contre en y repensant, peut-être qu'il faudrait tout de même garder le nom de HikariDataSourceProvider à la place de DataSourceProvider qui est moins clair sur le rôle du provider.

Copy link
Collaborator Author

@Wail-LT Wail-LT Oct 15, 2024

Choose a reason for hiding this comment

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

Justement je ne suis pas sûr qu'en implémentant un Provider cela fonctionne.

public class CustomDataSourceProvider implements Provider<DataSource>;

bind(HikariDataSourceProvider.class).to(CustomDataSourceProvider.class);
Ça ne fonctionnera pas, HikariDataSources != Datasource.

Comment on lines 21 to 20
public HikariDataSourceProvider(Config config, String prefix) {
this.dataSource = HikariDataSources.fromConfig(config, prefix + ".hikari");
}
Copy link
Member

Choose a reason for hiding this comment

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

Je pense qu'on peut supprimer ce constructeur, il n'a pas vraiment de sens en fait. Si quelqu'un veut créer une autre datasource, il appelera juste HikariDataSources.fromConfig(...)
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah oui pas faux !

}
@Override
protected void configure() {
bind(DataSourceProvider.class).to(HikariDataSourceProvider.class);
Copy link
Member

Choose a reason for hiding this comment

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

Cette ligne ne sert pas vraiment. Par contre il manque la ligne: bind(HikariDataSource.class).toProvider(DataSourceProvider.class)

@Wail-LT Wail-LT force-pushed the more-metrics branch 2 times, most recently from e5f273f to 03a7ae4 Compare October 15, 2024 09:56
Copy link

sonarqubecloud bot commented Nov 7, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
16.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

@amanteaux amanteaux merged commit 11b5aea into master Nov 7, 2024
1 of 2 checks passed
@amanteaux amanteaux deleted the more-metrics branch November 7, 2024 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide more health metrics
3 participants