Skip to content

Conversation

@subkanthi
Copy link
Collaborator

No description provided.

@subkanthi
Copy link
Collaborator Author

Screenshot 2025-12-11 at 11 15 21 AM

@subkanthi
Copy link
Collaborator Author

subkanthi commented Dec 16, 2025

There are some metrics that ice is not currently tracking

CommitMetrics
totalFilesSizeInBytes
iceberg_commit_added_delete_files_total

@subkanthi subkanthi marked this pull request as ready for review December 17, 2025 13:54
Copy link
Collaborator

@shyiko shyiko left a comment

Choose a reason for hiding this comment

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

Looks good overall. Thank you!

<!-- hide "Unable to load metrics class: 'org.apache.iceberg.hadoop.HadoopMetricsContext', falling back to null metrics" -->
<logger name="org.apache.iceberg.aws.s3.S3FileIO" level="ERROR"/>
<!-- hide "Unclosed input stream" warnings from Iceberg's S3InputStream finalizer -->
<logger name="org.apache.iceberg.aws.s3.S3InputStream" level="ERROR"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

isn't this an indicator that we're not doing a good job at closing input streams and need to fix that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was coming from iceberg API and it was flooding the logs in a loop, I will get the exception


// ==========================================================================
// Public methods
// ==========================================================================
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: comments like these should be avoided

private final Counter messageParseErrorsTotal;

/** Returns the singleton instance of the metrics reporter. */
public static InsertWatchMetrics getInstance() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: why not use IoDH for instance lazy loading (and avoid the lock?

"Total number of retry attempts due to failures";

// SQS errors
private static final String SQS_RECEIVE_ERRORS_TOTAL_NAME = "ice_watch_sqs_receive_errors_total";
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we perhaps drop sqs from metric names here and below for consistency with metrics above + in case we decide to add support for other message queue?



# delete partition
ice delete nyc.taxis_p_by_day --partition '[{"name": "tpep_pickup_datetime", "values": ["2024-12-31T23:51:20"]}]' --dry-run=false
Copy link
Collaborator

Choose a reason for hiding this comment

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

\ like the rest

// Record deletion metrics
metrics.recordOrphanFilesDeleted(tableName, deletedCount.get());
for (int i = 0; i < failedCount.get(); i++) {
metrics.recordOrphanDeleteFailure(tableName);
Copy link
Collaborator

Choose a reason for hiding this comment

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

any reason it's not metrics.recordOrphanDeleteFailure(tableName, failedCount.get())?

}

// Initialize Iceberg metrics reporter for Prometheus (singleton)
PrometheusMetricsReporter metricsReporter = PrometheusMetricsReporter.getInstance();
Copy link
Collaborator

Choose a reason for hiding this comment

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

some Metrics objects are passed around (like here), others are not (like MaintenanceMetrics.getInstance()). Let's settle on one approach

builder.endpointOverride(endpoint);
}
} catch (Exception e) {
logger.warn("Failed to parse SQS queue URL for endpoint extraction: {}", e.getMessage());
Copy link
Collaborator

Choose a reason for hiding this comment

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

throw instead of ignore-logging, perhaps?

if (host != null && !host.endsWith(".amazonaws.com")) {
URI endpoint = new URI(uri.getScheme(), null, host, uri.getPort(), null, null, null);
logger.info("Using custom SQS endpoint: {}", endpoint);
builder.endpointOverride(endpoint);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd suggest introducing cli option (e.g. --watch-endpoint) that allow to specify a different value from --watch as proposed approach falls apart when using localstack, etc. This way things also can continue to use AWS_ENDPOINT_URL_SQS env var when needed.

*/
package com.altinity.ice.rest.catalog.internal.metrics;

import static com.altinity.ice.rest.catalog.internal.metrics.IcebergMetricNames.*;
Copy link
Collaborator

Choose a reason for hiding this comment

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

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.

3 participants