disttask: support metering on next-gen#63397
Conversation
|
Hi @tangenta. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
@tangenta: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Signed-off-by: tangenta <tangenta@126.com>
1ce6cde to
99dec4d
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #63397 +/- ##
================================================
+ Coverage 72.8045% 75.0251% +2.2205%
================================================
Files 1840 1888 +48
Lines 497436 510889 +13453
================================================
+ Hits 362156 383295 +21139
+ Misses 113284 104149 -9135
- Partials 21996 23445 +1449
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Signed-off-by: tangenta <tangenta@126.com>
Signed-off-by: tangenta <tangenta@126.com>
Signed-off-by: tangenta <tangenta@126.com>
Signed-off-by: tangenta <tangenta@126.com>
Signed-off-by: tangenta <tangenta@126.com>
|
/retest |
|
@tangenta: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Signed-off-by: tangenta <tangenta@126.com>
| m.logger.Warn("metering writer closed", zap.Error(err)) | ||
| } | ||
|
|
||
| func (m *Meter) flush(ts int64, timeout time.Duration) { |
There was a problem hiding this comment.
print a log on success flush too with the time cost
| } | ||
|
|
||
| // RecordDXFReadDataBytes records the scan data bytes from user store for DXF. | ||
| func RecordDXFReadDataBytes(store kv.Storage, taskType TaskType, taskID int64, size uint64) { |
There was a problem hiding this comment.
not called for import-into
Signed-off-by: tangenta <tangenta@126.com>
Signed-off-by: tangenta <tangenta@126.com>
Signed-off-by: tangenta <tangenta@126.com>
Signed-off-by: tangenta <tangenta@126.com>
| entry := meteringEntry{ | ||
| keyspace: keyspace, | ||
| taskID: taskID, | ||
| taskType: taskType, | ||
| } | ||
| orig := m.data[entry] | ||
| orig.merge(other) | ||
| m.data[userKeyspace] = orig | ||
| m.data[entry] = orig |
There was a problem hiding this comment.
maybe use taskID as key, it's unique already
BenchmarkMapAccess/composite_key,_copy_by_value
BenchmarkMapAccess/composite_key,_copy_by_value-10 39376554 31.37 ns/op
BenchmarkMapAccess/int_key,_copy_by_ref
BenchmarkMapAccess/int_key,_copy_by_ref-10 793769133 1.514 ns/op
PASS
type meteringEntry struct {
keyspace string
taskID int64
taskType string
}
type Data struct {
putRequests uint64
getRequests uint64
readDataBytes uint64
writeDataBytes uint64
}
type Data2 struct {
meteringEntry
putRequests uint64
getRequests uint64
readDataBytes uint64
writeDataBytes uint64
}
func BenchmarkMapAccess(b *testing.B) {
b.Run("composite key, copy by value", func(b *testing.B) {
m := make(map[meteringEntry]Data)
for i := 0; i < b.N; i++ {
key := meteringEntry{keyspace: "ks1", taskID: 1, taskType: "import"}
data := m[key]
data.readDataBytes++
m[key] = data
}
})
b.Run("int key, copy by ref", func(b *testing.B) {
m := make(map[int64]*Data2)
for i := 0; i < b.N; i++ {
if data, ok := m[1]; !ok {
data = &Data2{meteringEntry: meteringEntry{keyspace: "ks1", taskID: 1, taskType: "import"}}
m[1] = data
} else {
data.readDataBytes++
}
}
})
}| zap.Duration("duration", time.Since(startTime)), | ||
| zap.Any("data", meteringData)) | ||
| } | ||
|
|
Signed-off-by: tangenta <tangenta@126.com>
Signed-off-by: tangenta <tangenta@126.com>
Signed-off-by: tangenta <tangenta@126.com>
|
@tangenta: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Signed-off-by: tangenta <tangenta@126.com>
Signed-off-by: tangenta <tangenta@126.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cfzjywxk, D3Hunter, yudongusa The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
@tangenta: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
@tangenta: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
@tangenta: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
@tangenta: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
@tangenta: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
@tangenta: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
What problem does this PR solve?
Issue Number: ref #61702
Problem Summary:
Since DXF subtasks are executed by system keyspace TiDB scaled out automatically, we need to meter the resource usage for billing. This PR collects four metrics for DXF:
What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.