keep icon indicating copy to clipboard operation
keep copied to clipboard

[🔨 Enhancement]: provider distribution should use search engine (elastic)

Open shahargl opened this issue 1 year ago • 1 comments

Describe the bug When deploying Keep with elastic, it still calc provider distribution on the database

shahargl avatar Jul 01 '24 10:07 shahargl

this depends on adding "index-alerts-history" which won't happen now.

once we have that, we can run:

POST /_sql?format=json
{
  "query": """
    SELECT 
      providerId AS alert_provider_id, 
      providerType AS alert_provider_type, 
      DATE_FORMAT(lastReceived, 'yyyy-MM-dd HH') AS "time", 
      COUNT(*) AS hits, 
      MAX(lastReceived) AS last_alert_timestamp 
    FROM 
      "keep-alerts-%tenant-id%"
    WHERE 
      lastReceived >= NOW() - INTERVAL 1 DAY
    GROUP BY 
      providerId, 
      providerType, 
      DATE_FORMAT(lastReceived, 'yyyy-MM-dd HH')
    ORDER BY 
      providerId, 
      providerType, 
      DATE_FORMAT(lastReceived, 'yyyy-MM-dd HH')
  """
}

shahargl avatar Jul 04 '24 08:07 shahargl

Not relevant anymore, I think. @shahargl if needed, let's re-open.

talboren avatar Mar 19 '25 08:03 talboren