fix: changed or to and

This commit is contained in:
Ankit Nayan 2022-12-28 02:34:07 +05:30
commit d8882acdd7
9 changed files with 72 additions and 52 deletions

View File

@ -78,7 +78,7 @@ processors:
signozspanmetrics/prometheus: signozspanmetrics/prometheus:
metrics_exporter: prometheus metrics_exporter: prometheus
latency_histogram_buckets: [100us, 1ms, 2ms, 6ms, 10ms, 50ms, 100ms, 250ms, 500ms, 1000ms, 1400ms, 2000ms, 5s, 10s, 20s, 40s, 60s ] latency_histogram_buckets: [100us, 1ms, 2ms, 6ms, 10ms, 50ms, 100ms, 250ms, 500ms, 1000ms, 1400ms, 2000ms, 5s, 10s, 20s, 40s, 60s ]
dimensions_cache_size: 10000 dimensions_cache_size: 100000
dimensions: dimensions:
- name: service.namespace - name: service.namespace
default: default default: default

View File

@ -74,7 +74,7 @@ processors:
signozspanmetrics/prometheus: signozspanmetrics/prometheus:
metrics_exporter: prometheus metrics_exporter: prometheus
latency_histogram_buckets: [100us, 1ms, 2ms, 6ms, 10ms, 50ms, 100ms, 250ms, 500ms, 1000ms, 1400ms, 2000ms, 5s, 10s, 20s, 40s, 60s ] latency_histogram_buckets: [100us, 1ms, 2ms, 6ms, 10ms, 50ms, 100ms, 250ms, 500ms, 1000ms, 1400ms, 2000ms, 5s, 10s, 20s, 40s, 60s ]
dimensions_cache_size: 10000 dimensions_cache_size: 100000
dimensions: dimensions:
- name: service.namespace - name: service.namespace
default: default default: default

View File

@ -4,14 +4,16 @@ import { ENVIRONMENT } from 'constants/env';
import { LOCALSTORAGE } from 'constants/localStorage'; import { LOCALSTORAGE } from 'constants/localStorage';
import { EventSourcePolyfill } from 'event-source-polyfill'; import { EventSourcePolyfill } from 'event-source-polyfill';
export const LiveTail = (queryParams: string): EventSourcePolyfill => { // 10 min in ms
const dict = { const TIMEOUT_IN_MS = 10 * 60 * 1000;
headers: {
Authorization: `Bearer ${getLocalStorageKey(LOCALSTORAGE.AUTH_TOKEN)}`, export const LiveTail = (queryParams: string): EventSourcePolyfill =>
}, new EventSourcePolyfill(
};
return new EventSourcePolyfill(
`${ENVIRONMENT.baseURL}${apiV1}logs/tail?${queryParams}`, `${ENVIRONMENT.baseURL}${apiV1}logs/tail?${queryParams}`,
dict, {
headers: {
Authorization: `Bearer ${getLocalStorageKey(LOCALSTORAGE.AUTH_TOKEN)}`,
},
heartbeatTimeout: TIMEOUT_IN_MS,
},
); );
};

View File

