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
81394fca
Commit
81394fca
authored
Dec 16, 2016
by
Mitsuhiro Tanda
Committed by
Torkel Ödegaard
Dec 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cloudwatch internal metrics (#6990)
parent
f8d69024
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
pkg/api/cloudwatch/cloudwatch.go
+3
-0
pkg/api/cloudwatch/metrics.go
+2
-0
pkg/metrics/metrics.go
+5
-0
No files found.
pkg/api/cloudwatch/cloudwatch.go
View file @
81394fca
...
@@ -18,6 +18,7 @@ import (
...
@@ -18,6 +18,7 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/sts"
"github.com/aws/aws-sdk-go/service/sts"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/log"
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/middleware"
m
"github.com/grafana/grafana/pkg/models"
m
"github.com/grafana/grafana/pkg/models"
)
)
...
@@ -213,6 +214,7 @@ func handleGetMetricStatistics(req *cwRequest, c *middleware.Context) {
...
@@ -213,6 +214,7 @@ func handleGetMetricStatistics(req *cwRequest, c *middleware.Context) {
c
.
JsonApiErr
(
500
,
"Unable to call AWS API"
,
err
)
c
.
JsonApiErr
(
500
,
"Unable to call AWS API"
,
err
)
return
return
}
}
metrics
.
M_Aws_CloudWatch_GetMetricStatistics
.
Inc
(
1
)
c
.
JSON
(
200
,
resp
)
c
.
JSON
(
200
,
resp
)
}
}
...
@@ -239,6 +241,7 @@ func handleListMetrics(req *cwRequest, c *middleware.Context) {
...
@@ -239,6 +241,7 @@ func handleListMetrics(req *cwRequest, c *middleware.Context) {
var
resp
cloudwatch
.
ListMetricsOutput
var
resp
cloudwatch
.
ListMetricsOutput
err
:=
svc
.
ListMetricsPages
(
params
,
err
:=
svc
.
ListMetricsPages
(
params
,
func
(
page
*
cloudwatch
.
ListMetricsOutput
,
lastPage
bool
)
bool
{
func
(
page
*
cloudwatch
.
ListMetricsOutput
,
lastPage
bool
)
bool
{
metrics
.
M_Aws_CloudWatch_ListMetrics
.
Inc
(
1
)
metrics
,
_
:=
awsutil
.
ValuesAtPath
(
page
,
"Metrics"
)
metrics
,
_
:=
awsutil
.
ValuesAtPath
(
page
,
"Metrics"
)
for
_
,
metric
:=
range
metrics
{
for
_
,
metric
:=
range
metrics
{
resp
.
Metrics
=
append
(
resp
.
Metrics
,
metric
.
(
*
cloudwatch
.
Metric
))
resp
.
Metrics
=
append
(
resp
.
Metrics
,
metric
.
(
*
cloudwatch
.
Metric
))
...
...
pkg/api/cloudwatch/metrics.go
View file @
81394fca
...
@@ -11,6 +11,7 @@ import (
...
@@ -11,6 +11,7 @@ import (
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/grafana/grafana/pkg/metrics"
"github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/middleware"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/util"
)
)
...
@@ -261,6 +262,7 @@ func getAllMetrics(cwData *datasourceInfo) (cloudwatch.ListMetricsOutput, error)
...
@@ -261,6 +262,7 @@ func getAllMetrics(cwData *datasourceInfo) (cloudwatch.ListMetricsOutput, error)
var
resp
cloudwatch
.
ListMetricsOutput
var
resp
cloudwatch
.
ListMetricsOutput
err
:=
svc
.
ListMetricsPages
(
params
,
err
:=
svc
.
ListMetricsPages
(
params
,
func
(
page
*
cloudwatch
.
ListMetricsOutput
,
lastPage
bool
)
bool
{
func
(
page
*
cloudwatch
.
ListMetricsOutput
,
lastPage
bool
)
bool
{
metrics
.
M_Aws_CloudWatch_ListMetrics
.
Inc
(
1
)
metrics
,
_
:=
awsutil
.
ValuesAtPath
(
page
,
"Metrics"
)
metrics
,
_
:=
awsutil
.
ValuesAtPath
(
page
,
"Metrics"
)
for
_
,
metric
:=
range
metrics
{
for
_
,
metric
:=
range
metrics
{
resp
.
Metrics
=
append
(
resp
.
Metrics
,
metric
.
(
*
cloudwatch
.
Metric
))
resp
.
Metrics
=
append
(
resp
.
Metrics
,
metric
.
(
*
cloudwatch
.
Metric
))
...
...
pkg/metrics/metrics.go
View file @
81394fca
...
@@ -47,6 +47,8 @@ var (
...
@@ -47,6 +47,8 @@ var (
M_Alerting_Notification_Sent_PagerDuty
Counter
M_Alerting_Notification_Sent_PagerDuty
Counter
M_Alerting_Notification_Sent_Victorops
Counter
M_Alerting_Notification_Sent_Victorops
Counter
M_Alerting_Notification_Sent_OpsGenie
Counter
M_Alerting_Notification_Sent_OpsGenie
Counter
M_Aws_CloudWatch_GetMetricStatistics
Counter
M_Aws_CloudWatch_ListMetrics
Counter
// Timers
// Timers
M_DataSource_ProxyReq_Timer
Timer
M_DataSource_ProxyReq_Timer
Timer
...
@@ -113,6 +115,9 @@ func initMetricVars(settings *MetricSettings) {
...
@@ -113,6 +115,9 @@ func initMetricVars(settings *MetricSettings) {
M_Alerting_Notification_Sent_Victorops
=
RegCounter
(
"alerting.notifications_sent"
,
"type"
,
"victorops"
)
M_Alerting_Notification_Sent_Victorops
=
RegCounter
(
"alerting.notifications_sent"
,
"type"
,
"victorops"
)
M_Alerting_Notification_Sent_OpsGenie
=
RegCounter
(
"alerting.notifications_sent"
,
"type"
,
"opsgenie"
)
M_Alerting_Notification_Sent_OpsGenie
=
RegCounter
(
"alerting.notifications_sent"
,
"type"
,
"opsgenie"
)
M_Aws_CloudWatch_GetMetricStatistics
=
RegCounter
(
"aws.cloudwatch.get_metric_statistics"
)
M_Aws_CloudWatch_ListMetrics
=
RegCounter
(
"aws.cloudwatch.list_metrics"
)
// Timers
// Timers
M_DataSource_ProxyReq_Timer
=
RegTimer
(
"api.dataproxy.request.all"
)
M_DataSource_ProxyReq_Timer
=
RegTimer
(
"api.dataproxy.request.all"
)
M_Alerting_Execution_Time
=
RegTimer
(
"alerting.execution_time"
)
M_Alerting_Execution_Time
=
RegTimer
(
"alerting.execution_time"
)
...
...
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