mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-20 08:06:04 +00:00
fix: fixed enrichment table query timeline (#896)
1. start time and end time in enrichment table query 2. #893
This commit is contained in:
@@ -212,7 +212,11 @@ import {
|
||||
import segment from "@/services/segment_analytics";
|
||||
import config from "@/aws-exports";
|
||||
import { logsErrorMessage } from "@/utils/common";
|
||||
import { verifyOrganizationStatus } from "@/utils/zincutils";
|
||||
import {
|
||||
verifyOrganizationStatus,
|
||||
convertTimeFromMicroToMilli,
|
||||
} from "@/utils/zincutils";
|
||||
import { cloneDeep } from "lodash-es";
|
||||
|
||||
export default defineComponent({
|
||||
name: "PageSearch",
|
||||
@@ -460,8 +464,16 @@ export default defineComponent({
|
||||
);
|
||||
if (stream.stats) {
|
||||
return {
|
||||
start_time: new Date(stream.stats.doc_time_min),
|
||||
end_time: new Date(stream.stats.doc_time_max),
|
||||
start_time: new Date(
|
||||
convertTimeFromMicroToMilli(
|
||||
stream.stats.doc_time_min - 300000000
|
||||
)
|
||||
),
|
||||
end_time: new Date(
|
||||
convertTimeFromMicroToMilli(
|
||||
stream.stats.doc_time_max + 300000000
|
||||
)
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -559,7 +571,6 @@ export default defineComponent({
|
||||
};
|
||||
|
||||
var timestamps: any = getConsumableDateTime();
|
||||
|
||||
if (
|
||||
timestamps.start_time != "Invalid Date" &&
|
||||
timestamps.end_time != "Invalid Date"
|
||||
@@ -829,7 +840,6 @@ export default defineComponent({
|
||||
} else {
|
||||
searchObj.data.errorMsg = err.message;
|
||||
}
|
||||
console.log(err.response);
|
||||
const customMessage = logsErrorMessage(err.response.data.code);
|
||||
searchObj.data.errorCode = err.response.data.code;
|
||||
if (customMessage != "") {
|
||||
@@ -1518,7 +1528,6 @@ export default defineComponent({
|
||||
this.searchObj.loading = true;
|
||||
this.searchObj.data.errorMsg = "";
|
||||
this.searchObj.data.stream.streamLists = [];
|
||||
this.searchObj.data.stream.selectedStream = { label: "", value: "" };
|
||||
this.searchObj.data.stream.selectedStreamFields = [];
|
||||
this.searchObj.data.queryResults = {};
|
||||
this.searchObj.data.sortedQueryResults = [];
|
||||
|
||||
@@ -316,7 +316,11 @@ import { useStore } from "vuex";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRouter } from "vue-router";
|
||||
import useLogs from "../../composables/useLogs";
|
||||
import { b64EncodeUnicode, getImageURL } from "../../utils/zincutils";
|
||||
import {
|
||||
b64EncodeUnicode,
|
||||
getImageURL,
|
||||
convertTimeFromMicroToMilli,
|
||||
} from "../../utils/zincutils";
|
||||
import streamService from "../../services/stream";
|
||||
import { getConsumableDateTime } from "@/utils/commons";
|
||||
import { Parser } from "node-sql-parser";
|
||||
@@ -405,11 +409,16 @@ export default defineComponent({
|
||||
);
|
||||
if (stream.stats) {
|
||||
timestamps = {
|
||||
start_time: new Date(stream.stats.doc_time_min),
|
||||
end_time: new Date(stream.stats.doc_time_max),
|
||||
start_time: new Date(
|
||||
convertTimeFromMicroToMilli(stream.stats.doc_time_min - 300000000)
|
||||
),
|
||||
end_time: new Date(
|
||||
convertTimeFromMicroToMilli(stream.stats.doc_time_max + 300000000)
|
||||
),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const startISOTimestamp: any =
|
||||
new Date(timestamps.start_time.toISOString()).getTime() * 1000;
|
||||
const endISOTimestamp: any =
|
||||
|
||||
@@ -138,21 +138,24 @@
|
||||
class="field_overlay"
|
||||
:title="row.name"
|
||||
>
|
||||
<q-icon
|
||||
:name="'img:' + getImageURL('images/common/add_icon.svg')"
|
||||
size="1rem"
|
||||
title="Add to search query"
|
||||
<q-btn
|
||||
:icon="'img:' + getImageURL('images/common/equals.svg')"
|
||||
class="q-mr-xs"
|
||||
size="6px"
|
||||
@click.prevent.stop="
|
||||
addSearchTerm(`${column.name}='${row[column.name]}'`)
|
||||
"
|
||||
title="Include Term"
|
||||
round
|
||||
/>
|
||||
<q-icon
|
||||
:name="'img:' + getImageURL('images/common/remove_icon.svg')"
|
||||
size="1rem"
|
||||
title="Add to search query"
|
||||
<q-btn
|
||||
:icon="'img:' + getImageURL('images/common/not_equals.svg')"
|
||||
size="6px"
|
||||
@click.prevent.stop="
|
||||
addSearchTerm(`${column.name}!='${row[column.name]}'`)
|
||||
"
|
||||
title="Exclude Term"
|
||||
round
|
||||
/>
|
||||
</div>
|
||||
</q-td>
|
||||
|
||||
@@ -252,6 +252,7 @@ import { defineComponent, ref, onBeforeMount, onBeforeUnmount } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useRouter } from "vue-router";
|
||||
import { getImageURL } from "../../utils/zincutils";
|
||||
import { useStore } from "vuex";
|
||||
|
||||
const defaultValue: any = () => {
|
||||
return {
|
||||
@@ -297,14 +298,8 @@ export default defineComponent({
|
||||
// this.$emit("remove:searchterm", term);
|
||||
// }
|
||||
},
|
||||
searchTimeBoxed(rowData: any, size: number) {
|
||||
this.$emit("search:timeboxed", {
|
||||
key: rowData._timestamp,
|
||||
size: size,
|
||||
});
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
setup(props, { emit }) {
|
||||
const { t } = useI18n();
|
||||
const rowData: any = ref({});
|
||||
const router = useRouter();
|
||||
@@ -312,6 +307,7 @@ export default defineComponent({
|
||||
const selectedRelativeValue = ref("10");
|
||||
const recordSizeOptions: any = ref([10, 20, 50, 100, 200, 500, 1000]);
|
||||
const shouldWrapValues: any = ref(false);
|
||||
const store = useStore();
|
||||
|
||||
onBeforeMount(() => {
|
||||
if (window.localStorage.getItem("wrap-log-details") === null) {
|
||||
@@ -345,6 +341,13 @@ export default defineComponent({
|
||||
return newObj;
|
||||
};
|
||||
|
||||
function searchTimeBoxed(rowData: any, size: number) {
|
||||
emit("search:timeboxed", {
|
||||
key: rowData[store.state.zoConfig.timestamp_column],
|
||||
size: size,
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
t,
|
||||
router,
|
||||
@@ -356,6 +359,7 @@ export default defineComponent({
|
||||
getImageURL,
|
||||
shouldWrapValues,
|
||||
toggleWrapLogDetails,
|
||||
searchTimeBoxed,
|
||||
};
|
||||
},
|
||||
async created() {
|
||||
|
||||
@@ -483,7 +483,7 @@ export default defineComponent({
|
||||
const getDefaultRequest = () => {
|
||||
return {
|
||||
query: {
|
||||
sql: `select min(${store.state.zoConfig.timestamp_column}) as ${store.state.zoConfig.timestamp_column}, min(start_time) as start_time, service_name, operation_name, count(span_id) as spans, max(duration) as duration, trace_id [QUERY_FUNCTIONS] from "[INDEX_NAME]" [WHERE_CLAUSE] group by trace_id, service_name, operation_name`,
|
||||
sql: `select min(${store.state.zoConfig.timestamp_column}) as ${store.state.zoConfig.timestamp_column}, min(start_time) as start_time, service_name, operation_name, count(span_id) as spans, max(duration) as duration, trace_id [QUERY_FUNCTIONS] from "[INDEX_NAME]" [WHERE_CLAUSE] group by trace_id, service_name, operation_name order by ${store.state.zoConfig.timestamp_column}`,
|
||||
start_time: (new Date().getTime() - 900000) * 1000,
|
||||
end_time: new Date().getTime() * 1000,
|
||||
from: 0,
|
||||
|
||||
@@ -259,7 +259,7 @@ export const getPath = () => {
|
||||
? "/"
|
||||
: pos > -1
|
||||
? window.location.pathname.slice(0, pos + 5)
|
||||
: window.location.pathname;
|
||||
: window.location.pathname;
|
||||
const cloudPath = import.meta.env.BASE_URL;
|
||||
return config.isCloud == "true" ? cloudPath : path;
|
||||
};
|
||||
@@ -313,3 +313,9 @@ export const verifyOrganizationStatus = (Organizations: any, Router: any) => {
|
||||
// }
|
||||
// }
|
||||
};
|
||||
|
||||
export const convertTimeFromMicroToMilli = (time: number) => {
|
||||
const milliseconds = Math.floor(time / 1000);
|
||||
const date = new Date(milliseconds);
|
||||
return date.getTime();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user