@datadog/vis-fetch
This package provides functions for fetching and transforming data from Datadog sources.
Install
yarn add @datadog/vis-fetch
Documentation and Demos
Visit our live demos page for current examples.
Usage
import { init } from "@datadog/ui-extensions-sdk";
import {
fetchMetrics,
metricsResponseToDataFrame,
} from "@datadog/vis-fetch";
const datadogClient = init();
const query = 'avg:system.cpu.user{*}';
const now = Date.now();
const timeframe = {
live: false,
start: now - 600
end: now
}
const rawResponse = fetchMetrics(query, timeframe, client);
const dataFrame = metricsResponseToDataFrame(rawResponse);