Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#10776] Fix static otlp params #11493

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { END_POINTS, OtlpMetricData, OtlpMetricDefUserDefined } from '@pinpoint-
import { convertParamsToQueryString } from '@pinpoint-fe/utils';
import { useSuspenseQuery } from '@tanstack/react-query';
import { queryFn } from './reactQueryHelper';
// import { useOpenTelemetrySearchParameters } from '../searchParameters';
import { useOpenTelemetrySearchParameters } from '../searchParameters';

const getQueryString = (queryParams: Partial<OtlpMetricData.Parameters>) => {
if (queryParams.applicationName && queryParams.metricGroupName && queryParams.metricName) {
Expand All @@ -20,18 +20,18 @@ export const useGetOtlpMetricData = ({
aggregationFunction,
fieldNameList,
}: OtlpMetricDefUserDefined.Metric) => {
const { application, dateRange } = useOpenTelemetrySearchParameters();
const queryParams = {
applicationName: 'minwoo_local_app', // * temp
from: 1723616400000, // * temp
to: 1723617000000, // * temp
applicationName: application?.applicationName,
from: dateRange.from.getTime(),
to: dateRange.to.getTime(),
metricGroupName,
metricName,
chartType,
tags,
aggregationFunction,
fieldNameList: fieldNameList.join(','),
};
// const { application, dateRange } = useOpenTelemetrySearchParameters();
const queryString = getQueryString(queryParams);

const { data, isLoading, refetch } = useSuspenseQuery<OtlpMetricData.Response | null>({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { END_POINTS, OtlpMetricDefProperty } from '@pinpoint-fe/constants';
import { convertParamsToQueryString } from '@pinpoint-fe/utils';
// import { useOpenTelemetrySearchParameters } from '../searchParameters';
import { useOpenTelemetrySearchParameters } from '../searchParameters';
import { useSuspenseQuery } from '@tanstack/react-query';
import { queryFn } from './reactQueryHelper';

Expand All @@ -13,8 +13,8 @@ const getQueryString = (queryParams: Partial<OtlpMetricDefProperty.Parameters>)
};

export const useGetOtlpMetricDefProperty = () => {
// const { application } = useOpenTelemetrySearchParameters();
const queryString = getQueryString({ applicationName: 'minwoo_local_app' });
const { application } = useOpenTelemetrySearchParameters();
const queryString = getQueryString({ applicationName: application?.applicationName });

const { data, isLoading, refetch } = useSuspenseQuery<OtlpMetricDefProperty.Response | null>({
queryKey: [END_POINTS.OTLP_METRIC_DEF_PROPERTY, queryString],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { END_POINTS, OtlpMetricDefUserDefined } from '@pinpoint-fe/constants';
import { convertParamsToQueryString } from '@pinpoint-fe/utils';
// import { useOpenTelemetrySearchParameters } from '../searchParameters';
import { useOpenTelemetrySearchParameters } from '../searchParameters';
import { useSuspenseQuery } from '@tanstack/react-query';
import { queryFn } from './reactQueryHelper';

Expand All @@ -13,8 +13,8 @@ const getQueryString = (queryParams: Partial<OtlpMetricDefUserDefined.GetParamet
};

export const useGetOtlpMetricDefUserDefined = () => {
// const { application } = useOpenTelemetrySearchParameters();
const queryString = getQueryString({ applicationName: 'minwoo_local_app' });
const { application } = useOpenTelemetrySearchParameters();
const queryString = getQueryString({ applicationName: application?.applicationName });

const { data, isLoading, refetch } =
useSuspenseQuery<OtlpMetricDefUserDefined.GetResponse | null>({
Expand Down