source_file
comment "// Copyright The Prometheus Authors"
comment "// Licensed under the Apache License, Version 2.0 (the \"Lice"...
comment "// you may not use this file except in compliance with the L"...
comment "// You may obtain a copy of the License at"
comment "//"
comment "// http://www.apache.org/licenses/LICENSE-2.0"
comment "//"
comment "// Unless required by applicable law or agreed to in writing"...
comment "// distributed under the License is distributed on an \"AS IS"...
comment "// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expr"...
comment "// See the License for the specific language governing permi"...
comment "// limitations under the License."
package_clause
package "package"
package_identifier "tsdb"
import_declaration (+217 nodes collapsed)
comment "// newTestHeadDefaultOptions returns the HeadOptions that sh"...
function_declaration (+104 nodes collapsed)
function_declaration (+66 nodes collapsed)
function_declaration (+256 nodes collapsed)
function_declaration (+127 nodes collapsed)
function_declaration (+353 nodes collapsed)
function_declaration (+596 nodes collapsed)
function_declaration (+2444 nodes collapsed)
comment "// BenchmarkLoadRealWLs will be skipped unless the BENCHMARK"...
comment "// BENCHMARK_LOAD_REAL_WLS_DIR should be the folder where `w"...
comment "//"
comment "// Using an absolute path for BENCHMARK_LOAD_REAL_WLS_DIR is"...
comment "//"
comment "// Because WLs loading may alter BENCHMARK_LOAD_REAL_WLS_DIR"...
comment "// a copy of BENCHMARK_LOAD_REAL_WLS_DIR is made for each it"...
comment "// Make sure there is sufficient disk space for that."
function_declaration (+381 nodes collapsed)
comment "// TestHead_InitAppenderRace_ErrOutOfBounds tests against in"...
comment "// See: https://github.com/prometheus/prometheus/pull/17963"
function_declaration (+357 nodes collapsed)
comment "// TestHead_HighConcurrencyReadAndWrite generates 1000 serie"...
comment "// this means in total it generates 4000 chunks because with"...
comment "// While appending the samples to the head it concurrently q"...
comment "// returned results are correct."
function_declaration (+1709 nodes collapsed)
function_declaration (+2155 nodes collapsed)
function_declaration (+908 nodes collapsed)
function_declaration (+3490 nodes collapsed)
function_declaration (+463 nodes collapsed)
function_declaration (+492 nodes collapsed)
function_declaration (+382 nodes collapsed)
function_declaration (+523 nodes collapsed)
function_declaration (+82 nodes collapsed)
comment "// BenchmarkHead_Truncate is quite heavy, so consider runnin"...
comment "// -benchtime=10x or similar to get more stable and comparab"...
function_declaration (+802 nodes collapsed)
function_declaration (+1494 nodes collapsed)
comment "// Validate various behaviors brought on by firstChunkID acc"...
comment "// garbage collected chunks."
function_declaration (+613 nodes collapsed)
function_declaration (+1500 nodes collapsed)
function_declaration (+422 nodes collapsed)
function_declaration (+1882 nodes collapsed)
function_declaration (+797 nodes collapsed)
function_declaration (+506 nodes collapsed)
function_declaration (+2083 nodes collapsed)
function_declaration (+127 nodes collapsed)
function_declaration (+132 nodes collapsed)
function_declaration (+396 nodes collapsed)
comment "// TestMemSeries_append tests float appending with various s"...
function_declaration (+343 nodes collapsed)
function_declaration (+840 nodes collapsed)
comment "// TestMemSeries_appendHistogram tests histogram appending w"...
function_declaration (+343 nodes collapsed)
function_declaration (+935 nodes collapsed)
function_declaration (+554 nodes collapsed)
function_declaration (+673 nodes collapsed)
function_declaration (+713 nodes collapsed)
function_declaration (+352 nodes collapsed)
function_declaration (+394 nodes collapsed)
function_declaration (+346 nodes collapsed)
function_declaration (+296 nodes collapsed)
comment "// TestWalRepair_DecodingError ensures that a repair is run "...
comment "// when decoding a record."
function_declaration (+1090 nodes collapsed)
comment "// TestWblRepair_DecodingError ensures that a repair is run "...
comment "// when decoding a record."
function_declaration (+874 nodes collapsed)
function_declaration (+875 nodes collapsed)
function_declaration (+361 nodes collapsed)
function_declaration (+278 nodes collapsed)
function_declaration (+2291 nodes collapsed)
function_declaration (+483 nodes collapsed)
function_declaration (+568 nodes collapsed)
function_declaration (+223 nodes collapsed)
function_declaration (+43 nodes collapsed)
function_declaration (+229 nodes collapsed)
function_declaration (+95 nodes collapsed)
function_declaration (+113 nodes collapsed)
function_declaration (+1359 nodes collapsed)
function_declaration (+397 nodes collapsed)
function_declaration (+753 nodes collapsed)
function_declaration (+1048 nodes collapsed)
function_declaration (+863 nodes collapsed)
function_declaration (+640 nodes collapsed)
function_declaration (+552 nodes collapsed)
function_declaration (+476 nodes collapsed)
function_declaration (+235 nodes collapsed)
function_declaration (+378 nodes collapsed)
function_declaration (+788 nodes collapsed)
comment "// Tests https://github.com/prometheus/prometheus/issues/822"...
function_declaration (+660 nodes collapsed)
comment "// Tests https://github.com/prometheus/prometheus/issues/907"...
function_declaration (+506 nodes collapsed)
function_declaration (+496 nodes collapsed)
function_declaration (+774 nodes collapsed)
function_declaration (+362 nodes collapsed)
function_declaration (+412 nodes collapsed)
function_declaration (+875 nodes collapsed)
function_declaration (+1357 nodes collapsed)
function_declaration (+2316 nodes collapsed)
function_declaration (+3378 nodes collapsed)
function_declaration (+1515 nodes collapsed)
function_declaration (+584 nodes collapsed)
function_declaration (+98 nodes collapsed)
function_declaration (+2237 nodes collapsed)
function_declaration (+1187 nodes collapsed)
function_declaration (+1458 nodes collapsed)
function_declaration (+1635 nodes collapsed)
comment "// Tests https://github.com/prometheus/prometheus/issues/972"...
function_declaration (+889 nodes collapsed)
function_declaration (+434 nodes collapsed)
comment "// TestWBLReplay checks the replay at a low level."
function_declaration (+69 nodes collapsed)
function_declaration (+1089 nodes collapsed)
comment "// TestOOOMmapReplay checks the replay at a low level."
function_declaration (+69 nodes collapsed)
function_declaration (+1060 nodes collapsed)
function_declaration (+801 nodes collapsed)
const_declaration
const "const"
( "("
const_spec
identifier "UnsupportedMask"
= "="
expression_list
int_literal "0b10000000"
const_spec
identifier "EncUnsupportedXOR"
= "="
expression_list
binary_expression
selector_expression
identifier "chunkenc"
. "."
field_identifier "EncXOR"
| "|"
identifier "UnsupportedMask"
) ")"
comment "// unsupportedChunk holds a XORChunk and overrides the Encod"...
type_declaration
type "type"
type_spec
type_identifier "unsupportedChunk"
struct_type
struct "struct"
field_declaration_list
{ "{"
field_declaration
* "*"
qualified_type
package_identifier "chunkenc"
. "."
type_identifier "XORChunk"
} "}"
function_declaration (+32 nodes collapsed)
method_declaration (+25 nodes collapsed)
comment "// Tests https://github.com/prometheus/prometheus/issues/102"...
function_declaration (+716 nodes collapsed)
comment "// Tests https://github.com/prometheus/prometheus/issues/102"...
function_declaration (+946 nodes collapsed)
function_declaration (+72 nodes collapsed)
function_declaration (+1017 nodes collapsed)
function_declaration (+82 nodes collapsed)
function_declaration (+642 nodes collapsed)
function_declaration (+1114 nodes collapsed)
function_declaration (+1114 nodes collapsed)
function_declaration (+736 nodes collapsed)
comment "// TODO(bwplotka): Bad benchmark (no b.Loop/b.N), fix or rem"...
function_declaration (+226 nodes collapsed)
function_declaration (+1463 nodes collapsed)
comment "// TestHeadDetectsDuplicateSampleAtSizeLimit tests a regress"...
comment "// is appended to the head, right when the head chunk is at "...
comment "// The test adds all samples as duplicate, thus expecting th"...
comment "// exactly half of the samples."
function_declaration (+427 nodes collapsed)
function_declaration (+703 nodes collapsed)
comment "// TestHeadCompactionWhileAppendAndCommitExemplar simulates "...
comment "// a series is removed from the head while an exemplar is be"...
comment "// This can happen in theory by compacting the head at the r"...
comment "// a series being idle."
comment "// The test cheats a little bit by not appending a sample wi"...
comment "// If you also add a sample and run Truncate in a concurrent"...
comment "// the test around a million(!) times, you can get"
comment "// `unknown HeadSeriesRef when trying to add exemplar: 1` er"...
comment "// It is likely that running the test for much longer and wi"...
comment "// would trigger the"
comment "// `signal SIGSEGV: segmentation violation code=0x1 addr=0x2"...
comment "// panic, that we have seen in the wild once."
comment "//"
comment "// TODO(bwplotka): This no longer can happen in AppenderV2, "...
function_declaration (+219 nodes collapsed)
function_declaration (+238 nodes collapsed)
comment "// stripeSeriesWithCollidingSeries returns a stripeSeries wi"...
function_declaration (+233 nodes collapsed)
function_declaration (+116 nodes collapsed)
function_declaration (+124 nodes collapsed)
function_declaration (+378 nodes collapsed)
function_declaration (+315 nodes collapsed)
function_declaration (+2868 nodes collapsed)
function_declaration (+689 nodes collapsed)
function_declaration (+63 nodes collapsed)
type_declaration (+21 nodes collapsed)
method_declaration (+27 nodes collapsed)
method_declaration (+35 nodes collapsed)
method_declaration (+55 nodes collapsed)
comment "// Regression test for data race https://github.com/promethe"...
function_declaration (+301 nodes collapsed)
function_declaration (+286 nodes collapsed)
function_declaration (+1554 nodes collapsed)
comment "// TestHistogramStalenessConversionMetrics verifies that sta"...
comment "// increments the right appender metrics for both histogram "...
function_declaration (+902 nodes collapsed)
comment "// TestHeadAppender_WALEncoder_EnableSTStorage verifies that"...
comment "// is true the WAL encoder writes SamplesV2 records, and whe"...
comment "// plain Samples (V1) records. The bug was that log() always"...
comment "// record.Encoder (EnableSTStorage=false), ignoring the head"...
function_declaration (+552 nodes collapsed)
comment "// TestHeadAppender_WBLEncoder_EnableSTStorage verifies that"...
comment "// is true the WBL encoder writes SamplesV2 records for out-"...
comment "// when false it writes plain Samples (V1) records. The bug "...
comment "// always created record.Encoder{EnableSTStorage: false}, ig"...
function_declaration (+873 nodes collapsed)
comment "// TestHeadAppender_STStorage_Disabled verifies that when En"...
comment "// start timestamps are NOT stored in chunks (AtST returns 0"...
function_declaration (+655 nodes collapsed)
comment "// TestHeadAppender_STStorage_WALReplay verifies that ST val"...
comment "// across a WAL replay when EnableSTStorage is true. The bug"...
comment "// hardcoded EnableSTStorage=false in the WAL encoder, so ST"...
comment "// as V1 records (without ST) and lost on replay."
function_declaration (+562 nodes collapsed)
comment "// TestHeadAppender_STStorage_WBLReplay verifies that ST val"...
comment "// across a WBL replay for out-of-order samples when EnableS"...
comment "// The bug was that collectOOORecords() hardcoded EnableSTSt"...
comment "// WBL encoder (acc.enc), so OOO sample ST values were writt"...
comment "// (without ST) and lost on WBL replay."
function_declaration (+1075 nodes collapsed)
comment "// TestHeadAppender_STStorage_ChunkEncoding verifies that th"...
comment "// is used based on EnableSTStorage setting."
function_declaration
func "func"
identifier "TestHeadAppender_STStorage_ChunkEncoding"
parameter_list
( "("
parameter_declaration
identifier "t"
pointer_type
* "*"
qualified_type
package_identifier "testing"
. "."
type_identifier "T"
) ")"
block
{ "{"
statement_list
short_var_declaration (+76 nodes collapsed)
for_statement
for "for"
range_clause
expression_list
identifier "_"
, ","
identifier "enableST"
:= ":="
range "range"
composite_literal
slice_type
[ "["
] "]"
type_identifier "bool"
literal_value
{ "{"
literal_element
false "false"
, ","
literal_element
true "true"
} "}"
block
{ "{"
statement_list
expression_statement
call_expression
selector_expression
identifier "t"
. "."
field_identifier "Run"
argument_list
( "("
call_expression
selector_expression
identifier "fmt"
. "."
field_identifier "Sprintf"
argument_list
( "("
interpreted_string_literal
" "\""
interpreted_string_literal_content "EnableSTStorage=%t"
" "\""
, ","
identifier "enableST"
) ")"
, ","
func_literal
func "func"
parameter_list
( "("
parameter_declaration
identifier "t"
pointer_type
* "*"
qualified_type
package_identifier "testing"
. "."
type_identifier "T"
) ")"
block
{ "{"
statement_list
short_var_declaration
expression_list
identifier "opts"
:= ":="
expression_list
call_expression
identifier "newTestHeadDefaultOptions"
argument_list
( "("
identifier "DefaultBlockDuration"
, ","
false "false"
) ")"
expression_statement
call_expression
selector_expression
selector_expression
identifier "opts"
. "."
field_identifier "EnableSTStorage"
. "."
field_identifier "Store"
argument_list
( "("
identifier "enableST"
) ")"
short_var_declaration
expression_list
identifier "h"
, ","
identifier "_"
:= ":="
expression_list
call_expression
identifier "newTestHeadWithOptions"
argument_list
( "("
identifier "t"
, ","
selector_expression
identifier "compression"
. "."
field_identifier "None"
, ","
identifier "opts"
) ")"
short_var_declaration (+22 nodes collapsed)
short_var_declaration (+21 nodes collapsed)
for_statement (+94 nodes collapsed)
expression_statement
call_expression
selector_expression
identifier "require"
. "."
field_identifier "NoError"
argument_list
( "("
identifier "t"
, ","
call_expression
selector_expression
identifier "a"
. "."
field_identifier "Commit"
argument_list
( "("
) ")"
) ")"
short_var_declaration
expression_list
identifier "ctx"
:= ":="
expression_list
call_expression
selector_expression
identifier "context"
. "."
field_identifier "Background"
argument_list
( "("
) ")"
short_var_declaration
expression_list
identifier "idxReader"
, ","
identifier "err"
:= ":="
expression_list
call_expression
selector_expression
identifier "h"
. "."
field_identifier "Index"
argument_list
( "("
) ")"
expression_statement
call_expression
selector_expression
identifier "require"
. "."
field_identifier "NoError"
argument_list
( "("
identifier "t"
, ","
identifier "err"
) ")"
defer_statement
defer "defer"
call_expression
selector_expression
identifier "idxReader"
. "."
field_identifier "Close"
argument_list
( "("
) ")"
short_var_declaration
expression_list
identifier "chkReader"
, ","
identifier "err"
:= ":="
expression_list
call_expression
selector_expression
identifier "h"
. "."
field_identifier "Chunks"
argument_list
( "("
) ")"
expression_statement
call_expression
selector_expression
identifier "require"
. "."
field_identifier "NoError"
argument_list
( "("
identifier "t"
, ","
identifier "err"
) ")"
defer_statement
defer "defer"
call_expression
selector_expression
identifier "chkReader"
. "."
field_identifier "Close"
argument_list
( "("
) ")"
short_var_declaration (+26 nodes collapsed)
expression_statement
call_expression
selector_expression
identifier "require"
. "."
field_identifier "NoError"
argument_list
( "("
identifier "t"
, ","
identifier "err"
) ")"
var_declaration
var "var"
var_spec
identifier "lblBuilder"
qualified_type
package_identifier "labels"
. "."
type_identifier "ScratchBuilder"
expression_statement
call_expression
selector_expression
identifier "require"
. "."
field_identifier "True"
argument_list
( "("
identifier "t"
, ","
call_expression
selector_expression
identifier "p"
. "."
field_identifier "Next"
argument_list
( "("
) ")"
) ")"
short_var_declaration
expression_list
identifier "sRef"
:= ":="
expression_list
call_expression
selector_expression
identifier "p"
. "."
field_identifier "At"
argument_list
( "("
) ")"
var_declaration
var "var"
var_spec
identifier "chkMetas"
slice_type
[ "["
] "]"
qualified_type
package_identifier "chunks"
. "."
type_identifier "Meta"
expression_statement (+28 nodes collapsed)
expression_statement
call_expression
selector_expression
identifier "require"
. "."
field_identifier "NotEmpty"
argument_list
( "("
identifier "t"
, ","
identifier "chkMetas"
) ")"
for_statement
for "for"
range_clause
expression_list
identifier "_"
, ","
identifier "meta"
:= ":="
range "range"
identifier "chkMetas"
block
{ "{"
statement_list
short_var_declaration
expression_list
identifier "chk"
, ","
identifier "iterable"
, ","
identifier "err"
:= ":="
expression_list
call_expression
selector_expression
identifier "chkReader"
. "."
field_identifier "ChunkOrIterable"
argument_list
( "("
identifier "meta"
) ")"
expression_statement
call_expression
selector_expression
identifier "require"
. "."
field_identifier "NoError"
argument_list
( "("
identifier "t"
, ","
identifier "err"
) ")"
expression_statement
call_expression
selector_expression
identifier "require"
. "."
field_identifier "Nil"
argument_list
( "("
identifier "t"
, ","
identifier "iterable"
) ")"
short_var_declaration
expression_list
identifier "encoding"
:= ":="
expression_list
call_expression
selector_expression
identifier "chk"
. "."
field_identifier "Encoding"
argument_list
( "("
) ")"
if_statement
if "if"
identifier "enableST"
block
{ "{"
statement_list
expression_statement
call_expression
selector_expression
identifier "require"
. "."
field_identifier "Equal"
argument_list
( "("
identifier "t"
, ","
selector_expression
identifier "chunkenc"
. "."
field_identifier "EncXOROptST"
, ","
identifier "encoding"
, ","
interpreted_string_literal
" "\""
interpreted_string_literal_content "Expected ST-capable encoding when EnableSTStorage is true"
" "\""
) ")"
} "}"
else "else"
block (+26 nodes collapsed)
} "}"
} "}"
) ")"
} "}"
} "}"
comment "// TestWALReplayRaceWithStaleSeriesCompaction verifies that "...
comment "// hash shard (not only the ref shard) when deleting from th"...
comment "// The race only occurs when Prometheus restarts after havin"...
comment "// deleteSeriesByID is not used otherwise."
function_declaration (+841 nodes collapsed)