Compare commits

...

9 Commits

Author SHA1 Message Date
nikhilmantri0902
462ebdf213 chore: remaining metrics 2026-02-23 16:42:44 +05:30
nikhilmantri0902
919f0fa2ec chore: added metric_names across entire otel system metrics rack 2026-02-23 15:17:49 +05:30
Nikhil Mantri
bd01c5cfe7 Merge branch 'main' into feat/infra_status_logic_change 2026-02-23 14:39:48 +05:30
Srikanth Chekuri
69b8f75326 Merge branch 'main' into feat/infra_status_logic_change 2026-02-23 11:13:31 +05:30
Nikhil Mantri
7c88940512 Merge branch 'main' into feat/infra_status_logic_change 2026-02-16 12:32:59 +05:30
nikhilmantri0902
b25dd9387f chore: also added system.filesystem.usage 2026-02-12 12:36:14 +05:30
Srikanth Chekuri
5f10844b6f Merge branch 'main' into feat/infra_status_logic_change 2026-02-12 12:21:06 +05:30
nikhilmantri0902
f186a237e2 chore: added rows err check 2026-02-08 12:02:22 +05:30
nikhilmantri0902
876e223413 chore: added frontend and backend change 2026-02-08 11:50:57 +05:30
7 changed files with 141 additions and 61 deletions

View File

