5 commented on code in PR #204: URL: https://github.com/apache/cassandra-sidecar/pull/204#discussion_r1994324098
########## server/src/main/java/org/apache/cassandra/sidecar/datahub/SchemaReporter.java: ########## @@ -96,45 +110,73 @@ public SchemaReporter(@NotNull IdentifiersProvider identifiersProvider, * @param keyspaceConverters a {@link List} of {@link KeyspaceToAspectConverter} instances to use * @param tableConverters a {@link List} of {@link TableToAspectConverter} instances to use * @param emitterFactory an instance of {@link EmitterFactory} to use + * @param reportingMetrics an instance of {@link SchemaReportingMetrics} to use */ protected SchemaReporter(@NotNull IdentifiersProvider identifiersProvider, @NotNull List<ClusterToAspectConverter<? extends RecordTemplate>> clusterConverters, @NotNull List<KeyspaceToAspectConverter<? extends RecordTemplate>> keyspaceConverters, @NotNull List<TableToAspectConverter<? extends RecordTemplate>> tableConverters, - @NotNull EmitterFactory emitterFactory) + @NotNull EmitterFactory emitterFactory, + @NotNull SchemaReportingMetrics reportingMetrics) { this.identifiersProvider = identifiersProvider; this.clusterConverters = clusterConverters; this.keyspaceConverters = keyspaceConverters; this.tableConverters = tableConverters; this.emitterFactory = emitterFactory; + this.reportingMetrics = reportingMetrics; } /** - * Public method for converting and reporting the Cassandra schema + * Public method for converting and reporting the Cassandra schema when triggered by a scheduled periodic task * * @param cluster the {@link Cluster} to extract Cassandra schema from */ - public void process(@NotNull Cluster cluster) + public void processScheduled(@NotNull Cluster cluster) { - process(cluster.getMetadata()); + process(cluster.getMetadata(), reportingMetrics.startedSchedule.metric); } /** - * Public method for converting and reporting the Cassandra schema + * Public method for converting and reporting the Cassandra schema when triggered by a received API request * * @param metadata the {@link Metadata} to extract Cassandra schema from */ - public void process(@NotNull Metadata metadata) + public void processRequested(@NotNull Metadata metadata) { + process(metadata, reportingMetrics.startedRequest.metric); + } + + /** + * Private method for converting and reporting the Cassandra schema + * + * @param metadata the {@link Metadata} to extract Cassandra schema from + * @param started the {@link DeltaGauge} for the metric counting invocations + */ + private void process(@NotNull Metadata metadata, + @NotNull DeltaGauge started) + { + String action = " reporting schema for cluster with identifiers " + identifiersProvider; Review Comment: This did not look good and resulted in bad log messages, fixed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org