(idFilter, orgID, id string)
| 1208 | } |
| 1209 | |
| 1210 | func TransCustomBizFilter(idFilter, orgID, id string) (string, error) { |
| 1211 | filter := "1!=1" |
| 1212 | col := "server_filter" |
| 1213 | if strings.Contains(idFilter, "_0") { |
| 1214 | col = "client_filter" |
| 1215 | } |
| 1216 | sql := fmt.Sprintf("SELECT %s FROM flow_tag.custom_biz_service_filter_map WHERE id=%s", col, id) |
| 1217 | chClient := client.Client{ |
| 1218 | Host: config.Cfg.Clickhouse.Host, |
| 1219 | Port: config.Cfg.Clickhouse.Port, |
| 1220 | UserName: config.Cfg.Clickhouse.User, |
| 1221 | Password: config.Cfg.Clickhouse.Password, |
| 1222 | DB: "flow_tag", |
| 1223 | } |
| 1224 | filterRst, err := chClient.DoQuery(&client.QueryParams{Sql: sql, ORGID: orgID}) |
| 1225 | if err != nil { |
| 1226 | return filter, err |
| 1227 | } |
| 1228 | for _, v := range filterRst.Values { |
| 1229 | filter = v.([]interface{})[0].(string) |
| 1230 | } |
| 1231 | return filter, err |
| 1232 | } |
| 1233 | |
| 1234 | func GetPrometheusFilter(promTag, table, op, value string, e *CHEngine) (string, error) { |
| 1235 | filter := "" |
no test coverage detected