-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
plume-db/src/main/java/com/coreoz/plume/db/transaction/HikariDataSources.java
Show resolved
Hide resolved
Ok pour moi ! |
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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é.
plume-db/src/main/java/com/coreoz/plume/db/transaction/HikariDataSources.java
Show resolved
Hide resolved
public MetricsCheckBuilder registerHikariMetrics(HikariDataSource hikariDataSource) { | ||
hikariDataSource.setMetricRegistry(this.metricRegistry); | ||
return this; | ||
} |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes j'ajoute ça !
1ef1d28
to
3706925
Compare
* Expose a {@link HikariDataSource} Object through dependency injection. | ||
*/ | ||
@Singleton | ||
public class HikariDataSourceProvider implements DataSourceProvider { |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
public HikariDataSourceProvider(Config config, String prefix) { | ||
this.dataSource = HikariDataSources.fromConfig(config, prefix + ".hikari"); | ||
} |
There was a problem hiding this comment.
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(...)
}
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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)
e5f273f
to
03a7ae4
Compare
|
related to issue #33