Skip to content

Commit 6375418

Browse files
committed
Merge branch 'alerting' into grafana-annotations
2 parents 4a2f2fb + 1264a1b commit 6375418

File tree

31 files changed

+381
-104
lines changed

31 files changed

+381
-104
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* **SingleStat**: Add seriename as option in singlestat panel, closes [#4740](https://github.com/grafana/grafana/issues/4740)
66
* **Localization**: Week start day now dependant on browser locale setting, closes [#3003](https://github.com/grafana/grafana/issues/3003)
77
* **Templating**: Update panel repeats for variables that change on time refresh, closes [#5021](https://github.com/grafana/grafana/issues/5021)
8+
* **Templating**: Add support for numeric and alphabetical sorting of variable values, closes [#2839](https://github.com/grafana/grafana/issues/2839)
89
* **Elasticsearch**: Support to set Precision Threshold for Unique Count metric, closes [#4689](https://github.com/grafana/grafana/issues/4689)
910
* **Navigation**: Add search to org swithcer, closes [#2609](https://github.com/grafana/grafana/issues/2609)
1011
* **Database**: Allow database config using one propertie, closes [#5456](https://github.com/grafana/grafana/pull/5456)
@@ -15,6 +16,9 @@
1516
### Breaking changes
1617
* **SystemD**: Change systemd description, closes [#5971](https://github.com/grafana/grafana/pull/5971)
1718

19+
### Bugfixes
20+
* **Table Panel**: Fixed problem when switching to Mixed datasource in metrics tab, fixes [#5999](https://github.com/grafana/grafana/pull/5999)
21+
1822
# 3.1.2 (unreleased)
1923
* **Templating**: Fixed issue when combining row & panel repeats, fixes [#5790](https://github.com/grafana/grafana/issues/5790)
2024
* **Drag&Drop**: Fixed issue with drag and drop in latest Chrome(51+), fixes [#5767](https://github.com/grafana/grafana/issues/5767)

conf/ldap.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ host = "127.0.0.1"
88
port = 389
99
# Set to true if ldap server supports TLS
1010
use_ssl = false
11+
# Set to true if connect ldap server with STARTTLS pattern (create connection in insecure, then upgrade to secure connection with TLS)
12+
start_tls = false
1113
# set to true if you want to skip ssl cert validation
1214
ssl_skip_verify = false
1315
# set to the path to your root CA certificate or leave unset to use system defaults

docs/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pages:
4242
- ['installation/performance.md', 'Installation', 'Performance Tips']
4343
- ['installation/troubleshooting.md', 'Installation', 'Troubleshooting']
4444
- ['installation/migrating_to2.md', 'Installation', 'Migrating from v1.x to v2.x']
45+
- ['installation/behind_proxy.md', 'Installation', 'Grafana behind reverse proxy']
4546

4647
- ['guides/basic_concepts.md', 'User Guides', 'Basic Concepts']
4748
- ['guides/gettingstarted.md', 'User Guides', 'Getting Started']
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
page_title: Running Grafana behind a reverse proxy
3+
page_description: Guide for running Grafana behind a reverse proxy
4+
page_keywords: Grafana, reverse proxy, nginx, haproxy
5+
---
6+
7+
# Running Grafana behind a reverse proxy
8+
9+
It should be straight forward to get Grafana up and running behind a reverse proxy. But here are some things that you might run into.
10+
11+
Links and redirects will not be rendered correctly unless you set the server.domain setting.
12+
```
13+
[server]
14+
domain = foo.bar
15+
```
16+
17+
To use sub *path* ex `http://foo.bar/grafana` make sure to include `/grafana` in the end of root_url.
18+
Otherwise Grafana will not behave correctly. See example below.
19+
20+
# Examples
21+
Here are some example configurations for running Grafana behind a reverse proxy.
22+
23+
## Grafana configuration (ex http://foo.bar.com)
24+
```
25+
[server]
26+
domain = foo.bar
27+
```
28+
29+
## Nginx configuration
30+
```
31+
server {
32+
listen 80;
33+
root /usr/share/nginx/www;
34+
index index.html index.htm;
35+
36+
location / {
37+
proxy_pass http://localhost:3000/;
38+
}
39+
}
40+
```
41+
42+
# Examples with **sub path** (ex http://foo.bar.com/grafana)
43+
44+
## Grafana configuration with sub path
45+
```
46+
[server]
47+
domain = foo.bar
48+
root_url = %(protocol)s://%(domain)s:/grafana
49+
```
50+
51+
## Nginx configuration with sub path
52+
```
53+
server {
54+
listen 80;
55+
root /usr/share/nginx/www;
56+
index index.html index.htm;
57+
58+
location /grafana/ {
59+
proxy_pass http://localhost:3000/;
60+
}
61+
}
62+
```
63+
64+

docs/sources/installation/ldap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ host = "127.0.0.1"
2727
port = 389
2828
# Set to true if ldap server supports TLS
2929
use_ssl = false
30+
# Set to true if connect ldap server with STARTTLS pattern (create connection in insecure, then upgrade to secure connection with TLS)
31+
start_tls = false
3032
# set to true if you want to skip ssl cert validation
3133
ssl_skip_verify = false
3234
# set to the path to your root CA certificate or leave unset to use system defaults

pkg/api/cloudwatch/metrics.go

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,29 @@ func init() {
6767
"CoreNodesRunning", "CoreNodesPending", "LiveDataNodes", "MRTotalNodes", "MRActiveNodes", "MRLostNodes", "MRUnhealthyNodes", "MRDecommissionedNodes", "MRRebootedNodes",
6868
"S3BytesWritten", "S3BytesRead", "HDFSUtilization", "HDFSBytesRead", "HDFSBytesWritten", "MissingBlocks", "CorruptBlocks", "TotalLoad", "MemoryTotalMB", "MemoryReservedMB", "MemoryAvailableMB", "MemoryAllocatedMB", "PendingDeletionBlocks", "UnderReplicatedBlocks", "DfsPendingReplicationBlocks", "CapacityRemainingGB",
6969
"HbaseBackupFailed", "MostRecentBackupDuration", "TimeSinceLastSuccessfulBackup"},
70-
"AWS/ES": {"ClusterStatus.green", "ClusterStatus.yellow", "ClusterStatus.red", "Nodes", "SearchableDocuments", "DeletedDocuments", "CPUUtilization", "FreeStorageSpace", "JVMMemoryPressure", "AutomatedSnapshotFailure", "MasterCPUUtilization", "MasterFreeStorageSpace", "MasterJVMMemoryPressure", "ReadLatency", "WriteLatency", "ReadThroughput", "WriteThroughput", "DiskQueueLength", "ReadIOPS", "WriteIOPS"},
71-
"AWS/Events": {"Invocations", "FailedInvocations", "TriggeredRules", "MatchedEvents", "ThrottledRules"},
72-
"AWS/Kinesis": {"GetRecords.Bytes", "GetRecords.IteratorAge", "GetRecords.IteratorAgeMilliseconds", "GetRecords.Latency", "GetRecords.Records", "GetRecords.Success", "IncomingBytes", "IncomingRecords", "PutRecord.Bytes", "PutRecord.Latency", "PutRecord.Success", "PutRecords.Bytes", "PutRecords.Latency", "PutRecords.Records", "PutRecords.Success", "ReadProvisionedThroughputExceeded", "WriteProvisionedThroughputExceeded", "IteratorAgeMilliseconds", "OutgoingBytes", "OutgoingRecords"},
73-
"AWS/Lambda": {"Invocations", "Errors", "Duration", "Throttles"},
74-
"AWS/Logs": {"IncomingBytes", "IncomingLogEvents", "ForwardedBytes", "ForwardedLogEvents", "DeliveryErrors", "DeliveryThrottling"},
75-
"AWS/ML": {"PredictCount", "PredictFailureCount"},
76-
"AWS/OpsWorks": {"cpu_idle", "cpu_nice", "cpu_system", "cpu_user", "cpu_waitio", "load_1", "load_5", "load_15", "memory_buffers", "memory_cached", "memory_free", "memory_swap", "memory_total", "memory_used", "procs"},
77-
"AWS/Redshift": {"CPUUtilization", "DatabaseConnections", "HealthStatus", "MaintenanceMode", "NetworkReceiveThroughput", "NetworkTransmitThroughput", "PercentageDiskSpaceUsed", "ReadIOPS", "ReadLatency", "ReadThroughput", "WriteIOPS", "WriteLatency", "WriteThroughput"},
78-
"AWS/RDS": {"BinLogDiskUsage", "CPUUtilization", "CPUCreditUsage", "CPUCreditBalance", "DatabaseConnections", "DiskQueueDepth", "FreeableMemory", "FreeStorageSpace", "ReplicaLag", "SwapUsage", "ReadIOPS", "WriteIOPS", "ReadLatency", "WriteLatency", "ReadThroughput", "WriteThroughput", "NetworkReceiveThroughput", "NetworkTransmitThroughput"},
79-
"AWS/Route53": {"HealthCheckStatus", "HealthCheckPercentageHealthy", "ConnectionTime", "SSLHandshakeTime", "TimeToFirstByte"},
80-
"AWS/S3": {"BucketSizeBytes", "NumberOfObjects"},
81-
"AWS/SNS": {"NumberOfMessagesPublished", "PublishSize", "NumberOfNotificationsDelivered", "NumberOfNotificationsFailed"},
82-
"AWS/SQS": {"NumberOfMessagesSent", "SentMessageSize", "NumberOfMessagesReceived", "NumberOfEmptyReceives", "NumberOfMessagesDeleted", "ApproximateNumberOfMessagesDelayed", "ApproximateNumberOfMessagesVisible", "ApproximateNumberOfMessagesNotVisible"},
70+
"AWS/ES": {"ClusterStatus.green", "ClusterStatus.yellow", "ClusterStatus.red", "Nodes", "SearchableDocuments", "DeletedDocuments", "CPUUtilization", "FreeStorageSpace", "JVMMemoryPressure", "AutomatedSnapshotFailure", "MasterCPUUtilization", "MasterFreeStorageSpace", "MasterJVMMemoryPressure", "ReadLatency", "WriteLatency", "ReadThroughput", "WriteThroughput", "DiskQueueLength", "ReadIOPS", "WriteIOPS"},
71+
"AWS/Events": {"Invocations", "FailedInvocations", "TriggeredRules", "MatchedEvents", "ThrottledRules"},
72+
"AWS/Firehose": {"DeliveryToElasticsearch.Bytes", "DeliveryToElasticsearch.Records", "DeliveryToElasticsearch.Success", "DeliveryToRedshift.Bytes", "DeliveryToRedshift.Records", "DeliveryToRedshift.Success", "DeliveryToS3.Bytes", "DeliveryToS3.DataFreshness", "DeliveryToS3.Records", "DeliveryToS3.Success", "IncomingBytes", "IncomingRecords", "DescribeDeliveryStream.Latency", "DescribeDeliveryStream.Requests", "ListDeliveryStreams.Latency", "ListDeliveryStreams.Requests", "PutRecord.Bytes", "PutRecord.Latency", "PutRecord.Requests", "PutRecordBatch.Bytes", "PutRecordBatch.Latency", "PutRecordBatch.Records", "PutRecordBatch.Requests", "UpdateDeliveryStream.Latency", "UpdateDeliveryStream.Requests"},
73+
"AWS/IoT": {"PublishIn.Success", "PublishOut.Success", "Subscribe.Success", "Ping.Success", "Connect.Success", "GetThingShadow.Accepted"},
74+
"AWS/Kinesis": {"GetRecords.Bytes", "GetRecords.IteratorAge", "GetRecords.IteratorAgeMilliseconds", "GetRecords.Latency", "GetRecords.Records", "GetRecords.Success", "IncomingBytes", "IncomingRecords", "PutRecord.Bytes", "PutRecord.Latency", "PutRecord.Success", "PutRecords.Bytes", "PutRecords.Latency", "PutRecords.Records", "PutRecords.Success", "ReadProvisionedThroughputExceeded", "WriteProvisionedThroughputExceeded", "IteratorAgeMilliseconds", "OutgoingBytes", "OutgoingRecords"},
75+
"AWS/KinesisAnalytics": {"Bytes", "MillisBehindLatest", "Records", "Success"},
76+
"AWS/Lambda": {"Invocations", "Errors", "Duration", "Throttles"},
77+
"AWS/Logs": {"IncomingBytes", "IncomingLogEvents", "ForwardedBytes", "ForwardedLogEvents", "DeliveryErrors", "DeliveryThrottling"},
78+
"AWS/ML": {"PredictCount", "PredictFailureCount"},
79+
"AWS/OpsWorks": {"cpu_idle", "cpu_nice", "cpu_system", "cpu_user", "cpu_waitio", "load_1", "load_5", "load_15", "memory_buffers", "memory_cached", "memory_free", "memory_swap", "memory_total", "memory_used", "procs"},
80+
"AWS/Redshift": {"CPUUtilization", "DatabaseConnections", "HealthStatus", "MaintenanceMode", "NetworkReceiveThroughput", "NetworkTransmitThroughput", "PercentageDiskSpaceUsed", "ReadIOPS", "ReadLatency", "ReadThroughput", "WriteIOPS", "WriteLatency", "WriteThroughput"},
81+
"AWS/RDS": {"BinLogDiskUsage", "CPUUtilization", "CPUCreditUsage", "CPUCreditBalance", "DatabaseConnections", "DiskQueueDepth", "FreeableMemory", "FreeStorageSpace", "ReplicaLag", "SwapUsage", "ReadIOPS", "WriteIOPS", "ReadLatency", "WriteLatency", "ReadThroughput", "WriteThroughput", "NetworkReceiveThroughput", "NetworkTransmitThroughput"},
82+
"AWS/Route53": {"HealthCheckStatus", "HealthCheckPercentageHealthy", "ConnectionTime", "SSLHandshakeTime", "TimeToFirstByte"},
83+
"AWS/S3": {"BucketSizeBytes", "NumberOfObjects"},
84+
"AWS/SNS": {"NumberOfMessagesPublished", "PublishSize", "NumberOfNotificationsDelivered", "NumberOfNotificationsFailed"},
85+
"AWS/SQS": {"NumberOfMessagesSent", "SentMessageSize", "NumberOfMessagesReceived", "NumberOfEmptyReceives", "NumberOfMessagesDeleted", "ApproximateNumberOfMessagesDelayed", "ApproximateNumberOfMessagesVisible", "ApproximateNumberOfMessagesNotVisible"},
8386
"AWS/StorageGateway": {"CacheHitPercent", "CachePercentUsed", "CachePercentDirty", "CloudBytesDownloaded", "CloudDownloadLatency", "CloudBytesUploaded", "UploadBufferFree", "UploadBufferPercentUsed", "UploadBufferUsed", "QueuedWrites", "ReadBytes", "ReadTime", "TotalCacheSize", "WriteBytes", "WriteTime", "TimeSinceLastRecoveryPoint", "WorkingStorageFree", "WorkingStoragePercentUsed", "WorkingStorageUsed",
8487
"CacheHitPercent", "CachePercentUsed", "CachePercentDirty", "ReadBytes", "ReadTime", "WriteBytes", "WriteTime", "QueuedWrites"},
8588
"AWS/SWF": {"DecisionTaskScheduleToStartTime", "DecisionTaskStartToCloseTime", "DecisionTasksCompleted", "StartedDecisionTasksTimedOutOnClose", "WorkflowStartToCloseTime", "WorkflowsCanceled", "WorkflowsCompleted", "WorkflowsContinuedAsNew", "WorkflowsFailed", "WorkflowsTerminated", "WorkflowsTimedOut",
8689
"ActivityTaskScheduleToCloseTime", "ActivityTaskScheduleToStartTime", "ActivityTaskStartToCloseTime", "ActivityTasksCanceled", "ActivityTasksCompleted", "ActivityTasksFailed", "ScheduledActivityTasksTimedOutOnClose", "ScheduledActivityTasksTimedOutOnStart", "StartedActivityTasksTimedOutOnClose", "StartedActivityTasksTimedOutOnHeartbeat"},
8790
"AWS/WAF": {"AllowedRequests", "BlockedRequests", "CountedRequests"},
8891
"AWS/WorkSpaces": {"Available", "Unhealthy", "ConnectionAttempt", "ConnectionSuccess", "ConnectionFailure", "SessionLaunchTime", "InSessionLatency", "SessionDisconnect"},
92+
"KMS": {"SecondsUntilKeyMaterialExpiration"},
8993
}
9094
dimensionsMap = map[string][]string{
9195
"AWS/ApiGateway": {"ApiName", "Method", "Resource", "Stage"},
@@ -106,7 +110,10 @@ func init() {
106110
"AWS/ElasticMapReduce": {"ClusterId", "JobFlowId", "JobId"},
107111
"AWS/ES": {"ClientId", "DomainName"},
108112
"AWS/Events": {"RuleName"},
113+
"AWS/Firehose": {},
114+
"AWS/IoT": {"Protocol"},
109115
"AWS/Kinesis": {"StreamName", "ShardID"},
116+
"AWS/KinesisAnalytics": {"Flow", "Id", "Application"},
110117
"AWS/Lambda": {"FunctionName", "Resource", "Version", "Alias"},
111118
"AWS/Logs": {"LogGroupName", "DestinationType", "FilterName"},
112119
"AWS/ML": {"MLModelId", "RequestMode"},
@@ -121,6 +128,7 @@ func init() {
121128
"AWS/SWF": {"Domain", "WorkflowTypeName", "WorkflowTypeVersion", "ActivityTypeName", "ActivityTypeVersion"},
122129
"AWS/WAF": {"Rule", "WebACL"},
123130
"AWS/WorkSpaces": {"DirectoryId", "WorkspaceId"},
131+
"KMS": {"KeyId"},
124132
}
125133

126134
customMetricsMetricsMap = make(map[string]map[string]map[string]*CustomMetricsCache)

pkg/api/common.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"encoding/json"
55
"net/http"
66

7-
"github.com/grafana/grafana/pkg/metrics"
87
"github.com/grafana/grafana/pkg/middleware"
98
"github.com/grafana/grafana/pkg/setting"
109
"gopkg.in/macaron.v1"
@@ -88,10 +87,8 @@ func ApiError(status int, message string, err error) *NormalResponse {
8887

8988
switch status {
9089
case 404:
91-
metrics.M_Api_Status_404.Inc(1)
9290
data["message"] = "Not Found"
9391
case 500:
94-
metrics.M_Api_Status_500.Inc(1)
9592
data["message"] = "Internal Server Error"
9693
}
9794

pkg/cmd/grafana-server/web.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func newMacaron() *macaron.Macaron {
5353

5454
m.Use(middleware.GetContextHandler())
5555
m.Use(middleware.Sessioner(&setting.SessionOptions))
56+
m.Use(middleware.RequestMetrics())
5657

5758
return m
5859
}

pkg/login/ldap.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,16 @@ func (a *ldapAuther) Dial() error {
4848
ServerName: host,
4949
RootCAs: certPool,
5050
}
51-
a.conn, err = ldap.DialTLS("tcp", address, tlsCfg)
51+
if a.server.StartTLS {
52+
a.conn, err = ldap.Dial("tcp", address)
53+
if err == nil {
54+
if err = a.conn.StartTLS(tlsCfg); err == nil {
55+
return nil
56+
}
57+
}
58+
} else {
59+
a.conn, err = ldap.DialTLS("tcp", address, tlsCfg)
60+
}
5261
} else {
5362
a.conn, err = ldap.Dial("tcp", address)
5463
}

pkg/login/settings.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type LdapServerConf struct {
1919
Host string `toml:"host"`
2020
Port int `toml:"port"`
2121
UseSSL bool `toml:"use_ssl"`
22+
StartTLS bool `toml:"start_tls"`
2223
SkipVerifySSL bool `toml:"ssl_skip_verify"`
2324
RootCACert string `toml:"root_ca_cert"`
2425
BindDN string `toml:"bind_dn"`

pkg/metrics/metrics.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,15 @@ var (
1313
M_Page_Status_200 Counter
1414
M_Page_Status_500 Counter
1515
M_Page_Status_404 Counter
16-
M_Api_Status_500 Counter
16+
M_Page_Status_Unknown Counter
17+
M_Api_Status_200 Counter
1718
M_Api_Status_404 Counter
19+
M_Api_Status_500 Counter
20+
M_Api_Status_Unknown Counter
21+
M_Proxy_Status_200 Counter
22+
M_Proxy_Status_404 Counter
23+
M_Proxy_Status_500 Counter
24+
M_Proxy_Status_Unknown Counter
1825
M_Api_User_SignUpStarted Counter
1926
M_Api_User_SignUpCompleted Counter
2027
M_Api_User_SignUpInvite Counter
@@ -54,9 +61,17 @@ func initMetricVars(settings *MetricSettings) {
5461
M_Page_Status_200 = RegCounter("page.resp_status", "code", "200")
5562
M_Page_Status_500 = RegCounter("page.resp_status", "code", "500")
5663
M_Page_Status_404 = RegCounter("page.resp_status", "code", "404")
64+
M_Page_Status_Unknown = RegCounter("page.resp_status", "code", "unknown")
5765

58-
M_Api_Status_500 = RegCounter("api.resp_status", "code", "500")
66+
M_Api_Status_200 = RegCounter("api.resp_status", "code", "200")
5967
M_Api_Status_404 = RegCounter("api.resp_status", "code", "404")
68+
M_Api_Status_500 = RegCounter("api.resp_status", "code", "500")
69+
M_Api_Status_Unknown = RegCounter("api.resp_status", "code", "unknown")
70+
71+
M_Proxy_Status_200 = RegCounter("proxy.resp_status", "code", "200")
72+
M_Proxy_Status_404 = RegCounter("proxy.resp_status", "code", "404")
73+
M_Proxy_Status_500 = RegCounter("proxy.resp_status", "code", "500")
74+
M_Proxy_Status_Unknown = RegCounter("proxy.resp_status", "code", "unknown")
6075

6176
M_Api_User_SignUpStarted = RegCounter("api.user.signup_started")
6277
M_Api_User_SignUpCompleted = RegCounter("api.user.signup_completed")

pkg/middleware/logger.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ func Logger() macaron.Handler {
4949
if ctx, ok := c.Data["ctx"]; ok {
5050
ctxTyped := ctx.(*Context)
5151
if status == 500 {
52-
ctxTyped.Logger.Error("Request Completed", "method", req.Method, "path", req.URL.Path, "status", status, "remote_addr", c.RemoteAddr(), "time_ns", timeTakenMs, "size", rw.Size())
52+
ctxTyped.Logger.Error("Request Completed", "method", req.Method, "path", req.URL.Path, "status", status, "remote_addr", c.RemoteAddr(), "time_ms", timeTakenMs, "size", rw.Size())
5353
} else {
54-
ctxTyped.Logger.Info("Request Completed", "method", req.Method, "path", req.URL.Path, "status", status, "remote_addr", c.RemoteAddr(), "time_ns", timeTakenMs, "size", rw.Size())
54+
ctxTyped.Logger.Info("Request Completed", "method", req.Method, "path", req.URL.Path, "status", status, "remote_addr", c.RemoteAddr(), "time_ms", timeTakenMs, "size", rw.Size())
5555
}
5656
}
5757
}

pkg/middleware/middleware.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,6 @@ func (ctx *Context) Handle(status int, title string, err error) {
208208
}
209209
}
210210

211-
switch status {
212-
case 200:
213-
metrics.M_Page_Status_200.Inc(1)
214-
case 404:
215-
metrics.M_Page_Status_404.Inc(1)
216-
case 500:
217-
metrics.M_Page_Status_500.Inc(1)
218-
}
219-
220211
ctx.Data["Title"] = title
221212
ctx.HTML(status, strconv.Itoa(status))
222213
}
@@ -243,10 +234,8 @@ func (ctx *Context) JsonApiErr(status int, message string, err error) {
243234

244235
switch status {
245236
case 404:
246-
metrics.M_Api_Status_404.Inc(1)
247237
resp["message"] = "Not Found"
248238
case 500:
249-
metrics.M_Api_Status_500.Inc(1)
250239
resp["message"] = "Internal Server Error"
251240
}
252241

0 commit comments

Comments
 (0)