Skip to content

Commit

Permalink
Merge remote-tracking branch 'grafana/master' into anno-regions
Browse files Browse the repository at this point in the history
* grafana/master:
  Login: Angular to React (grafana#18116)
  InfoTooltip: Info icon with tooltip (grafana#18478)
  Annotations: Fix failing annotation query when time series query is cancelled (grafana#18532)
  remotecache: support SSL with redis (grafana#18511)
  QueryData: Handle that response data must be array (grafana#18504)
  React: Rename deprecated UNSAFE_componentWillReceiveProps (grafana#18526)
  Explore: Replaces TimeSeries with GraphSeriesXY (grafana#18475)
  API: Restrict anonymous user information access (grafana#18422)
  • Loading branch information
ryantxu committed Aug 14, 2019
2 parents 3cc584a + 91a911b commit 5382ba0
Show file tree
Hide file tree
Showing 132 changed files with 10,023 additions and 6,346 deletions.
2 changes: 1 addition & 1 deletion conf/defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ type = database

# cache connectionstring options
# database: will use Grafana primary database.
# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0`. Only addr is required.
# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0,ssl=false`. Only addr is required. ssl may be 'true', 'false', or 'insecure'.
# memcache: 127.0.0.1:11211
connstr =

Expand Down
2 changes: 1 addition & 1 deletion conf/sample.ini
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@

# cache connectionstring options
# database: will use Grafana primary database.
# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0`. Only addr is required.
# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0,ssl=false`. Only addr is required. ssl may be 'true', 'false', or 'insecure'.
# memcache: 127.0.0.1:11211
;connstr =

Expand Down
42 changes: 42 additions & 0 deletions docs/sources/http_api/alerting_notification_channels.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,48 @@ Content-Type: application/json
```

## Get all notification channels (lookup)

Returns all notification channels, but with less detailed information.
Accessible by any authenticated user and is mainly used by providing
alert notification channels in Grafana UI when configuring alert rule.

`GET /api/alert-notifications/lookup`

**Example Request**:

```http
GET /api/alert-notifications/lookup HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```

**Example Response**:

```http
HTTP/1.1 200
Content-Type: application/json
[
{
"id": 1,
"uid": "000000001",
"name": "Test",
"type": "email",
"isDefault": false
},
{
"id": 2,
"uid": "000000002",
"name": "Slack",
"type": "slack",
"isDefault": false
}
]
```

## Get notification channel by uid

`GET /api/alert-notifications/uid/:uid`
Expand Down
49 changes: 44 additions & 5 deletions docs/sources/http_api/org.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ Content-Type: application/json

`GET /api/org/users`

Returns all org users within the current organization.
Accessible to users with org admin role.

**Example Request**:

```http
Expand All @@ -64,11 +67,47 @@ Content-Type: application/json
[
{
"orgId":1,
"userId":1,
"email":"admin@mygraf.com",
"login":"admin",
"role":"Admin"
"orgId": 1,
"userId": 1,
"email": "admin@localhost",
"avatarUrl": "/avatar/46d229b033af06a191ff2267bca9ae56",
"login": "admin",
"role": "Admin",
"lastSeenAt": "2019-08-09T11:02:49+02:00",
"lastSeenAtAge": "< 1m"
}
]
```

### Get all users within the current organization (lookup)

`GET /api/org/users/lookup`

Returns all org users within the current organization, but with less detailed information.
Accessible to users with org admin role, admin in any folder or admin of any team.
Mainly used by Grafana UI for providing list of users when adding team members and
when editing folder/dashboard permissions.

**Example Request**:

```http
GET /api/org/users/lookup HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```

**Example Response**:

```http
HTTP/1.1 200
Content-Type: application/json
[
{
"userId": 1,
"login": "admin",
"avatarUrl": "/avatar/46d229b033af06a191ff2267bca9ae56"
}
]
```
Expand Down
21 changes: 18 additions & 3 deletions docs/sources/installation/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,24 @@ Either `redis`, `memcached` or `database` default is `database`

### connstr

The remote cache connection string. Leave empty when using `database` since it will use the primary database.
Redis example config: `addr=127.0.0.1:6379,pool_size=100,db=grafana`
Memcache example: `127.0.0.1:11211`
The remote cache connection string. The format depends on the `type` of the remote cache.

#### Database

Leave empty when using `database` since it will use the primary database.

#### Redis

Example connstr: `addr=127.0.0.1:6379,pool_size=100,db=0,ssl=false`

- `addr` is the host `:` port of the redis server.
- `pool_size` (optional) is the number of underlying connections that can be made to redis.
- `db` (optional) is the number indentifer of the redis database you want to use.
- `ssl` (optional) is if SSL should be used to connect to redis server. The value may be `true`, `false`, or `insecure`. Setting the value to `insecure` skips verification of the certificate chain and hostname when making the connection.

#### Memcache

Example connstr: `127.0.0.1:11211`

<hr />

Expand Down
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ require (
github.com/onsi/gomega v1.5.0 // indirect
github.com/opentracing/opentracing-go v1.1.0
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pkg/errors v0.8.1 // indirect
github.com/pkg/errors v0.8.1
github.com/prometheus/client_golang v0.9.2
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
github.com/prometheus/common v0.2.0
Expand Down Expand Up @@ -80,12 +80,11 @@ require (
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
gopkg.in/bufio.v1 v1.0.0-20140618132640-567b2bfa514e // indirect
gopkg.in/ini.v1 v1.42.0
gopkg.in/ldap.v3 v3.0.2
gopkg.in/macaron.v1 v1.3.2
gopkg.in/mail.v2 v2.3.1
gopkg.in/redis.v2 v2.3.2
gopkg.in/redis.v5 v5.2.9
gopkg.in/square/go-jose.v2 v2.3.0
gopkg.in/yaml.v2 v2.2.2
)
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gG
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk=
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d h1:TxyelI5cVkbREznMhfzycHdkp5cLA7DpE+GKjSslYhM=
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw=
gopkg.in/bufio.v1 v1.0.0-20140618132640-567b2bfa514e h1:wGA78yza6bu/mWcc4QfBuIEHEtc06xdiU0X8sY36yUU=
gopkg.in/bufio.v1 v1.0.0-20140618132640-567b2bfa514e/go.mod h1:xsQCaysVCudhrYTfzYWe577fCe7Ceci+6qjO2Rdc0Z4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand All @@ -284,8 +282,8 @@ gopkg.in/macaron.v1 v1.3.2 h1:AvWIaPmwBUA87/OWzePkoxeaw6YJWDfBt1pDFPBnLf8=
gopkg.in/macaron.v1 v1.3.2/go.mod h1:PrsiawTWAGZs6wFbT5hlr7SQ2Ns9h7cUVtcUu4lQOVo=
gopkg.in/mail.v2 v2.3.1 h1:WYFn/oANrAGP2C0dcV6/pbkPzv8yGzqTjPmTeO7qoXk=
gopkg.in/mail.v2 v2.3.1/go.mod h1:htwXN1Qh09vZJ1NVKxQqHPBaCBbzKhp5GzuJEA4VJWw=
gopkg.in/redis.v2 v2.3.2 h1:GPVIIB/JnL1wvfULefy3qXmPu1nfNu2d0yA09FHgwfs=
gopkg.in/redis.v2 v2.3.2/go.mod h1:4wl9PJ/CqzeHk3LVq1hNLHH8krm3+AXEgut4jVc++LU=
gopkg.in/redis.v5 v5.2.9 h1:MNZYOLPomQzZMfpN3ZtD1uyJ2IDonTTlxYiV/pEApiw=
gopkg.in/redis.v5 v5.2.9/go.mod h1:6gtv0/+A4iM08kdRfocWYB3bLX2tebpNtfKlFT6H4mY=
gopkg.in/square/go-jose.v2 v2.3.0 h1:nLzhkFyl5bkblqYBoiWJUt5JkWOzmiaBtCxdJAqJd3U=
gopkg.in/square/go-jose.v2 v2.3.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/stretchr/testify.v1 v1.2.2/go.mod h1:QI5V/q6UbPmuhtm10CaFZxED9NreB8PnFYN9JcR6TxU=
Expand Down
8 changes: 7 additions & 1 deletion packages/grafana-data/src/types/graph.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { DisplayValue } from './displayValue';

export interface YAxis {
index: number;
min?: number;
tickDecimals?: number;
}

export type GraphSeriesValue = number | null;

/** View model projection of a series */
Expand All @@ -9,7 +15,7 @@ export interface GraphSeriesXY {
data: GraphSeriesValue[][]; // [x,y][]
info?: DisplayValue[]; // Legend info
isVisible: boolean;
yAxis: number;
yAxis: YAxis;
}

export interface CreatePlotOverlay {
Expand Down
5 changes: 3 additions & 2 deletions packages/grafana-data/src/types/logs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Labels, TimeSeries } from './data';
import { Labels } from './data';
import { GraphSeriesXY } from './graph';

/**
* Mapping of log level abbreviation to canonical log level.
Expand Down Expand Up @@ -54,7 +55,7 @@ export interface LogsModel {
hasUniqueLabels: boolean;
meta?: LogsMetaItem[];
rows: LogRowModel[];
series?: TimeSeries[];
series?: GraphSeriesXY[];
}

export interface LogSearchMatch {
Expand Down
22 changes: 21 additions & 1 deletion packages/grafana-data/src/utils/processDataFrame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import isString from 'lodash/isString';
import isBoolean from 'lodash/isBoolean';

// Types
import { DataFrame, Field, TimeSeries, FieldType, TableData, Column } from '../types/index';
import { DataFrame, Field, TimeSeries, FieldType, TableData, Column, GraphSeriesXY } from '../types/index';
import { isDateTime } from './moment_wrapper';

function convertTableToDataFrame(table: TableData): DataFrame {
Expand Down Expand Up @@ -44,6 +44,23 @@ function convertTimeSeriesToDataFrame(timeSeries: TimeSeries): DataFrame {
};
}

function convertGraphSeriesToDataFrame(graphSeries: GraphSeriesXY): DataFrame {
return {
name: graphSeries.label,
fields: [
{
name: graphSeries.label || 'Value',
},
{
name: 'Time',
type: FieldType.time,
unit: 'dateTimeAsIso',
},
],
rows: graphSeries.data,
};
}

// PapaParse Dynamic Typing regex:
// https://github.com/mholt/PapaParse/blob/master/papaparse.js#L998
const NUMBER = /^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i;
Expand Down Expand Up @@ -145,6 +162,9 @@ export const toDataFrame = (data: any): DataFrame => {
if (data.hasOwnProperty('datapoints')) {
return convertTimeSeriesToDataFrame(data);
}
if (data.hasOwnProperty('data')) {
return convertGraphSeriesToDataFrame(data);
}
if (data.hasOwnProperty('columns')) {
return convertTableToDataFrame(data);
}
Expand Down
Loading

0 comments on commit 5382ba0

Please sign in to comment.