Commit d1feaaf4 by Torkel Ödegaard

Merge branch 'v4.0.x'

parents 1b681169 ab07667b
...@@ -15,12 +15,13 @@ ...@@ -15,12 +15,13 @@
### Bugfixes ### Bugfixes
* **Alerting**: Add alert message to webhook notifications [#6807](https://github.com/grafana/grafana/issues/6807) * **Alerting**: Add alert message to webhook notifications [#6807](https://github.com/grafana/grafana/issues/6807)
* **PNG Rendering**: Fix for server side rendering when using non default http addr bind and domain setting [#6813](https://github.com/grafana/grafana/issues/6813)
# 4.0.1 (2016-12-02) # 4.0.1 (2016-12-02)
> **Notice** > **Notice**
4.0.0 had serious connection pooling issue when using a data source in proxy access. This bug caused lots of resource issues 4.0.0 had serious connection pooling issue when using a data source in proxy access. This bug caused lots of resource issues
due to too many connections/file handles on the data source backend. This problem is fixed in this release. due to too many connections/file handles on the data source backend. This problem is fixed in this release.
### Bugfixes ### Bugfixes
* **Metrics**: Fixes nil pointer dereference on my arm build [#6749](https://github.com/grafana/grafana/issues/6749) * **Metrics**: Fixes nil pointer dereference on my arm build [#6749](https://github.com/grafana/grafana/issues/6749)
......
#! /usr/bin/env bash #! /usr/bin/env bash
deb_ver=4.0.0-1480439068
deb_ver=3.1.1-1470047149 rpm_ver=4.0.0-1480439068
rpm_ver=3.1.1-1470047149
wget https://grafanarel.s3.amazonaws.com/builds/grafana_${deb_ver}_amd64.deb wget https://grafanarel.s3.amazonaws.com/builds/grafana_${deb_ver}_amd64.deb
......
...@@ -35,12 +35,12 @@ func RenderToPng(params *RenderOpts) (string, error) { ...@@ -35,12 +35,12 @@ func RenderToPng(params *RenderOpts) (string, error) {
executable = executable + ".exe" executable = executable + ".exe"
} }
localAddress := "localhost" localDomain := "localhost"
if setting.HttpAddr != setting.DEFAULT_HTTP_ADDR { if setting.HttpAddr != setting.DEFAULT_HTTP_ADDR {
localAddress = setting.HttpAddr localDomain = setting.HttpAddr
} }
url := fmt.Sprintf("%s://%s:%s/%s", setting.Protocol, localAddress, setting.HttpPort, params.Path) url := fmt.Sprintf("%s://%s:%s/%s", setting.Protocol, localDomain, setting.HttpPort, params.Path)
binPath, _ := filepath.Abs(filepath.Join(setting.PhantomDir, executable)) binPath, _ := filepath.Abs(filepath.Join(setting.PhantomDir, executable))
scriptPath, _ := filepath.Abs(filepath.Join(setting.PhantomDir, "render.js")) scriptPath, _ := filepath.Abs(filepath.Join(setting.PhantomDir, "render.js"))
...@@ -57,7 +57,7 @@ func RenderToPng(params *RenderOpts) (string, error) { ...@@ -57,7 +57,7 @@ func RenderToPng(params *RenderOpts) (string, error) {
"width=" + params.Width, "width=" + params.Width,
"height=" + params.Height, "height=" + params.Height,
"png=" + pngPath, "png=" + pngPath,
"domain=" + setting.Domain, "domain=" + localDomain,
"renderKey=" + renderKey, "renderKey=" + renderKey,
} }
......
...@@ -6,7 +6,6 @@ import ( ...@@ -6,7 +6,6 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"time"
"golang.org/x/net/context/ctxhttp" "golang.org/x/net/context/ctxhttp"
...@@ -22,8 +21,10 @@ type Webhook struct { ...@@ -22,8 +21,10 @@ type Webhook struct {
HttpMethod string HttpMethod string
} }
var webhookQueue chan *Webhook var (
var webhookLog log.Logger webhookQueue chan *Webhook
webhookLog log.Logger
)
func initWebhookQueue() { func initWebhookQueue() {
webhookLog = log.New("notifications.webhook") webhookLog = log.New("notifications.webhook")
...@@ -47,24 +48,22 @@ func processWebhookQueue() { ...@@ -47,24 +48,22 @@ func processWebhookQueue() {
func sendWebRequestSync(ctx context.Context, webhook *Webhook) error { func sendWebRequestSync(ctx context.Context, webhook *Webhook) error {
webhookLog.Debug("Sending webhook", "url", webhook.Url, "http method", webhook.HttpMethod) webhookLog.Debug("Sending webhook", "url", webhook.Url, "http method", webhook.HttpMethod)
client := &http.Client{
Timeout: time.Duration(10 * time.Second),
}
if webhook.HttpMethod == "" { if webhook.HttpMethod == "" {
webhook.HttpMethod = http.MethodPost webhook.HttpMethod = http.MethodPost
} }
request, err := http.NewRequest(webhook.HttpMethod, webhook.Url, bytes.NewReader([]byte(webhook.Body))) request, err := http.NewRequest(webhook.HttpMethod, webhook.Url, bytes.NewReader([]byte(webhook.Body)))
if webhook.User != "" && webhook.Password != "" {
request.Header.Add("Authorization", util.GetBasicAuthHeader(webhook.User, webhook.Password))
}
if err != nil { if err != nil {
return err return err
} }
resp, err := ctxhttp.Do(ctx, client, request) request.Header.Add("Content-Type", "application/json")
request.Header.Add("User-Agent", "Grafana")
if webhook.User != "" && webhook.Password != "" {
request.Header.Add("Authorization", util.GetBasicAuthHeader(webhook.User, webhook.Password))
}
resp, err := ctxhttp.Do(ctx, http.DefaultClient, request)
if err != nil { if err != nil {
return err return err
} }
...@@ -73,11 +72,11 @@ func sendWebRequestSync(ctx context.Context, webhook *Webhook) error { ...@@ -73,11 +72,11 @@ func sendWebRequestSync(ctx context.Context, webhook *Webhook) error {
return nil return nil
} }
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body) body, err := ioutil.ReadAll(resp.Body)
if err != nil { if err != nil {
return err return err
} }
defer resp.Body.Close()
webhookLog.Debug("Webhook failed", "statuscode", resp.Status, "body", string(body)) webhookLog.Debug("Webhook failed", "statuscode", resp.Status, "body", string(body))
return fmt.Errorf("Webhook response status %v", resp.Status) return fmt.Errorf("Webhook response status %v", resp.Status)
......
...@@ -5,5 +5,5 @@ _token=$1 ...@@ -5,5 +5,5 @@ _token=$1
curl \ curl \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-H "Authorization: Bearer ${_token}" \ -H "Authorization: Bearer ${_token}" \
-X POST -d '{ "accountName": "Torkeldegaard", "projectSlug": "grafana","branch": "master","environmentVariables": {}}' \ -X POST -d '{ "accountName": "Torkeldegaard", "projectSlug": "grafana","branch": "v4.0.x","environmentVariables": {}}' \
https://ci.appveyor.com/api/builds https://ci.appveyor.com/api/builds
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
phantom.addCookie({ phantom.addCookie({
'name': 'renderKey', 'name': 'renderKey',
'value': params.renderKey, 'value': params.renderKey,
'domain': 'localhost', 'domain': params.domain,
}); });
page.viewportSize = { page.viewportSize = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment