import { DataSourcePluginOptionsEditorProps, onUpdateDatasourceJsonDataOptionChecked, SelectableValue, updateDatasourcePluginJsonDataOption, } from '@grafana/data'; import { EventsWithValidation, InlineFormLabel, LegacyForms, regexValidation } from '@grafana/ui'; import React, { SyntheticEvent } from 'react'; import { PromOptions } from '../types'; import { ExemplarsSettings } from './ExemplarsSettings'; const { Select, Input, FormField, Switch } = LegacyForms; const httpOptions = [ { value: 'POST', label: 'POST' }, { value: 'GET', label: 'GET' }, ]; type Props = Pick, 'options' | 'onOptionsChange'>; export const PromSettings = (props: Props) => { const { options, onOptionsChange } = props; /** * We want to change the default httpMethod to 'POST' for all of the new Prometheus data sources instances (no url) added in 7.5+. * We are explicitly adding httpMethod, as previously it could be undefined and defaulted to 'GET'. * Undefined httpMethod is still going to be considered 'GET' for backward compatibility reasons, but if users open data * source settings it is going to be set to 'GET' explicitly and it will be selected in httpMethod dropdown as 'GET'. * */ if (!options.jsonData.httpMethod) { options.url ? (options.jsonData.httpMethod = 'GET') : (options.jsonData.httpMethod = 'POST'); } return ( <>
} tooltip="Set this to the typical scrape and evaluation interval configured in Prometheus. Defaults to 15s." />
} tooltip="Set the Prometheus query timeout." />
HTTP Method