-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Track Glue API calls that were untracked #11059
Conversation
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.
are you positive this is the only untracked one?
@@ -370,10 +370,10 @@ public void updateTableStatistics(String databaseName, String tableName, AcidTra | |||
final Map<String, String> statisticsParameters = updateStatisticsParameters(table.getParameters(), updatedStatistics.getBasicStatistics()); | |||
tableInput.setParameters(statisticsParameters); | |||
table = Table.builder(table).setParameters(statisticsParameters).build(); | |||
glueClient.updateTable(new UpdateTableRequest() | |||
stats.getReplaceTable().call(() -> glueClient.updateTable(new UpdateTableRequest() |
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.
the stats should be called "updateTable"
I looked through other usages of glueClient and didn't spot anything else. |
What about trino/plugin/trino-hive/src/main/java/io/trino/plugin/hive/metastore/glue/GlueHiveMetastore.java Lines 429 to 433 in 262c6ec
|
Regarding the one you pointed out, maybe I am wrong but I thought there is no good way to measure this as this is an async call so we pretty much will measure only the time of the invocation of async which is not very informative |
ff65249
to
72d5f58
Compare
|
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.
LGTM - commit message may be a bit more accurate as you are also changing counter name
You may want to add a callback on the returned future to bump statistic. |
c2cf1ca
to
e739f6b
Compare
e739f6b
to
a1aa458
Compare
Not strictly necessary but a possible improvement from what we have. Would it be better if Seems like that might be a more helpful way of tracking those stats to me. |
.withDatabaseName(table.getDatabaseName()) | ||
.withTableName(table.getTableName()) | ||
.withEntries(partitionUpdateRequestsPartition))); | ||
.withCatalogId(catalogId) |
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.
there is more *async calls than just this one. We should address all together.
public void updateFailures() | ||
{ | ||
totalFailures.update(1); | ||
} | ||
|
||
public void updateTime(long elapsedMilliseconds) | ||
{ | ||
time.add(elapsedMilliseconds, MILLISECONDS); | ||
} |
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.
replace with single method
void recordCall(executionTime, boolean failure)
Agreed. Currently lots of calls is still untracked. |
a1aa458
to
1fc15e3
Compare
.flatMap(List::stream) | ||
.map(com.amazonaws.services.glue.model.Database::getName) | ||
.collect(toImmutableList()); | ||
return databaseNames; |
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.
If you retained the variable, the diff would be readable.
(btw the IDE asks me to inline such variables, but i acutally find it useful during debugging)
|
||
public StatsRecordingAsyncHandler(GlueMetastoreStats stats, long startTimeInMillis) | ||
{ | ||
this.stats = stats; |
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.
requireNonNull
.filter(tableFilter) | ||
.map(com.amazonaws.services.glue.model.Table::getName) | ||
.collect(toImmutableList()); | ||
return tableNames; |
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.
same, no idea what changed
@Override | ||
public void onError(Exception e) | ||
{ | ||
stats.getBatchUpdatePartition().recordCall(System.currentTimeMillis() - startTimeInMillis, true); |
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.
You should use different GlueMetastoreApiStats
instance for different places when you use StatsRecordingAsyncHandler
. Not stats.getBatchUpdatePartition()
all the time.
Change parametrization of StatsRecordingAsyncHandler
to use GlueMetastoreApiStats
instead of GlueMetastoreStats
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 definitely, I forgot to change that, thanks for catching this
edafa22
to
61df66b
Compare
.collect(toImmutableList()); | ||
return databaseNames; | ||
}); | ||
ImmutableList<String> databases = getPaginatedResults( |
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.
use List
And keep variable name
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.
Also add a followup commit which just gets rid of variables.
.withDatabaseName(databaseName), | ||
GetTablesRequest::setNextToken, | ||
GetTablesResult::getNextToken, | ||
stats.getGetAllTables()) |
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.
I think we should merge stats couneters for getting views and tables.
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.
Can you also rename dropDatabase
stats counter tdeleteDatabase
.
(you can put all the renames in single commit)
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.
Same for renameDatabase
-> updateDatabase
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.
And dropTable
-> deleteTable
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.
batchGetPartitionAsync
is not covered with stats from what I see.
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.
dropPartition
-> deletePartition
61df66b
to
fabf601
Compare
fabf601
to
442a800
Compare
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.
skimmed, lgtm
@@ -93,13 +92,6 @@ public GlueMetastoreApiStats getGetTable() | |||
return getTable; | |||
} | |||
|
|||
@Managed | |||
@Nested | |||
public GlueMetastoreApiStats getGetAllViews() |
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.
This belongs to previous commit, where the last usage was removed.
442a800
to
017d982
Compare
@@ -1126,4 +1130,29 @@ public void revokeTablePrivileges(String databaseName, String tableName, String | |||
{ | |||
return ImmutableSet.of(); | |||
} | |||
|
|||
static class StatsRecordingAsyncHandler<Request extends AmazonWebServiceRequest, Result> |
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.
Seems like this belongs in GlueMetastoreApiStats
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.
Let's change it as a followup :)
Description
One call to Glue was not being tracked.
Rename GlueMetastoreStats.renameTable to GlueMetastoreStats.updateTable.
General information
a fix
a connector
It will allow to more precisely track calls to external api - Glue
Related issues, pull requests, and links
Documentation
(x) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.
Release notes
(x) No release notes entries required.
( ) Release notes entries required with the following suggested text: