MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / SetMessageTrend

Method SetMessageTrend

service/monitor/iml.go:218–228  ·  view source on GitHub ↗
(ctx context.Context, partitionId string, start, end time.Time, wheres []MonWhereItem, val *MonMessageTrend)

Source from the content-addressed store, hash-verified

216}
217
218func (i *imlMonitorStatisticsCacheService) SetMessageTrend(ctx context.Context, partitionId string, start, end time.Time, wheres []MonWhereItem, val *MonMessageTrend) error {
219 key := fmt.Sprintf("monitor:message_trend:%s:%d_%d:%s", partitionId, start.Unix(), end.Unix(), formatWhereKey(wheres))
220
221 bytes, err := json.Marshal(val)
222 if err != nil {
223 log.Errorf("SetMessageTrend json.Marshal key=%s val=%v err=%s", key, val, err.Error())
224 return err
225 }
226
227 return i.commonCache.Set(ctx, key, bytes, 5*time.Minute)
228}
229
230func formatWhereKey(wheres []MonWhereItem) string {
231

Callers

nothing calls this directly

Calls 3

formatWhereKeyFunction · 0.85
MarshalMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected