|
|
|
@ -305,7 +305,7 @@ func (l *LevelDBMetricPersistence) indexLabelNames(metrics map[model.Fingerprint |
|
|
|
|
value.Member = append(value.Member, fingerprint.ToDTO()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
batch.Put(coding.NewProtocolBuffer(key), coding.NewProtocolBuffer(value)) |
|
|
|
|
batch.Put(coding.NewPBEncoder(key), coding.NewPBEncoder(value)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
err = l.labelNameToFingerprints.Commit(batch) |
|
|
|
@ -377,7 +377,7 @@ func (l *LevelDBMetricPersistence) indexLabelPairs(metrics map[model.Fingerprint |
|
|
|
|
value.Member = append(value.Member, fingerprint.ToDTO()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
batch.Put(coding.NewProtocolBuffer(key), coding.NewProtocolBuffer(value)) |
|
|
|
|
batch.Put(coding.NewPBEncoder(key), coding.NewPBEncoder(value)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
err = l.labelSetToFingerprints.Commit(batch) |
|
|
|
@ -403,8 +403,8 @@ func (l *LevelDBMetricPersistence) indexFingerprints(metrics map[model.Fingerpri |
|
|
|
|
defer batch.Close() |
|
|
|
|
|
|
|
|
|
for fingerprint, metric := range metrics { |
|
|
|
|
key := coding.NewProtocolBuffer(fingerprint.ToDTO()) |
|
|
|
|
value := coding.NewProtocolBuffer(model.MetricToDTO(metric)) |
|
|
|
|
key := coding.NewPBEncoder(fingerprint.ToDTO()) |
|
|
|
|
value := coding.NewPBEncoder(model.MetricToDTO(metric)) |
|
|
|
|
batch.Put(key, value) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -469,7 +469,7 @@ func (l *LevelDBMetricPersistence) indexMetrics(fingerprints map[model.Fingerpri |
|
|
|
|
|
|
|
|
|
// WART: We should probably encode simple fingerprints.
|
|
|
|
|
for _, metric := range absentMetrics { |
|
|
|
|
key := coding.NewProtocolBuffer(model.MetricToDTO(metric)) |
|
|
|
|
key := coding.NewPBEncoder(model.MetricToDTO(metric)) |
|
|
|
|
batch.Put(key, key) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -498,7 +498,7 @@ func (l *LevelDBMetricPersistence) refreshHighWatermarks(groups map[model.Finger |
|
|
|
|
value := &dto.MetricHighWatermark{} |
|
|
|
|
raw := []byte{} |
|
|
|
|
newestSampleTimestamp := samples[len(samples)-1].Timestamp |
|
|
|
|
keyEncoded := coding.NewProtocolBuffer(key) |
|
|
|
|
keyEncoded := coding.NewPBEncoder(key) |
|
|
|
|
|
|
|
|
|
key.Signature = proto.String(fingerprint.ToRowKey()) |
|
|
|
|
raw, err = l.MetricHighWatermarks.Get(keyEncoded) |
|
|
|
@ -517,7 +517,7 @@ func (l *LevelDBMetricPersistence) refreshHighWatermarks(groups map[model.Finger |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
value.Timestamp = proto.Int64(newestSampleTimestamp.Unix()) |
|
|
|
|
batch.Put(keyEncoded, coding.NewProtocolBuffer(value)) |
|
|
|
|
batch.Put(keyEncoded, coding.NewPBEncoder(value)) |
|
|
|
|
mutationCount++ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -592,7 +592,7 @@ func (l *LevelDBMetricPersistence) AppendSamples(samples model.Samples) (err err |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
samplesBatch.Put(coding.NewProtocolBuffer(key), coding.NewProtocolBuffer(value)) |
|
|
|
|
samplesBatch.Put(coding.NewPBEncoder(key), coding.NewPBEncoder(value)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -665,7 +665,7 @@ func (l *LevelDBMetricPersistence) hasIndexMetric(dto *dto.Metric) (value bool, |
|
|
|
|
recordOutcome(duration, err, map[string]string{operation: hasIndexMetric, result: success}, map[string]string{operation: hasIndexMetric, result: failure}) |
|
|
|
|
}(time.Now()) |
|
|
|
|
|
|
|
|
|
dtoKey := coding.NewProtocolBuffer(dto) |
|
|
|
|
dtoKey := coding.NewPBEncoder(dto) |
|
|
|
|
value, err = l.metricMembershipIndex.Has(dtoKey) |
|
|
|
|
|
|
|
|
|
return |
|
|
|
@ -678,7 +678,7 @@ func (l *LevelDBMetricPersistence) HasLabelPair(dto *dto.LabelPair) (value bool, |
|
|
|
|
recordOutcome(duration, err, map[string]string{operation: hasLabelPair, result: success}, map[string]string{operation: hasLabelPair, result: failure}) |
|
|
|
|
}(time.Now()) |
|
|
|
|
|
|
|
|
|
dtoKey := coding.NewProtocolBuffer(dto) |
|
|
|
|
dtoKey := coding.NewPBEncoder(dto) |
|
|
|
|
value, err = l.labelSetToFingerprints.Has(dtoKey) |
|
|
|
|
|
|
|
|
|
return |
|
|
|
@ -691,7 +691,7 @@ func (l *LevelDBMetricPersistence) HasLabelName(dto *dto.LabelName) (value bool, |
|
|
|
|
recordOutcome(duration, err, map[string]string{operation: hasLabelName, result: success}, map[string]string{operation: hasLabelName, result: failure}) |
|
|
|
|
}(time.Now()) |
|
|
|
|
|
|
|
|
|
dtoKey := coding.NewProtocolBuffer(dto) |
|
|
|
|
dtoKey := coding.NewPBEncoder(dto) |
|
|
|
|
value, err = l.labelNameToFingerprints.Has(dtoKey) |
|
|
|
|
|
|
|
|
|
return |
|
|
|
@ -707,7 +707,7 @@ func (l *LevelDBMetricPersistence) GetFingerprintsForLabelSet(labelSet model.Lab |
|
|
|
|
sets := []utility.Set{} |
|
|
|
|
|
|
|
|
|
for _, labelSetDTO := range model.LabelSetToDTOs(&labelSet) { |
|
|
|
|
f, err := l.labelSetToFingerprints.Get(coding.NewProtocolBuffer(labelSetDTO)) |
|
|
|
|
f, err := l.labelSetToFingerprints.Get(coding.NewPBEncoder(labelSetDTO)) |
|
|
|
|
if err != nil { |
|
|
|
|
return fps, err |
|
|
|
|
} |
|
|
|
@ -752,7 +752,7 @@ func (l *LevelDBMetricPersistence) GetFingerprintsForLabelName(labelName model.L |
|
|
|
|
recordOutcome(duration, err, map[string]string{operation: getFingerprintsForLabelName, result: success}, map[string]string{operation: getFingerprintsForLabelName, result: failure}) |
|
|
|
|
}(time.Now()) |
|
|
|
|
|
|
|
|
|
raw, err := l.labelNameToFingerprints.Get(coding.NewProtocolBuffer(model.LabelNameToDTO(&labelName))) |
|
|
|
|
raw, err := l.labelNameToFingerprints.Get(coding.NewPBEncoder(model.LabelNameToDTO(&labelName))) |
|
|
|
|
if err != nil { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
@ -779,7 +779,7 @@ func (l *LevelDBMetricPersistence) GetMetricForFingerprint(f model.Fingerprint) |
|
|
|
|
recordOutcome(duration, err, map[string]string{operation: getMetricForFingerprint, result: success}, map[string]string{operation: getMetricForFingerprint, result: failure}) |
|
|
|
|
}(time.Now()) |
|
|
|
|
|
|
|
|
|
raw, err := l.fingerprintToMetrics.Get(coding.NewProtocolBuffer(model.FingerprintToDTO(f))) |
|
|
|
|
raw, err := l.fingerprintToMetrics.Get(coding.NewPBEncoder(model.FingerprintToDTO(f))) |
|
|
|
|
if err != nil { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|