@@ -190,6 +190,11 @@
.ant-table-cell:nth-child(n + 3) {
padding-right: 24px;
}
.status-header {
display: flex;
align-items: center;
gap: 4px;
}
.memory-usage-header {
display: flex;
align-items: center;

View File

@@ -135,7 +135,14 @@ export const getHostsListColumns = (): ColumnType<HostRowData>[] => [
),
},
{
title: 'Status',
title: (
<div className="status-header">
Status
<Tooltip title="Sent system metrics in last 10 mins">
<InfoCircleOutlined />
</Tooltip>
</div>
),
dataIndex: 'active',
key: 'active',
width: 100,

View File

@@ -3541,6 +3541,45 @@ func (r *ClickHouseReader) GetCountOfThings(ctx context.Context, query string) (
return count, nil
}
func (r *ClickHouseReader) GetActiveHostsFromMetricMetadata(ctx context.Context, metricNames []string, hostNameAttr string, sinceUnixMilli int64) (map[string]bool, error) {
activeHosts := map[string]bool{}
query := fmt.Sprintf(
`SELECT DISTINCT attr_string_value
FROM %s.%s
WHERE metric_name IN @metricNames
AND attr_name = @attrName
AND last_reported_unix_milli >= @sinceUnixMilli`,
signozMetricDBName,
constants.SIGNOZ_METRICS_METADATA_TABLENAME,
)
rows, err := r.db.Query(ctx, query,
clickhouse.Named("metricNames", metricNames),
clickhouse.Named("attrName", hostNameAttr),
clickhouse.Named("sinceUnixMilli", sinceUnixMilli),
)
if err != nil {
return nil, errorsV2.WrapInternalf(err, errorsV2.CodeInternal, "error querying active hosts")
}
defer rows.Close()
for rows.Next() {
var hostName string
if err := rows.Scan(&hostName); err != nil {
return nil, errorsV2.WrapInternalf(err, errorsV2.CodeInternal, "error scanning active host row")
}
if hostName != "" {
activeHosts[hostName] = true
}
}
if err := rows.Err(); err != nil {
return nil, errorsV2.WrapInternalf(err, errorsV2.CodeInternal, "error iterating active host rows")
}
return activeHosts, nil
}
func (r *ClickHouseReader) GetLatestReceivedMetric(
ctx context.Context, metricNames []string, labelValues map[string]string,
) (*model.MetricStatus, *model.ApiError) {

View File

@@ -10,9 +10,47 @@ import (
)
var dotMetricMap = map[string]string{
"system_cpu_time": "system.cpu.time",
"system_memory_usage": "system.memory.usage",
"system_cpu_load_average_15m": "system.cpu.load_average.15m",
"system_uptime": "system.uptime",
"system_cpu_physical_count": "system.cpu.physical.count",
"system_cpu_logical_count": "system.cpu.logical.count",
"system_cpu_time": "system.cpu.time",
"system_cpu_frequency": "system.cpu.frequency",
"system_cpu_utilization": "system.cpu.utilization",
"system_cpu_load_average_15m": "system.cpu.load_average.15m",
"system_memory_usage": "system.memory.usage",
"system_memory_limit": "system.memory.limit",
"system_memory_utilization": "system.memory.utilization",
"system_memory_linux_available": "system.memory.linux.available",
"system_memory_linux_shared": "system.memory.linux.shared",
"system_memory_linux_slab_usage": "system.memory.linux.slab.usage",
"system_paging_usage": "system.paging.usage",
"system_paging_utilization": "system.paging.utilization",
"system_paging_faults": "system.paging.faults",
"system_paging_operations": "system.paging.operations",
"system_disk_io": "system.disk.io",
"system_disk_operations": "system.disk.operations",
"system_disk_io_time": "system.disk.io_time",
"system_disk_operation_time": "system.disk.operation_time",
"system_disk_merged": "system.disk.merged",
"system_disk_limit": "system.disk.limit",
"system_filesystem_usage": "system.filesystem.usage",
"system_filesystem_utilization": "system.filesystem.utilization",
"system_filesystem_limit": "system.filesystem.limit",
"system_network_packet_dropped": "system.network.packet.dropped",
"system_network_packet_count": "system.network.packet.count",
"system_network_errors": "system.network.errors",
"system_network_io": "system.network.io",
"system_network_connection_count": "system.network.connection.count",
"system_process_count": "system.process.count",
"system_process_created": "system.process.created",
"system_disk_pending_operations": "system.disk.pending_operations",
"system_disk_weighted_io_time": "system.disk.weighted_io_time",
"system_filesystem_inodes_usage": "system.filesystem.inodes.usage",
"system_network_conntrack_count": "system.network.conntrack.count",
"system_network_conntrack_max": "system.network.conntrack.max",
"system_cpu_load_average_1m": "system.cpu.load_average.1m",
"system_cpu_load_average_5m": "system.cpu.load_average.5m",
"host_name": "host.name",
"k8s_cluster_name": "k8s.cluster.name",
"k8s_node_name": "k8s.node.name",

View File

@@ -72,6 +72,48 @@ var (
"load15": GetDotMetrics("system_cpu_load_average_15m"),
"wait": GetDotMetrics("system_cpu_time"),
}
uniqueMetricNamesForHosts = []string{
GetDotMetrics("system_uptime"),
GetDotMetrics("system_cpu_physical_count"),
GetDotMetrics("system_cpu_logical_count"),
GetDotMetrics("system_cpu_time"),
GetDotMetrics("system_cpu_frequency"),
GetDotMetrics("system_cpu_utilization"),
GetDotMetrics("system_cpu_load_average_15m"),
GetDotMetrics("system_memory_usage"),
GetDotMetrics("system_memory_limit"),
GetDotMetrics("system_memory_utilization"),
GetDotMetrics("system_memory_linux_available"),
GetDotMetrics("system_memory_linux_shared"),
GetDotMetrics("system_memory_linux_slab_usage"),
GetDotMetrics("system_paging_usage"),
GetDotMetrics("system_paging_utilization"),
GetDotMetrics("system_paging_faults"),
GetDotMetrics("system_paging_operations"),
GetDotMetrics("system_disk_io"),
GetDotMetrics("system_disk_operations"),
GetDotMetrics("system_disk_io_time"),
GetDotMetrics("system_disk_operation_time"),
GetDotMetrics("system_disk_merged"),
GetDotMetrics("system_disk_limit"),
GetDotMetrics("system_filesystem_usage"),
GetDotMetrics("system_filesystem_utilization"),
GetDotMetrics("system_filesystem_limit"),
GetDotMetrics("system_network_packet_dropped"),
GetDotMetrics("system_network_packet_count"),
GetDotMetrics("system_network_errors"),
GetDotMetrics("system_network_io"),
GetDotMetrics("system_network_connection_count"),
GetDotMetrics("system_process_count"),
GetDotMetrics("system_process_created"),
GetDotMetrics("system_disk_pending_operations"),
GetDotMetrics("system_disk_weighted_io_time"),
GetDotMetrics("system_filesystem_inodes_usage"),
GetDotMetrics("system_network_conntrack_count"),
GetDotMetrics("system_network_conntrack_max"),
GetDotMetrics("system_cpu_load_average_1m"),
GetDotMetrics("system_cpu_load_average_5m"),
}
)
func NewHostsRepo(reader interfaces.Reader, querierV2 interfaces.Querier) *HostsRepo {
@@ -130,62 +172,9 @@ func (h *HostsRepo) GetHostAttributeValues(ctx context.Context, req v3.FilterAtt
return &v3.FilterAttributeValueResponse{StringAttributeValues: hostNames}, nil
}
func (h *HostsRepo) getActiveHosts(ctx context.Context, orgID valuer.UUID, req model.HostListRequest) (map[string]bool, error) {
activeStatus := map[string]bool{}
step := common.MinAllowedStepInterval(req.Start, req.End)
hasHostName := false
for _, key := range req.GroupBy {
if key.Key == hostNameAttrKey {
hasHostName = true
}
}
if !hasHostName {
req.GroupBy = append(req.GroupBy, v3.AttributeKey{Key: hostNameAttrKey})
}
params := v3.QueryRangeParamsV3{
Start: time.Now().Add(-time.Minute * 10).UTC().UnixMilli(),
End: time.Now().UTC().UnixMilli(),
Step: step,
CompositeQuery: &v3.CompositeQuery{
BuilderQueries: map[string]*v3.BuilderQuery{
"A": {
QueryName: "A",
StepInterval: step,
DataSource: v3.DataSourceMetrics,
AggregateAttribute: v3.AttributeKey{
Key: metricToUseForHostAttributes,
DataType: v3.AttributeKeyDataTypeFloat64,
},
Temporality: v3.Unspecified,
Filters: req.Filters,
GroupBy: req.GroupBy,
Expression: "A",
TimeAggregation: v3.TimeAggregationAvg,
SpaceAggregation: v3.SpaceAggregationAvg,
Disabled: false,
},
},
QueryType: v3.QueryTypeBuilder,
PanelType: v3.PanelTypeGraph,
},
}
queryResponse, _, err := h.querierV2.QueryRange(ctx, orgID, &params)
if err != nil {
return nil, err
}
for _, result := range queryResponse {
for _, series := range result.Series {
name := series.Labels[hostNameAttrKey]
activeStatus[name] = true
}
}
return activeStatus, nil
func (h *HostsRepo) getActiveHosts(ctx context.Context) (map[string]bool, error) {
tenMinAgo := time.Now().Add(-10 * time.Minute).UTC().UnixMilli()
return h.reader.GetActiveHostsFromMetricMetadata(ctx, uniqueMetricNamesForHosts, hostNameAttrKey, tenMinAgo)
}
func (h *HostsRepo) getMetadataAttributes(ctx context.Context, req model.HostListRequest) (map[string]map[string]string, error) {
@@ -441,7 +430,7 @@ func (h *HostsRepo) GetHostList(ctx context.Context, orgID valuer.UUID, req mode
return resp, err
}
activeHosts, err := h.getActiveHosts(ctx, orgID, req)
activeHosts, err := h.getActiveHosts(ctx)
if err != nil {
return resp, err
}

View File

@@ -125,6 +125,7 @@ const (
SIGNOZ_TIMESERIES_v4_6HRS_TABLENAME = "distributed_time_series_v4_6hrs"
SIGNOZ_ATTRIBUTES_METADATA_TABLENAME = "distributed_attributes_metadata"
SIGNOZ_ATTRIBUTES_METADATA_LOCAL_TABLENAME = "attributes_metadata"
SIGNOZ_METRICS_METADATA_TABLENAME = "distributed_metadata"
)
// alert related constants

View File

@@ -99,6 +99,7 @@ type Reader interface {
SubscribeToQueryProgress(queryId string) (<-chan model.QueryProgress, func(), *model.ApiError)
GetCountOfThings(ctx context.Context, query string) (uint64, error)
GetActiveHostsFromMetricMetadata(ctx context.Context, metricNames []string, hostNameAttr string, sinceUnixMilli int64) (map[string]bool, error)
//trace
GetTraceFields(ctx context.Context) (*model.GetFieldsResponse, *model.ApiError)