@ -127,7 +127,7 @@ function SearchFilter({
useEffect(() => { useEffect(() => {
debouncedHandleSearch(urlQueryString || ''); debouncedHandleSearch(urlQueryString || '');
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [urlQueryString, maxTime, minTime, idEnd, idStart]); }, [urlQueryString, maxTime, minTime, idEnd, idStart, logLinesPerPage]);
return ( return (
<Container> <Container>

View File

@ -1,6 +1,6 @@
import { WarningFilled } from '@ant-design/icons'; import { WarningFilled } from '@ant-design/icons';
import { Button, Card, Form, Space, Typography } from 'antd'; import { Button, Card, Form, Space, Typography } from 'antd';
import React, { useCallback } from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { AppState } from 'store/reducers'; import { AppState } from 'store/reducers';
@ -14,10 +14,6 @@ function Version(): JSX.Element {
const [form] = Form.useForm(); const [form] = Form.useForm();
const { t } = useTranslation(); const { t } = useTranslation();
const onClickUpgradeHandler = useCallback((link: string) => {
window.open(link, '_blank');
}, []);
const { const {
currentVersion, currentVersion,
latestVersion, latestVersion,
@ -60,9 +56,8 @@ function Version(): JSX.Element {
placeholder={t('latest_version')} placeholder={t('latest_version')}
/> />
<Button <Button
onClick={(): void => href="https://github.com/SigNoz/signoz/releases"
onClickUpgradeHandler('https://github.com/SigNoz/signoz/releases') target="_blank"
}
type="link" type="link"
> >
{t('release_notes')} {t('release_notes')}
@ -94,11 +89,8 @@ function Version(): JSX.Element {
{!isError && !isLatestVersion && ( {!isError && !isLatestVersion && (
<Button <Button
onClick={(): void => href="https://signoz.io/docs/operate/docker-standalone/#upgrade"
onClickUpgradeHandler( target="_blank"
'https://signoz.io/docs/operate/docker-standalone/#upgrade',
)
}
> >
{t('read_how_to_upgrade')} {t('read_how_to_upgrade')}
</Button> </Button>

View File

@ -1178,33 +1178,54 @@ func (r *ClickHouseReader) GetSpanFilters(ctx context.Context, queryParams *mode
traceFilterReponse.Status = map[string]uint64{"ok": 0, "error": 0} traceFilterReponse.Status = map[string]uint64{"ok": 0, "error": 0}
} }
case constants.Duration: case constants.Duration:
finalQuery := fmt.Sprintf("SELECT durationNano as numTotal FROM %s.%s WHERE timestamp >= @timestampL AND timestamp <= @timestampU", r.TraceDB, r.durationTable) err := r.featureFlags.CheckFeature(constants.DurationSort)
finalQuery += query durationSortEnabled := err == nil
finalQuery += " ORDER BY durationNano LIMIT 1" finalQuery := ""
var dBResponse []model.DBResponseTotal if !durationSortEnabled {
err := r.db.Select(ctx, &dBResponse, finalQuery, args...) // if duration sort is not enabled, we need to get the min and max duration from the index table
zap.S().Info(finalQuery) finalQuery = fmt.Sprintf("SELECT min(durationNano) as min, max(durationNano) as max FROM %s.%s WHERE timestamp >= @timestampL AND timestamp <= @timestampU", r.TraceDB, r.indexTable)
finalQuery += query
var dBResponse []model.DBResponseMinMax
err = r.db.Select(ctx, &dBResponse, finalQuery, args...)
zap.S().Info(finalQuery)
if err != nil {
zap.S().Debug("Error in processing sql query: ", err)
return nil, &model.ApiError{Typ: model.ErrorExec, Err: fmt.Errorf("Error in processing sql query: %s", err)}
}
if len(dBResponse) > 0 {
traceFilterReponse.Duration = map[string]uint64{"minDuration": dBResponse[0].Min, "maxDuration": dBResponse[0].Max}
}
} else {
// when duration sort is enabled, we need to get the min and max duration from the duration table
finalQuery = fmt.Sprintf("SELECT durationNano as numTotal FROM %s.%s WHERE timestamp >= @timestampL AND timestamp <= @timestampU", r.TraceDB, r.durationTable)
finalQuery += query
finalQuery += " ORDER BY durationNano LIMIT 1"
var dBResponse []model.DBResponseTotal
err = r.db.Select(ctx, &dBResponse, finalQuery, args...)
zap.S().Info(finalQuery)
if err != nil { if err != nil {
zap.S().Debug("Error in processing sql query: ", err) zap.S().Debug("Error in processing sql query: ", err)
return nil, &model.ApiError{Typ: model.ErrorExec, Err: fmt.Errorf("Error in processing sql query: %s", err)} return nil, &model.ApiError{Typ: model.ErrorExec, Err: fmt.Errorf("Error in processing sql query: %s", err)}
} }
finalQuery = fmt.Sprintf("SELECT durationNano as numTotal FROM %s.%s WHERE timestamp >= @timestampL AND timestamp <= @timestampU", r.TraceDB, r.durationTable)
finalQuery += query
finalQuery += " ORDER BY durationNano DESC LIMIT 1"
var dBResponse2 []model.DBResponseTotal
err = r.db.Select(ctx, &dBResponse2, finalQuery, args...)
zap.S().Info(finalQuery)
if err != nil { finalQuery = fmt.Sprintf("SELECT durationNano as numTotal FROM %s.%s WHERE timestamp >= @timestampL AND timestamp <= @timestampU", r.TraceDB, r.durationTable)
zap.S().Debug("Error in processing sql query: ", err) finalQuery += query
return nil, &model.ApiError{Typ: model.ErrorExec, Err: fmt.Errorf("Error in processing sql query: %s", err)} finalQuery += " ORDER BY durationNano DESC LIMIT 1"
} var dBResponse2 []model.DBResponseTotal
if len(dBResponse) > 0 { err = r.db.Select(ctx, &dBResponse2, finalQuery, args...)
traceFilterReponse.Duration["minDuration"] = dBResponse[0].NumTotal zap.S().Info(finalQuery)
}
if len(dBResponse2) > 0 { if err != nil {
traceFilterReponse.Duration["maxDuration"] = dBResponse2[0].NumTotal zap.S().Debug("Error in processing sql query: ", err)
return nil, &model.ApiError{Typ: model.ErrorExec, Err: fmt.Errorf("Error in processing sql query: %s", err)}
}
if len(dBResponse) > 0 {
traceFilterReponse.Duration["minDuration"] = dBResponse[0].NumTotal
}
if len(dBResponse2) > 0 {
traceFilterReponse.Duration["maxDuration"] = dBResponse2[0].NumTotal
}
} }
case constants.RPCMethod: case constants.RPCMethod:
finalQuery := fmt.Sprintf("SELECT rpcMethod, count() as count FROM %s.%s WHERE timestamp >= @timestampL AND timestamp <= @timestampU", r.TraceDB, r.indexTable) finalQuery := fmt.Sprintf("SELECT rpcMethod, count() as count FROM %s.%s WHERE timestamp >= @timestampL AND timestamp <= @timestampU", r.TraceDB, r.indexTable)

View File

@ -1333,7 +1333,7 @@ func (aH *APIHandler) getServices(w http.ResponseWriter, r *http.Request) {
} }
telemetry.GetInstance().SendEvent(telemetry.TELEMETRY_EVENT_NUMBER_OF_SERVICES, data) telemetry.GetInstance().SendEvent(telemetry.TELEMETRY_EVENT_NUMBER_OF_SERVICES, data)
if (data["number"] != 0) || (data["number"] != telemetry.DEFAULT_NUMBER_OF_SERVICES) { if (data["number"] != 0) && (data["number"] != telemetry.DEFAULT_NUMBER_OF_SERVICES) {
telemetry.GetInstance().AddActiveTracesUser() telemetry.GetInstance().AddActiveTracesUser()
} }

View File

@ -399,6 +399,11 @@ type DBResponseTotal struct {
NumTotal uint64 `ch:"numTotal"` NumTotal uint64 `ch:"numTotal"`
} }
type DBResponseMinMax struct {
Min uint64 `ch:"min"`
Max uint64 `ch:"max"`
}
type SpanFiltersResponse struct { type SpanFiltersResponse struct {
ServiceName map[string]uint64 `json:"serviceName"` ServiceName map[string]uint64 `json:"serviceName"`
Status map[string]uint64 `json:"status"` Status map[string]uint64 `json:"status"`

View File

@ -74,7 +74,7 @@ processors:
signozspanmetrics/prometheus: signozspanmetrics/prometheus:
metrics_exporter: prometheus metrics_exporter: prometheus
latency_histogram_buckets: [100us, 1ms, 2ms, 6ms, 10ms, 50ms, 100ms, 250ms, 500ms, 1000ms, 1400ms, 2000ms, 5s, 10s, 20s, 40s, 60s ] latency_histogram_buckets: [100us, 1ms, 2ms, 6ms, 10ms, 50ms, 100ms, 250ms, 500ms, 1000ms, 1400ms, 2000ms, 5s, 10s, 20s, 40s, 60s ]
dimensions_cache_size: 10000 dimensions_cache_size: 100000
dimensions: dimensions:
- name: service.namespace - name: service.namespace
default: default default: default