Compare commits

..

8 Commits

Author SHA1 Message Date
Yening Qin
7568119667 Merge branch 'release-21' into update-workflow 2026-01-22 19:44:42 +08:00
ning
c93694a2a9 refactor: update init metrics tpl 2026-01-21 19:45:57 +08:00
ning
cfb8c3b66a refactor: update doris check max rows 2026-01-21 16:03:04 +08:00
ning
cb5e62b7bb fix save workflow execution 2026-01-20 21:28:51 +08:00
yuansheng
ebfde8d6a0 refactor: record_rule support writeback_enabled (#3048) 2026-01-20 19:32:09 +08:00
ning
b4dcaebf83 refactor: update doris check max rows 2026-01-20 16:34:50 +08:00
huangjie
fa491e313a sso add feishu (#3046) 2026-01-19 14:12:38 +08:00
ning
4fe2b5042f refactor: update trigger value 2026-01-14 19:41:32 +08:00
4 changed files with 5 additions and 73 deletions

View File

@@ -331,30 +331,3 @@ CREATE TABLE `event_pipeline_execution` (
ALTER TABLE `builtin_metrics` ADD COLUMN `expression_type` varchar(32) NOT NULL DEFAULT 'promql' COMMENT 'expression type: metric_name or promql';
ALTER TABLE `builtin_metrics` ADD COLUMN `metric_type` varchar(191) NOT NULL DEFAULT '' COMMENT 'metric type like counter/gauge';
ALTER TABLE `builtin_metrics` ADD COLUMN `extra_fields` text COMMENT 'custom extra fields';
/* v9 2026-01-16 saved_view */
CREATE TABLE `saved_view` (
`id` bigint NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL COMMENT 'view name',
`page` varchar(64) NOT NULL COMMENT 'page identifier',
`filter` text COMMENT 'filter config (JSON)',
`public_cate` int NOT NULL DEFAULT 0 COMMENT 'public category: 0-self, 1-team, 2-all',
`gids` text COMMENT 'team group ids (JSON)',
`create_at` bigint NOT NULL DEFAULT 0 COMMENT 'create timestamp',
`create_by` varchar(64) NOT NULL DEFAULT '' COMMENT 'creator',
`update_at` bigint NOT NULL DEFAULT 0 COMMENT 'update timestamp',
`update_by` varchar(64) NOT NULL DEFAULT '' COMMENT 'updater',
PRIMARY KEY (`id`),
KEY `idx_page` (`page`),
KEY `idx_create_by` (`create_by`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='saved views for pages';
CREATE TABLE `user_view_favorite` (
`id` bigint NOT NULL AUTO_INCREMENT,
`view_id` bigint NOT NULL COMMENT 'saved view id',
`user_id` bigint NOT NULL COMMENT 'user id',
`create_at` bigint NOT NULL DEFAULT 0 COMMENT 'create timestamp',
PRIMARY KEY (`id`),
KEY `idx_view_id` (`view_id`),
KEY `idx_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='user favorite views';

View File

@@ -6,9 +6,9 @@ import (
"fmt"
"github.com/ccfos/nightingale/v6/pkg/ctx"
"github.com/ccfos/nightingale/v6/pkg/poster"
"gorm.io/gorm"
"github.com/ccfos/nightingale/v6/pkg/poster"
"gorm.io/gorm"
)
// 执行状态常量

View File

@@ -531,13 +531,8 @@ func Printf(format string, value interface{}) string {
switch valType {
case reflect.String:
strValue := value.(string)
// Check if it's a value with unit (contains both digits and non-numeric chars like letters or %)
if isValueWithUnit(strValue) {
return strValue
}
// Try converting string to float
if floatValue, err := strconv.ParseFloat(strValue, 64); err == nil {
if floatValue, err := strconv.ParseFloat(value.(string), 64); err == nil {
return fmt.Sprintf(format, floatValue)
}
return fmt.Sprintf(format, value)
@@ -549,32 +544,6 @@ func Printf(format string, value interface{}) string {
}
}
// isValueWithUnit checks if a string is a numeric value with unit
// e.g., "11.5%", "100MB", "10a" returns true
// e.g., "11", "11.11", "-3.14" returns false
func isValueWithUnit(s string) bool {
if s == "" {
return false
}
hasDigit := false
hasUnit := false
for _, r := range s {
if r >= '0' && r <= '9' {
hasDigit = true
} else if r == '.' || r == '-' || r == '+' {
// These are valid numeric characters, not units
continue
} else {
// Any other character (letters, %, etc.) is considered a unit
hasUnit = true
}
}
return hasDigit && hasUnit
}
func floatToTime(v float64) (*time.Time, error) {
if math.IsNaN(v) || math.IsInf(v, 0) {
return nil, errNaNOrInf

View File

@@ -7,7 +7,7 @@ import (
"regexp"
"strings"
templateT "text/template"
"encoding/base64"
"github.com/toolkits/pkg/logger"
)
@@ -64,16 +64,6 @@ var TemplateFuncMap = template.FuncMap{
"jsonMarshal": JsonMarshal,
"mapDifference": MapDifference,
"tagsMapToStr": TagsMapToStr,
"b64enc": func(s string) string {
return base64.StdEncoding.EncodeToString([]byte(s))
},
"b64dec": func(s string) string {
data, err := base64.StdEncoding.DecodeString(s)
if err != nil {
return s
}
return string(data)
},
}
// NewTemplateFuncMap copy on write for TemplateFuncMap