diff --git a/CHANGELOG.md b/CHANGELOG.md index c126b1fc0b5..35b583a758d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master / unreleased +* [FEATURE] Ingester: Add active series to all_user_stats page. #4972 + ## 1.14.0 in progress **This release removes support for chunks storage. See below for more.** diff --git a/pkg/distributor/distributor.go b/pkg/distributor/distributor.go index 45320683a35..698430def65 100644 --- a/pkg/distributor/distributor.go +++ b/pkg/distributor/distributor.go @@ -1189,10 +1189,13 @@ func (d *Distributor) UserStats(ctx context.Context) (*UserStats, error) { totalStats.APIIngestionRate += r.ApiIngestionRate totalStats.RuleIngestionRate += r.RuleIngestionRate totalStats.NumSeries += r.NumSeries + totalStats.ActiveSeries += r.ActiveSeries } - totalStats.IngestionRate /= float64(d.ingestersRing.ReplicationFactor()) - totalStats.NumSeries /= uint64(d.ingestersRing.ReplicationFactor()) + factor := d.ingestersRing.ReplicationFactor() + totalStats.IngestionRate /= float64(factor) + totalStats.NumSeries /= uint64(factor) + totalStats.ActiveSeries /= uint64(factor) return totalStats, nil } @@ -1231,6 +1234,7 @@ func (d *Distributor) AllUserStats(ctx context.Context) ([]UserIDStats, error) { s.APIIngestionRate += u.Data.ApiIngestionRate s.RuleIngestionRate += u.Data.RuleIngestionRate s.NumSeries += u.Data.NumSeries + s.ActiveSeries += u.Data.ActiveSeries perUserTotals[u.UserId] = s } } @@ -1245,6 +1249,7 @@ func (d *Distributor) AllUserStats(ctx context.Context) ([]UserIDStats, error) { APIIngestionRate: stats.APIIngestionRate, RuleIngestionRate: stats.RuleIngestionRate, NumSeries: stats.NumSeries, + ActiveSeries: stats.ActiveSeries, }, }) } diff --git a/pkg/distributor/http_admin.go b/pkg/distributor/http_admin.go index ed6c12cb859..1aa13baff27 100644 --- a/pkg/distributor/http_admin.go +++ b/pkg/distributor/http_admin.go @@ -30,6 +30,7 @@ const tpl = ` User # Series + # Active Series Total Ingest Rate API Ingest Rate Rule Ingest Rate @@ -40,6 +41,7 @@ const tpl = ` {{ .UserID }} {{ .UserStats.NumSeries }} + {{ .UserStats.ActiveSeries }} {{ printf "%.2f" .UserStats.IngestionRate }} {{ printf "%.2f" .UserStats.APIIngestionRate }} {{ printf "%.2f" .UserStats.RuleIngestionRate }} diff --git a/pkg/distributor/http_server.go b/pkg/distributor/http_server.go index ba0fb5913db..679e5879c7c 100644 --- a/pkg/distributor/http_server.go +++ b/pkg/distributor/http_server.go @@ -12,6 +12,7 @@ type UserStats struct { NumSeries uint64 `json:"numSeries"` APIIngestionRate float64 `json:"APIIngestionRate"` RuleIngestionRate float64 `json:"RuleIngestionRate"` + ActiveSeries uint64 `json:"activeSeries"` } // UserStatsHandler handles user stats to the Distributor. diff --git a/pkg/ingester/client/ingester.pb.go b/pkg/ingester/client/ingester.pb.go index 2a042813f46..67ebbd01ab5 100644 --- a/pkg/ingester/client/ingester.pb.go +++ b/pkg/ingester/client/ingester.pb.go @@ -735,6 +735,7 @@ type UserStatsResponse struct { NumSeries uint64 `protobuf:"varint,2,opt,name=num_series,json=numSeries,proto3" json:"num_series,omitempty"` ApiIngestionRate float64 `protobuf:"fixed64,3,opt,name=api_ingestion_rate,json=apiIngestionRate,proto3" json:"api_ingestion_rate,omitempty"` RuleIngestionRate float64 `protobuf:"fixed64,4,opt,name=rule_ingestion_rate,json=ruleIngestionRate,proto3" json:"rule_ingestion_rate,omitempty"` + ActiveSeries uint64 `protobuf:"varint,5,opt,name=active_series,json=activeSeries,proto3" json:"active_series,omitempty"` } func (m *UserStatsResponse) Reset() { *m = UserStatsResponse{} } @@ -797,6 +798,13 @@ func (m *UserStatsResponse) GetRuleIngestionRate() float64 { return 0 } +func (m *UserStatsResponse) GetActiveSeries() uint64 { + if m != nil { + return m.ActiveSeries + } + return 0 +} + type UserIDStatsResponse struct { UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` Data *UserStatsResponse `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` @@ -1444,88 +1452,89 @@ func init() { func init() { proto.RegisterFile("ingester.proto", fileDescriptor_60f6df4f3586b478) } var fileDescriptor_60f6df4f3586b478 = []byte{ - // 1296 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x73, 0xd3, 0xc6, - 0x17, 0xd7, 0xc6, 0x3f, 0xb0, 0x9f, 0x1d, 0xe3, 0x6c, 0x80, 0x18, 0xf1, 0x45, 0x01, 0xcd, 0xf0, - 0x6d, 0xa6, 0x2d, 0x0e, 0xa4, 0x3f, 0x06, 0xfa, 0x8b, 0x71, 0x20, 0x40, 0x0a, 0x21, 0x20, 0x07, - 0xda, 0xe9, 0x4c, 0x47, 0x23, 0xdb, 0x8b, 0xa3, 0xa2, 0x5f, 0x48, 0xab, 0x0e, 0xf4, 0xd4, 0x99, - 0xfe, 0x01, 0xed, 0xf4, 0xd4, 0x53, 0x67, 0x7a, 0xeb, 0xb9, 0x97, 0xde, 0x7a, 0xe6, 0xc8, 0x91, - 0xe9, 0x81, 0x29, 0xe6, 0xd2, 0x23, 0xfd, 0x0f, 0x3a, 0x5a, 0xad, 0x64, 0x49, 0x91, 0x13, 0x67, - 0x86, 0xf4, 0x66, 0xbd, 0xf7, 0x79, 0x9f, 0xfd, 0xec, 0xbe, 0xb7, 0xfb, 0x9e, 0xa1, 0xa1, 0x5b, - 0x43, 0xe2, 0x51, 0xe2, 0xb6, 0x1d, 0xd7, 0xa6, 0x36, 0x2e, 0xf7, 0x6d, 0x97, 0x92, 0x47, 0xe2, - 0xd9, 0xa1, 0x4e, 0xb7, 0xfd, 0x5e, 0xbb, 0x6f, 0x9b, 0xcb, 0x43, 0x7b, 0x68, 0x2f, 0x33, 0x77, - 0xcf, 0xbf, 0xcf, 0xbe, 0xd8, 0x07, 0xfb, 0x15, 0x86, 0x89, 0x17, 0x13, 0xf0, 0x90, 0xc1, 0x71, - 0xed, 0xaf, 0x48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 0x7b, 0x24, 0x09, 0xaf, 0x46, 0x12, 0xfa, 0xe1, 0xa5, 0x24, 0x3c, 0x7d, - 0x29, 0x09, 0xcf, 0x5e, 0x4a, 0xc2, 0x17, 0xe5, 0xbe, 0xa1, 0x13, 0x8b, 0xf6, 0xca, 0xec, 0x9f, - 0xfa, 0x3b, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x93, 0x83, 0xdf, 0x59, 0x2d, 0x10, 0x00, 0x00, + // 1312 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcf, 0x6f, 0xd4, 0xd6, + 0x13, 0xf7, 0x4b, 0x76, 0x97, 0xec, 0xec, 0x66, 0xd9, 0xbc, 0x00, 0x59, 0xcc, 0x17, 0x07, 0xfc, + 0x15, 0x6d, 0xd4, 0x96, 0x04, 0xd2, 0x1f, 0x82, 0xfe, 0x42, 0x09, 0x04, 0x48, 0x21, 0x04, 0x9c, + 0x40, 0xab, 0x4a, 0x95, 0xe5, 0xec, 0x3e, 0x12, 0x17, 0xff, 0xc2, 0x7e, 0x46, 0xd0, 0x53, 0xa5, + 0xfe, 0x01, 0xad, 0x7a, 0xea, 0xa9, 0x52, 0x6f, 0x3d, 0xf7, 0x0f, 0xe8, 0x99, 0x23, 0x47, 0x54, + 0x55, 0xa8, 0x2c, 0x97, 0x1e, 0xe9, 0x7f, 0x50, 0xf9, 0xfd, 0xf0, 0xda, 0x8e, 0x37, 0x09, 0x12, + 0xe9, 0x6d, 0x3d, 0xf3, 0x99, 0xcf, 0xcc, 0x9b, 0x99, 0xf7, 0x66, 0x16, 0x5a, 0xb6, 0xb7, 0x49, + 0x22, 0x4a, 0xc2, 0xd9, 0x20, 0xf4, 0xa9, 0x8f, 0x6b, 0x5d, 0x3f, 0xa4, 0xe4, 0xa1, 0x7a, 0x7a, + 0xd3, 0xa6, 0x5b, 0xf1, 0xc6, 0x6c, 0xd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ca, 0x24, 0x83, 0x84, 0xb4, 0x4e, 0x91, 0xfe, 0x11, 0x74, 0x06, 0x66, + 0x85, 0x23, 0xee, 0x6a, 0x8c, 0xa1, 0x7d, 0x3b, 0x22, 0xe1, 0x1a, 0xb5, 0xa8, 0x3c, 0x9f, 0xfe, + 0x27, 0x82, 0x89, 0x8c, 0x50, 0x50, 0x9d, 0x92, 0xef, 0xb7, 0xed, 0x7b, 0x66, 0x68, 0x51, 0xde, + 0x32, 0xc8, 0x18, 0x4f, 0xa5, 0x86, 0x45, 0x49, 0xd2, 0x55, 0x5e, 0xec, 0x9a, 0x69, 0xf7, 0xa3, + 0x99, 0x8a, 0x51, 0xf7, 0x62, 0x97, 0x77, 0x67, 0x92, 0x3b, 0x2b, 0xb0, 0xcd, 0x02, 0xd3, 0x28, + 0x63, 0x6a, 0x5b, 0x81, 0xbd, 0x9c, 0x23, 0x9b, 0x85, 0xc9, 0x30, 0x76, 0x48, 0x11, 0x5e, 0x61, + 0xf0, 0x89, 0x44, 0x95, 0xc7, 0xff, 0x1f, 0xc6, 0xad, 0x2e, 0xb5, 0x1f, 0x10, 0xe9, 0xbf, 0xca, + 0xfc, 0x37, 0xb9, 0x90, 0x87, 0xa0, 0x7f, 0x05, 0x93, 0xc9, 0xe9, 0x96, 0x2f, 0xe5, 0xcf, 0x37, + 0x05, 0x07, 0xe2, 0x88, 0x84, 0xa6, 0xdd, 0x13, 0x77, 0xa1, 0x96, 0x7c, 0x2e, 0xf7, 0xf0, 0x69, + 0xa8, 0xf4, 0x2c, 0x6a, 0xb1, 0xb3, 0x34, 0xe6, 0x8f, 0xca, 0x66, 0xdd, 0x96, 0x21, 0x83, 0xc1, + 0xf4, 0x2b, 0x80, 0x13, 0x55, 0x94, 0x67, 0x3f, 0x0b, 0xd5, 0x28, 0x11, 0x88, 0xab, 0x7b, 0x2c, + 0xcb, 0x52, 0x88, 0xc4, 0xe0, 0x48, 0xfd, 0x37, 0x04, 0xda, 0x0a, 0xa1, 0xa1,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0x4e, 0x0f, 0xd5, 0x4b, 0xde, 0xc5, 0x8f, 0x9f, 0x3c, 0xd7, 0x94, 0xa7, 0xcf, 0x35, 0xe5, 0xe5, + 0x73, 0x0d, 0x7d, 0xdb, 0xd7, 0xd0, 0xaf, 0x7d, 0x0d, 0x3d, 0xee, 0x6b, 0xe8, 0x49, 0x5f, 0x43, + 0x7f, 0xf5, 0x35, 0xf4, 0x77, 0x5f, 0x53, 0x5e, 0xf6, 0x35, 0xf4, 0xc3, 0x0b, 0x4d, 0x79, 0xf2, + 0x42, 0x53, 0x9e, 0xbe, 0xd0, 0x94, 0x2f, 0x6b, 0x5d, 0xc7, 0x26, 0x1e, 0xdd, 0xa8, 0xb1, 0xbf, + 0xf3, 0xef, 0xfe, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x47, 0x07, 0x0a, 0x45, 0x52, 0x10, 0x00, 0x00, } func (x MatchType) String() string { @@ -1986,6 +1995,9 @@ func (this *UserStatsResponse) Equal(that interface{}) bool { if this.RuleIngestionRate != that1.RuleIngestionRate { return false } + if this.ActiveSeries != that1.ActiveSeries { + return false + } return true } func (this *UserIDStatsResponse) Equal(that interface{}) bool { @@ -2541,12 +2553,13 @@ func (this *UserStatsResponse) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 8) + s := make([]string, 0, 9) s = append(s, "&client.UserStatsResponse{") s = append(s, "IngestionRate: "+fmt.Sprintf("%#v", this.IngestionRate)+",\n") s = append(s, "NumSeries: "+fmt.Sprintf("%#v", this.NumSeries)+",\n") s = append(s, "ApiIngestionRate: "+fmt.Sprintf("%#v", this.ApiIngestionRate)+",\n") s = append(s, "RuleIngestionRate: "+fmt.Sprintf("%#v", this.RuleIngestionRate)+",\n") + s = append(s, "ActiveSeries: "+fmt.Sprintf("%#v", this.ActiveSeries)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -3882,6 +3895,11 @@ func (m *UserStatsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ActiveSeries != 0 { + i = encodeVarintIngester(dAtA, i, uint64(m.ActiveSeries)) + i-- + dAtA[i] = 0x28 + } if m.RuleIngestionRate != 0 { i -= 8 encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.RuleIngestionRate)))) @@ -4667,6 +4685,9 @@ func (m *UserStatsResponse) Size() (n int) { if m.RuleIngestionRate != 0 { n += 9 } + if m.ActiveSeries != 0 { + n += 1 + sovIngester(uint64(m.ActiveSeries)) + } return n } @@ -5091,6 +5112,7 @@ func (this *UserStatsResponse) String() string { `NumSeries:` + fmt.Sprintf("%v", this.NumSeries) + `,`, `ApiIngestionRate:` + fmt.Sprintf("%v", this.ApiIngestionRate) + `,`, `RuleIngestionRate:` + fmt.Sprintf("%v", this.RuleIngestionRate) + `,`, + `ActiveSeries:` + fmt.Sprintf("%v", this.ActiveSeries) + `,`, `}`, }, "") return s @@ -6714,6 +6736,25 @@ func (m *UserStatsResponse) Unmarshal(dAtA []byte) error { v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 m.RuleIngestionRate = float64(math.Float64frombits(v)) + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ActiveSeries", wireType) + } + m.ActiveSeries = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIngester + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ActiveSeries |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipIngester(dAtA[iNdEx:]) diff --git a/pkg/ingester/client/ingester.proto b/pkg/ingester/client/ingester.proto index 982fed7e194..8e75129ed97 100644 --- a/pkg/ingester/client/ingester.proto +++ b/pkg/ingester/client/ingester.proto @@ -97,6 +97,7 @@ message UserStatsResponse { uint64 num_series = 2; double api_ingestion_rate = 3; double rule_ingestion_rate = 4; + uint64 active_series = 5; } message UserIDStatsResponse { diff --git a/pkg/ingester/ingester.go b/pkg/ingester/ingester.go index d3a7d1eb5ba..8273c5117cf 100644 --- a/pkg/ingester/ingester.go +++ b/pkg/ingester/ingester.go @@ -1553,7 +1553,7 @@ func (i *Ingester) UserStats(ctx context.Context, req *client.UserStatsRequest) return &client.UserStatsResponse{}, nil } - return createUserStats(db), nil + return createUserStats(db, i.cfg.ActiveSeriesMetricsEnabled), nil } // AllUserStats returns ingestion statistics for all users known to this ingester. @@ -1573,20 +1573,27 @@ func (i *Ingester) AllUserStats(_ context.Context, _ *client.UserStatsRequest) ( for userID, db := range users { response.Stats = append(response.Stats, &client.UserIDStatsResponse{ UserId: userID, - Data: createUserStats(db), + Data: createUserStats(db, i.cfg.ActiveSeriesMetricsEnabled), }) } return response, nil } -func createUserStats(db *userTSDB) *client.UserStatsResponse { +func createUserStats(db *userTSDB, activeSeriesMetricsEnabled bool) *client.UserStatsResponse { apiRate := db.ingestedAPISamples.Rate() ruleRate := db.ingestedRuleSamples.Rate() + + var activeSeries uint64 + if activeSeriesMetricsEnabled { + activeSeries = uint64(db.activeSeries.Active()) + } + return &client.UserStatsResponse{ IngestionRate: apiRate + ruleRate, ApiIngestionRate: apiRate, RuleIngestionRate: ruleRate, NumSeries: db.Head().NumSeries(), + ActiveSeries: activeSeries, } } diff --git a/pkg/ingester/ingester_test.go b/pkg/ingester/ingester_test.go index 7559fb89ff0..748bd194c0f 100644 --- a/pkg/ingester/ingester_test.go +++ b/pkg/ingester/ingester_test.go @@ -3193,6 +3193,7 @@ func Test_Ingester_AllUserStats(t *testing.T) { NumSeries: 3, ApiIngestionRate: 0.2, RuleIngestionRate: 0, + ActiveSeries: 3, }, }, { @@ -3202,6 +3203,7 @@ func Test_Ingester_AllUserStats(t *testing.T) { NumSeries: 2, ApiIngestionRate: 0.13333333333333333, RuleIngestionRate: 0, + ActiveSeries: 2, }, }, }