The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/docs/sources/packages_api/runtime/datasourcesrv.md

1.8 KiB

+++

-----------------------------------------------------------------------

Do not edit this file. It is automatically generated by API Documenter.

-----------------------------------------------------------------------

title = "DataSourceSrv" keywords = ["grafana","documentation","sdk","@grafana/runtime"] type = "docs" +++

DataSourceSrv interface

This is the entry point for communicating with a datasource that is added as a plugin (both external and internal). Via this service you will get access to the DataSourceApi that have a rich API for communicating with the datasource.

Signature

export interface DataSourceSrv 

Import

import { DataSourceSrv } from '@grafana/runtime';

Methods

Method Description
get(name, scopedVars)
getDataSourceSettingsByUid(uid) Returns metadata based on UID.

get method

Signature

get(name?: string | null, scopedVars?: ScopedVars): Promise<DataSourceApi>;

Parameters

Parameter Type Description
name string | null name of the datasource plugin you want to use.
scopedVars ScopedVars variables used to interpolate a templated passed as name.

Returns:

Promise<DataSourceApi>

getDataSourceSettingsByUid method

Returns metadata based on UID.

Signature

getDataSourceSettingsByUid(uid: string): DataSourceInstanceSettings | undefined;

Parameters

Parameter Type Description
uid string

Returns:

DataSourceInstanceSettings | undefined