-
Notifications
You must be signed in to change notification settings - Fork 6
compatible with slime metric reconfiguration #12
Conversation
go.mod
Outdated
slime.io/slime/framework => github.com/slime-io/slime/framework v0.3.1 | ||
//slime.io/slime/framework => ../slime/framework | ||
//slime.io/slime/framework => github.com/slime-io/slime/framework v0.3.1 | ||
slime.io/slime/framework => ../slime/framework |
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 back to a specific version
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.
will change after slime pr finished
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.
change to v0.3.3
fd71e6e
to
a0b2470
Compare
//r.interestMeta.Pop(req.NamespacedName.String()) | ||
delete(r.interestMeta, req.NamespacedName.String()) | ||
for k, v := range r.interestMeta { | ||
r.InterestMetaCopy[k] = v |
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.
wrong usage
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.
changed according to concept of copy on write
r.source.WatchAdd(types.NamespacedName{Name: instance.Name, Namespace: instance.Namespace}) | ||
r.interestMeta[req.NamespacedName.String()] = true | ||
for k, v := range r.interestMeta { | ||
r.InterestMetaCopy[k] = v |
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.
wrong use
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.
m, mc map[string]string
func update() {
// ...
mut.Lock()
delete(m, "key1")
newMc := map[string]string{}
for k, v := range m {
newMc[key] = value
}
mc = newMc
mut.Unlock()
}
func GetM() map[string]string {
mut.RLock()
return mc
defer mut.RUnlock()
}
// call back function for ticker producer | ||
func (r *ServicefenceReconciler) handleTickerEvent(event trigger.TickerEvent) metric.QueryMap { | ||
r.reconcileLock.RLock() | ||
defer r.reconcileLock.RUnlock() |
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.
r.reconcileLock.RLock()
instMeta := r.interestMetaCopy
r.reconcileLock.RUnlock()
for ... {}
qm := make(map[string][]metric.Handler) | ||
var hs []metric.Handler | ||
for name, pHandler := range r.env.Config.Metric.Prometheus.Handlers { | ||
query := strings.ReplaceAll(pHandler.Query, "$namespace", event.NN.Namespace) |
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.
we have two copies of this code block nearby
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 by function generateHandler
related to slime-io/slime#110