Repository: prometheus/prometheus
File: tsdb/head_append.go (Go)

Code before:
			// commitFloatHistograms). The latter is fine because we
			// know there is no other histogram (or float histogram)
			// sample for this same series in this same batch
			// (because any such sample would have triggered a new
			// batch).
			switch {
			case series.lastHistogramValue != nil:
				b.histograms = append(b.histograms, record.RefHistogramSample{
					Ref: series.ref,
					T:   s.T,
					H:   &histogram.Histogram{Sum: s.V},
				})
				b.histogramSeries = append(b.histogramSeries, series)
				// This sample was counted as a float but is now a histogram
				acc.floatsAppended--
				acc.histogramsAppended++
				series.Unlock()
				continue
			case series.lastFloatHistogramValue != nil:
				b.floatHistograms = append(b.floatHistograms, record.RefFloatHistogramSample{
					Ref: series.ref,
					T:   s.T,
					FH:  &histogram.FloatHistogram{Sum: s.V},
				})
				b.floatHistogramSeries = append(b.floatHistogramSeries, series)
				// This sample was counted as a float but is now a float histogram
				acc.floatsAppended--
				acc.histogramsAppended++
				series.Unlock()
				continue
			}
		}
		oooSample, _, err := series.appendable(s.T, s.V, a.headMaxt, a.minValidTime, a.oooTimeWindow)
		if err != nil {
			handleAppendableError(err, &acc.floatsAppended, &acc.floatOOORejected, &acc.floatOOBRejected, &acc.floatTooOldRejected)
		}

		switch {
		case err != nil:
			// Do nothing here.
		case oooSample:
			// Sample is OOO and OOO handling is enabled
			// and the delta is within the OOO tolerance.
			var mmapRefs []chunks.ChunkDiskMapperRef
			ok, chunkCreated, mmapRefs = series.insert(s.T, s.V, nil, nil, a.head.chunkDiskMapper, acc.oooCapMax, a.head.logger)
			if chunkCreated {
				r, ok := acc.oooMmapMarkers[series.ref]
				if !ok || r != nil {
					// !ok means there are no markers collected for these samples yet. So we first flush the samples
					// before setting this m-map marker.


Review comment (suggestion):
```suggestion
				// This sample was counted as a float but is now a float histogram.
```

Code after:
			// commitFloatHistograms). The latter is fine because we
			// know there is no other histogram (or float histogram)
			// sample for this same series in this same batch
			// (because any such sample would have triggered a new
			// batch).
			switch {
			case series.lastHistogramValue != nil:
				b.histograms = append(b.histograms, record.RefHistogramSample{
					Ref: series.ref,
					T:   s.T,
					H:   &histogram.Histogram{Sum: s.V},
				})
				b.histogramSeries = append(b.histogramSeries, series)
				// This sample was counted as a float but is now a histogram.
				acc.floatsAppended--
				acc.histogramsAppended++
				series.Unlock()
				continue
			case series.lastFloatHistogramValue != nil:
				b.floatHistograms = append(b.floatHistograms, record.RefFloatHistogramSample{
					Ref: series.ref,
					T:   s.T,
					FH:  &histogram.FloatHistogram{Sum: s.V},
				})
				b.floatHistogramSeries = append(b.floatHistogramSeries, series)
				// This sample was counted as a float but is now a float histogram.
				acc.floatsAppended--
				acc.histogramsAppended++
				series.Unlock()
				continue
			}
		}
		oooSample, _, err := series.appendable(s.T, s.V, a.headMaxt, a.minValidTime, a.oooTimeWindow)
		if err != nil {
			handleAppendableError(err, &acc.floatsAppended, &acc.floatOOORejected, &acc.floatOOBRejected, &acc.floatTooOldRejected)
		}

		switch {
		case err != nil:
			// Do nothing here.
		case oooSample:
			// Sample is OOO and OOO handling is enabled
			// and the delta is within the OOO tolerance.
			var mmapRefs []chunks.ChunkDiskMapperRef
			ok, chunkCreated, mmapRefs = series.insert(s.T, s.V, nil, nil, a.head.chunkDiskMapper, acc.oooCapMax, a.head.logger)
			if chunkCreated {
				r, ok := acc.oooMmapMarkers[series.ref]
				if !ok || r != nil {
					// !ok means there are no markers collected for these samples yet. So we first flush the samples
					// before setting this m-map marker.