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

Method GetMessageTrend

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

Source from the content-addressed store, hash-verified

197}
198
199func (i *imlMonitorStatisticsCacheService) GetMessageTrend(ctx context.Context, partitionId string, start, end time.Time, wheres []MonWhereItem) (*MonMessageTrend, error) {
200 key := fmt.Sprintf("monitor:message_trend:%s:%d_%d:%s", partitionId, start.Unix(), end.Unix(), formatWhereKey(wheres))
201
202 bytes, err := i.commonCache.Get(ctx, key)
203 if err != nil {
204 log.Errorf("GetMessageTrend cache.Get key=%s err=%s", key, err.Error())
205 return nil, err
206 }
207
208 val := new(MonMessageTrend)
209
210 if err = json.Unmarshal(bytes, val); err != nil {
211 log.Errorf("GetMessageTrend json.Unmarshal key=%s bytes=%v err=%s", key, bytes, err.Error())
212 return nil, err
213 }
214
215 return val, nil
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))

Callers

nothing calls this directly

Calls 2

formatWhereKeyFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected