Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
9a94072c
Commit
9a94072c
authored
Sep 23, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:grafana/grafana
parents
175c651e
99c77e7d
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
46 additions
and
12 deletions
+46
-12
pkg/cmd/grafana-server/main.go
+2
-2
pkg/log/log.go
+16
-2
pkg/plugins/update_checker.go
+6
-4
pkg/services/sqlstore/alert.go
+1
-1
pkg/services/sqlstore/alert_notification.go
+2
-1
pkg/services/sqlstore/annotation.go
+1
-1
pkg/services/sqlstore/migrator/dialect.go
+1
-0
pkg/services/sqlstore/migrator/mysql_dialect.go
+4
-0
pkg/services/sqlstore/migrator/postgres_dialect.go
+4
-0
pkg/services/sqlstore/migrator/sqlite_dialect.go
+7
-0
pkg/tsdb/prometheus/prometheus.go
+1
-1
scripts/circle-test.sh
+1
-0
No files found.
pkg/cmd/grafana-server/main.go
View file @
9a94072c
...
...
@@ -56,7 +56,7 @@ func main() {
setting
.
BuildCommit
=
commit
setting
.
BuildStamp
=
buildstampInt64
go
listenToSystemSign
e
ls
()
go
listenToSystemSign
a
ls
()
flag
.
Parse
()
writePIDFile
()
...
...
@@ -116,7 +116,7 @@ func writePIDFile() {
}
}
func
listenToSystemSign
e
ls
()
{
func
listenToSystemSign
a
ls
()
{
signalChan
:=
make
(
chan
os
.
Signal
,
1
)
code
:=
0
...
...
pkg/log/log.go
View file @
9a94072c
...
...
@@ -32,11 +32,25 @@ func New(logger string, ctx ...interface{}) Logger {
}
func
Trace
(
format
string
,
v
...
interface
{})
{
Root
.
Debug
(
fmt
.
Sprintf
(
format
,
v
))
var
message
string
if
len
(
v
)
>
0
{
message
=
fmt
.
Sprintf
(
format
,
v
)
}
else
{
message
=
format
}
Root
.
Debug
(
message
)
}
func
Debug
(
format
string
,
v
...
interface
{})
{
Root
.
Debug
(
fmt
.
Sprintf
(
format
,
v
))
var
message
string
if
len
(
v
)
>
0
{
message
=
fmt
.
Sprintf
(
format
,
v
)
}
else
{
message
=
format
}
Root
.
Debug
(
message
)
}
func
Debug2
(
message
string
,
v
...
interface
{})
{
...
...
pkg/plugins/update_checker.go
View file @
9a94072c
...
...
@@ -11,6 +11,10 @@ import (
"github.com/grafana/grafana/pkg/setting"
)
var
(
httpClient
http
.
Client
=
http
.
Client
{
Timeout
:
time
.
Duration
(
10
*
time
.
Second
)}
)
type
GrafanaNetPlugin
struct
{
Slug
string
`json:"slug"`
Version
string
`json:"version"`
...
...
@@ -54,10 +58,8 @@ func getAllExternalPluginSlugs() string {
func
checkForUpdates
()
{
log
.
Trace
(
"Checking for updates"
)
client
:=
http
.
Client
{
Timeout
:
time
.
Duration
(
5
*
time
.
Second
)}
pluginSlugs
:=
getAllExternalPluginSlugs
()
resp
,
err
:=
c
lient
.
Get
(
"https://grafana.net/api/plugins/versioncheck?slugIn="
+
pluginSlugs
+
"&grafanaVersion="
+
setting
.
BuildVersion
)
resp
,
err
:=
httpC
lient
.
Get
(
"https://grafana.net/api/plugins/versioncheck?slugIn="
+
pluginSlugs
+
"&grafanaVersion="
+
setting
.
BuildVersion
)
if
err
!=
nil
{
log
.
Trace
(
"Failed to get plugins repo from grafana.net, %v"
,
err
.
Error
())
...
...
@@ -88,7 +90,7 @@ func checkForUpdates() {
}
}
resp2
,
err
:=
c
lient
.
Get
(
"https://raw.githubusercontent.com/grafana/grafana/master/latest.json"
)
resp2
,
err
:=
httpC
lient
.
Get
(
"https://raw.githubusercontent.com/grafana/grafana/master/latest.json"
)
if
err
!=
nil
{
log
.
Trace
(
"Failed to get latest.json repo from github: %v"
,
err
.
Error
())
return
...
...
pkg/services/sqlstore/alert.go
View file @
9a94072c
...
...
@@ -92,7 +92,7 @@ func HandleAlertsQuery(query *m.GetAlertsQuery) error {
params
=
append
(
params
,
query
.
Limit
)
}
sql
.
WriteString
(
"ORDER BY name ASC"
)
sql
.
WriteString
(
"
ORDER BY name ASC"
)
alerts
:=
make
([]
*
m
.
Alert
,
0
)
if
err
:=
x
.
Sql
(
sql
.
String
(),
params
...
)
.
Find
(
&
alerts
);
err
!=
nil
{
...
...
pkg/services/sqlstore/alert_notification.go
View file @
9a94072c
...
...
@@ -66,7 +66,8 @@ func GetAlertNotificationsToSend(query *m.GetAlertNotificationsToSendQuery) erro
sql
.
WriteString
(
` WHERE alert_notification.org_id = ?`
)
params
=
append
(
params
,
query
.
OrgId
)
sql
.
WriteString
(
` AND ((alert_notification.is_default = 1)`
)
sql
.
WriteString
(
` AND ((alert_notification.is_default = ?)`
)
params
=
append
(
params
,
dialect
.
BooleanStr
(
true
))
if
len
(
query
.
Ids
)
>
0
{
sql
.
WriteString
(
` OR alert_notification.id IN (?`
+
strings
.
Repeat
(
",?"
,
len
(
query
.
Ids
)
-
1
)
+
")"
)
for
_
,
v
:=
range
query
.
Ids
{
...
...
pkg/services/sqlstore/annotation.go
View file @
9a94072c
...
...
@@ -75,7 +75,7 @@ func (r *SqlAnnotationRepo) Find(query *annotations.ItemQuery) ([]*annotations.I
query
.
Limit
=
10
}
sql
.
WriteString
(
fmt
.
Sprintf
(
"ORDER BY epoch DESC LIMIT %v"
,
query
.
Limit
))
sql
.
WriteString
(
fmt
.
Sprintf
(
"
ORDER BY epoch DESC LIMIT %v"
,
query
.
Limit
))
items
:=
make
([]
*
annotations
.
Item
,
0
)
if
err
:=
x
.
Sql
(
sql
.
String
(),
params
...
)
.
Find
(
&
items
);
err
!=
nil
{
...
...
pkg/services/sqlstore/migrator/dialect.go
View file @
9a94072c
...
...
@@ -18,6 +18,7 @@ type Dialect interface {
SupportEngine
()
bool
LikeStr
()
string
Default
(
col
*
Column
)
string
BooleanStr
(
bool
)
string
CreateIndexSql
(
tableName
string
,
index
*
Index
)
string
CreateTableSql
(
table
*
Table
)
string
...
...
pkg/services/sqlstore/migrator/mysql_dialect.go
View file @
9a94072c
...
...
@@ -29,6 +29,10 @@ func (db *Mysql) AutoIncrStr() string {
return
"AUTO_INCREMENT"
}
func
(
db
*
Mysql
)
BooleanStr
(
value
bool
)
string
{
return
strconv
.
FormatBool
(
value
)
}
func
(
db
*
Mysql
)
SqlType
(
c
*
Column
)
string
{
var
res
string
switch
c
.
Type
{
...
...
pkg/services/sqlstore/migrator/postgres_dialect.go
View file @
9a94072c
...
...
@@ -36,6 +36,10 @@ func (db *Postgres) AutoIncrStr() string {
return
""
}
func
(
db
*
Postgres
)
BooleanStr
(
value
bool
)
string
{
return
strconv
.
FormatBool
(
value
)
}
func
(
b
*
Postgres
)
Default
(
col
*
Column
)
string
{
if
col
.
Type
==
DB_Bool
{
if
col
.
Default
==
"0"
{
...
...
pkg/services/sqlstore/migrator/sqlite_dialect.go
View file @
9a94072c
...
...
@@ -29,6 +29,13 @@ func (db *Sqlite3) AutoIncrStr() string {
return
"AUTOINCREMENT"
}
func
(
db
*
Sqlite3
)
BooleanStr
(
value
bool
)
string
{
if
value
{
return
"1"
}
return
"0"
}
func
(
db
*
Sqlite3
)
SqlType
(
c
*
Column
)
string
{
switch
c
.
Type
{
case
DB_Date
,
DB_DateTime
,
DB_TimeStamp
,
DB_Time
:
...
...
pkg/tsdb/prometheus/prometheus.go
View file @
9a94072c
package
prometheus
import
(
"context"
"fmt"
"net/http"
"regexp"
...
...
@@ -11,6 +10,7 @@ import (
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/tsdb"
"github.com/prometheus/client_golang/api/prometheus"
"golang.org/x/net/context"
pmodel
"github.com/prometheus/common/model"
)
...
...
scripts/circle-test.sh
100644 → 100755
View file @
9a94072c
...
...
@@ -25,6 +25,7 @@ exit_if_fail npm run coveralls
test
-z
"
$(
gofmt
-s
-l
./pkg/... | tee /dev/stderr
)
"
exit_if_fail go run build.go setup
exit_if_fail go run build.go build
exit_if_fail go vet ./pkg/...
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment