Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .run/api.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration default="false" name="api" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="statshouse" />
<working_directory value="$PROJECT_DIR$/localdebug" />
<parameters value="--local-mode --insecure-mode --access-log --clickhouse-v2-addrs=localhost:9000 --verbose --listen-rpc-addr=localhost:10889 --listen-addr localhost:10888 --static-dir ../statshouse-ui/build/ --metadata-addr &quot;127.0.0.1:2442&quot; --available-shards &quot;1&quot; --cache-dir=cache/api --announcement=Hello" />
<parameters value="--local-mode --insecure-mode --access-log --clickhouse-v2-addrs=localhost:9000 --verbose --listen-rpc-addr=localhost:10889 --listen-addr localhost:10888 --static-dir ../statshouse-ui/build/ --metadata-addr &quot;127.0.0.1:2442&quot; --available-shards &quot;1&quot; --cache-dir=cache/api --announcement=Крокозяблик" />
<kind value="PACKAGE" />
<package value="github.com/VKCOM/statshouse/cmd/statshouse-api" />
<directory value="$PROJECT_DIR$/cmd/statshouse-api" />
Expand Down
6 changes: 3 additions & 3 deletions internal/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ func DefaultConfig() Config {
HistoricWindow: 24 * 3600,
MaxHistoricDiskSize: 20 << 30, // enough for default SampleBudget per MaxHistoricWindow
SampleBudgets: true,
SampleNamespaces: false,
SampleGroups: false,
SampleKeys: false,
SampleNamespaces: true,
SampleGroups: true,
SampleKeys: true,
StringTopCapacity: 100,
StringTopCountSend: 20,
LivenessResponsesWindowLength: 5,
Expand Down
17 changes: 1 addition & 16 deletions internal/aggregator/aggregator_insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ func (a *Aggregator) rowDataMarshalAppendPositions(buckets []*aggregatorBucket,
}

usedTimestamps := map[uint32]struct{}{}
usedBufferTimestamps := map[uint32]struct{}{}
appendCtx := appendContext{
metricCache: makeMetricCache(a.metricStorage),
unknownTags: map[string]createMappingExtra{},
Expand All @@ -359,15 +358,7 @@ func (a *Aggregator) rowDataMarshalAppendPositions(buckets []*aggregatorBucket,
insertItem := func(item *data_model.MultiItem, sf float64, bucketTs uint32) { // lambda is convenient here
is := insertSize{}

bufferedInsert := false
if configR.BufferedInsertAgeSec > 0 && item.Key.Timestamp+uint32(configR.BufferedInsertAgeSec) < recentTs {
bufferedInsert = true
}
if bufferedInsert {
usedBufferTimestamps[item.Key.Timestamp] = struct{}{}
} else {
usedTimestamps[item.Key.Timestamp] = struct{}{}
}
usedTimestamps[item.Key.Timestamp] = struct{}{}

resPos := len(res)
if !item.Tail.Empty() { // only tail
Expand Down Expand Up @@ -514,12 +505,6 @@ func (a *Aggregator) rowDataMarshalAppendPositions(buckets []*aggregatorBucket,
key = data_model.Key{Timestamp: t, Metric: format.BuiltinMetricIDContributorsLogRev, Tags: [format.MaxTags]int32{0, int32(insertTimeUnix)}}
res = appendSimpleValueStat(rnd, res, &key, float64(insertTimeUnix)-float64(t), 1, a.aggregatorHostTag.I, appendCtx)
}
for t := range usedBufferTimestamps {
key := data_model.Key{Timestamp: insertTimeUnix, Metric: format.BuiltinMetricIDContributorsLog, Tags: [format.MaxTags]int32{0, int32(t)}}
res = appendSimpleValueStat(rnd, res, &key, float64(insertTimeUnix)-float64(t), 1, a.aggregatorHostTag.I, appendCtx)
key = data_model.Key{Timestamp: t, Metric: format.BuiltinMetricIDContributorsLogRev, Tags: [format.MaxTags]int32{0, int32(insertTimeUnix)}}
res = appendSimpleValueStat(rnd, res, &key, float64(insertTimeUnix)-float64(t), 1, a.aggregatorHostTag.I, appendCtx)
}
a.addUnknownTags(appendCtx.unknownTags, recentTs, rnd, a.aggregatorHostTag, data_model.AgentEnvRouteArch{}) // no agent info here
return res, sampler.SamplerBuffers, stats, time.Since(startTime)
}
Expand Down
2 changes: 0 additions & 2 deletions internal/aggregator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ type ConfigAggregatorRemote struct {
V3InsertSettings string
MappingCacheSize int64
MappingCacheTTL int
BufferedInsertAgeSec int // age in seconds of data that should be sent to buffer table
MigrationTimeRange string // format: "{begin timestamp}-{end timestamp}"
MigrationV3DisabledShards map[int32]struct{}
MigrationDelaySec int // delay in seconds between migration steps
Expand Down Expand Up @@ -196,7 +195,6 @@ func (c *ConfigAggregatorRemote) Bind(f *flag.FlagSet, d ConfigAggregatorRemote,
f.StringVar(&c.V3InsertSettings, "v3-insert-settings", d.V3InsertSettings, "Settings when inserting into v3 table")
f.Int64Var(&c.MappingCacheSize, "mappings-cache-size-agg", d.MappingCacheSize, "Mappings cache size both in memory and on disk for aggregator.")
f.IntVar(&c.MappingCacheTTL, "mappings-cache-ttl-agg", d.MappingCacheTTL, "Mappings cache item TTL since last used for aggregator.")
f.IntVar(&c.BufferedInsertAgeSec, "buffered-insert-age-sec", d.BufferedInsertAgeSec, "Age in seconds of data that should be inserted via buffer table")
f.StringVar(&c.MigrationTimeRange, "migration", d.MigrationTimeRange, "Migration time range: \"{start timestamp}-{end timestamp}\" (start > end because of backwards migration)")
f.Func("migration-v3-disabled-shards", "List of disabled shards for migration v3", c.setMigrationV3DisabledShards)
f.IntVar(&c.MigrationDelaySec, "migration-delay-sec", d.MigrationDelaySec, "Delay in seconds between migration steps")
Expand Down
2 changes: 2 additions & 0 deletions internal/api/httputil.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package api

import (
"context"
"encoding/base64"
"encoding/csv"
"errors"
"fmt"
Expand Down Expand Up @@ -167,6 +168,7 @@ func respondJSON(h *httpRequestHandler, resp interface{}, cache time.Duration, c
}
if h.announcement != "" {
w.Header().Set("X-Statshouse-Announcment", h.announcement)
w.Header().Set("X-Statshouse-Announcement", base64.StdEncoding.EncodeToString([]byte(h.announcement)))
}
start := time.Now()
var jw jwriter.Writer
Expand Down
8 changes: 2 additions & 6 deletions internal/loadgen/loadgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,8 @@ func RunEnableNewPipeline() {
ctx := makeInterruptibleContext()
c := api.NewClient("http://127.0.0.1:10888", "loadgen")
ensureMetricWithDescription(ctx, c, format.StatshouseAPIRemoteConfig, ``)
ensureMetricWithDescription(ctx, c, format.StatshouseAgentRemoteConfigMetric, `
-conveyor-v3-staging=production,staging1,staging2,development
`)
ensureMetricWithDescription(ctx, c, format.StatshouseAggregatorRemoteConfigMetric, `
-map-string-top=true
`)
ensureMetricWithDescription(ctx, c, format.StatshouseAgentRemoteConfigMetric, ``)
ensureMetricWithDescription(ctx, c, format.StatshouseAggregatorRemoteConfigMetric, ``)
ensureMetricWithDescription(ctx, c, format.StatshouseJournalDump, `
`)
}
Expand Down
2 changes: 1 addition & 1 deletion localdebug/run-api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mkdir -p cache/api
--clickhouse-v2-addrs=localhost:9000,localhost:9000,localhost:9000 \
--listen-rpc-addr=localhost:10889 \
--verbose --listen-addr localhost:10888 --static-dir ../statshouse-ui/build/ \
--metadata-addr "127.0.0.1:2442" --available-shards "1" --cache-dir=cache/api --announcement=Hello \
--metadata-addr "127.0.0.1:2442" --available-shards "1" --cache-dir=cache/api --announcement=Крокозяблик \
"$@"

# --rqlite-addrs "127.0.0.1:4001"
Expand Down
Loading