mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-29 16:14:42 +00:00
34 lines
936 B
TypeScript
34 lines
936 B
TypeScript
|
|
import axios from 'api';
|
||
|
|
import { ErrorResponseHandler } from 'api/ErrorResponseHandler';
|
||
|
|
import { AxiosError } from 'axios';
|
||
|
|
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
||
|
|
import { ErrorResponse, SuccessResponse } from 'types/api';
|
||
|
|
|
||
|
|
import {
|
||
|
|
MessagingQueueServicePayload,
|
||
|
|
MessagingQueuesPayloadProps,
|
||
|
|
} from './getConsumerLagDetails';
|
||
|
|
|
||
|
|
export const getTopicThroughputDetails = async (
|
||
|
|
props: MessagingQueueServicePayload,
|
||
|
|
): Promise<
|
||
|
|
SuccessResponse<MessagingQueuesPayloadProps['payload']> | ErrorResponse
|
||
|
|
> => {
|
||
|
|
const { detailType, ...rest } = props;
|
||
|
|
const endpoint = `/messaging-queues/kafka/topic-throughput/${detailType}`;
|
||
|
|
try {
|
||
|
|
const response = await axios.post(endpoint, {
|
||
|
|
...rest,
|
||
|
|
});
|
||
|
|
|
||
|
|
return {
|
||
|
|
statusCode: 200,
|
||
|
|
error: null,
|
||
|
|
message: response.data.status,
|
||
|
|
payload: response.data.data,
|
||
|
|
};
|
||
|
|
} catch (error) {
|
||
|
|
return ErrorResponseHandler((error as AxiosError) || SOMETHING_WENT_WRONG);
|
||
|
|
}
|
||
|
|
};
|