okumin opened a new pull request, #6461:
URL: https://github.com/apache/hive/pull/6461
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines:
https://cwiki.apache.org/confluence/display/Hive/HowToContribute
2. Ensure that you have created an issue on the Hive project JIRA:
https://issues.apache.org/jira/projects/HIVE/summary
3. Ensure you have added or run the appropriate tests for your PR:
4. If the PR is unfinished, add '[WIP]' in your PR title, e.g.,
'[WIP]HIVE-XXXXX: Your PR title ...'.
5. Be sure to keep the PR description updated to reflect all changes.
6. Please write your PR title to summarize what this PR proposes.
7. If possible, provide a concise example to reproduce the issue for a
faster review.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section
is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster
reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class
hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other
DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
Complete implementing
`/v1/{prefix}/namespaces/{namespace}/tables/{table}/metrics`.
https://issues.apache.org/jira/browse/HIVE-29593
### Why are the changes needed?
The current endpoint is NOOP, meaning we can't leverage the reported metrics
for further optimization.
### Does this PR introduce _any_ user-facing change?
No. By default, HMS administrators can see more logs.
### How was this patch tested?
1. Launch HMS.
```sh
$ docker run --rm -p 9001:9001
apache/hive:standalone-metastore-4.3.0-SNAPSHOT
```
2. Send events.
```sh
$ curl -i -X POST \
"http://localhost:9001/iceberg/v1/namespaces/default/tables/test/metrics" \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"report-type": "scan-report",
"table-name": "default.test",
"snapshot-id": 1000000000001,
"filter": true,
"schema-id": 0,
"projected-field-ids": [1],
"projected-field-names": ["id"],
"metrics": {
"total-planning-duration": {
"count": 1,
"time-unit": "nanoseconds",
"total-duration": 2644235116
},
"result-data-files": {
"unit": "count",
"value": 3
},
"result-delete-files": {
"unit": "count",
"value": 0
},
"total-data-manifests": {
"unit": "count",
"value": 1
},
"total-delete-manifests": {
"unit": "count",
"value": 0
},
"scanned-data-manifests": {
"unit": "count",
"value": 1
},
"skipped-data-manifests": {
"unit": "count",
"value": 0
},
"total-file-size-bytes": {
"unit": "bytes",
"value": 1048576
},
"total-delete-file-size-bytes": {
"unit": "bytes",
"value": 0
}
},
"metadata": {
"source": "dummy-curl",
"user": "test-user",
"trace-id": "dummy-trace-001"
}
}
JSON
$ curl -i -X POST \
"http://localhost:9001/iceberg/v1/namespaces/default/tables/test/metrics" \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"report-type": "commit-report",
"table-name": "default.test",
"snapshot-id": 1000000000002,
"sequence-number": 1,
"operation": "append",
"metrics": {
"total-duration": {
"count": 1,
"time-unit": "nanoseconds",
"total-duration": 1234567890
},
"attempts": {
"unit": "count",
"value": 1
},
"added-data-files": {
"unit": "count",
"value": 1
},
"removed-data-files": {
"unit": "count",
"value": 0
},
"added-records": {
"unit": "count",
"value": 100
},
"added-files-size-bytes": {
"unit": "bytes",
"value": 4096
}
},
"metadata": {
"source": "dummy-curl",
"user": "test-user",
"trace-id": "dummy-trace-002"
}
}
JSON
```
3. I can see the logs
```
2026-05-04T08:54:27,327 INFO [qtp1859459396-63]
metrics.LoggingMetricsReporter: Event reported at
2026-05-04T08:54:27.327327085Z: catalog=hive,
report=ScanReport{tableName=default.test, snapshotId=1000000000001,
filter=true, schemaId=0, projectedFieldIds=[1], projectedFieldNames=[id],
scanMetrics=ScanMetricsResult{totalPlanningDuration=TimerResult{timeUnit=NANOSECONDS,
totalDuration=PT2.644235116S, count=1},
resultDataFiles=CounterResult{unit=COUNT, value=3},
resultDeleteFiles=CounterResult{unit=COUNT, value=0},
totalDataManifests=CounterResult{unit=COUNT, value=1},
totalDeleteManifests=CounterResult{unit=COUNT, value=0},
scannedDataManifests=CounterResult{unit=COUNT, value=1},
skippedDataManifests=CounterResult{unit=COUNT, value=0},
totalFileSizeInBytes=null, totalDeleteFileSizeInBytes=null,
skippedDataFiles=null, skippedDeleteFiles=null, scannedDeleteManifests=null,
skippedDeleteManifests=null, indexedDeleteFiles=null, equalityDeleteFiles=null,
positionalDeleteFiles=null, dvs=n
ull}, metadata={source=dummy-curl, user=test-user, trace-id=dummy-trace-001}}
...
2026-05-04T08:54:59,442 INFO [qtp1859459396-59]
metrics.LoggingMetricsReporter: Event reported at
2026-05-04T08:54:59.442439794Z: catalog=hive,
report=CommitReport{tableName=default.test, snapshotId=1000000000002,
sequenceNumber=1, operation=append,
commitMetrics=CommitMetricsResult{totalDuration=TimerResult{timeUnit=NANOSECONDS,
totalDuration=PT1.23456789S, count=1}, attempts=CounterResult{unit=COUNT,
value=1}, addedDataFiles=CounterResult{unit=COUNT, value=1},
removedDataFiles=CounterResult{unit=COUNT, value=0}, totalDataFiles=null,
addedDeleteFiles=null, addedEqualityDeleteFiles=null,
addedPositionalDeleteFiles=null, addedDVs=null, removedDeleteFiles=null,
removedEqualityDeleteFiles=null, removedPositionalDeleteFiles=null,
removedDVs=null, totalDeleteFiles=null, addedRecords=CounterResult{unit=COUNT,
value=100}, removedRecords=null, totalRecords=null,
addedFilesSizeInBytes=CounterResult{unit=BYTES, value=4096},
removedFilesSizeInBytes=null, totalFilesSizeInBytes=null, addedPos
itionalDeletes=null, removedPositionalDeletes=null,
totalPositionalDeletes=null, addedEqualityDeletes=null,
removedEqualityDeletes=null, totalEqualityDeletes=null, manifestsCreated=null,
manifestsReplaced=null, manifestsKept=null, manifestEntriesProcessed=null},
metadata={source=dummy-curl, user=test-user, trace-id=dummy-trace-002}}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]