-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export OpenCensus metrics to Stackdriver #118
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Note that before we can close #8, we need to replace all Prometheus client metrics with OpenCensus. E.g.
stackdriver-prometheus-sidecar/stackdriver/queue_manager.go
Lines 48 to 111 in 79587ea
succeededSamplesTotal = prometheus.NewCounterVec( | |
prometheus.CounterOpts{ | |
Namespace: namespace, | |
Subsystem: subsystem, | |
Name: "succeeded_samples_total", | |
Help: "Total number of samples successfully sent to remote storage.", | |
}, | |
[]string{queue}, | |
) | |
failedSamplesTotal = prometheus.NewCounterVec( | |
prometheus.CounterOpts{ | |
Namespace: namespace, | |
Subsystem: subsystem, | |
Name: "failed_samples_total", | |
Help: "Total number of samples which failed on send to remote storage.", | |
}, | |
[]string{queue}, | |
) | |
droppedSamplesTotal = prometheus.NewCounterVec( | |
prometheus.CounterOpts{ | |
Namespace: namespace, | |
Subsystem: subsystem, | |
Name: "dropped_samples_total", | |
Help: "Total number of samples which were dropped due to the queue being full.", | |
}, | |
[]string{queue}, | |
) | |
sentBatchDuration = prometheus.NewHistogramVec( | |
prometheus.HistogramOpts{ | |
Namespace: namespace, | |
Subsystem: subsystem, | |
Name: "sent_batch_duration_seconds", | |
Help: "Duration of sample batch send calls to the remote storage.", | |
Buckets: prometheus.DefBuckets, | |
}, | |
[]string{queue}, | |
) | |
queueLength = prometheus.NewGaugeVec( | |
prometheus.GaugeOpts{ | |
Namespace: namespace, | |
Subsystem: subsystem, | |
Name: "queue_length", | |
Help: "The number of processed samples queued to be sent to the remote storage.", | |
}, | |
[]string{queue}, | |
) | |
queueCapacity = prometheus.NewGaugeVec( | |
prometheus.GaugeOpts{ | |
Namespace: namespace, | |
Subsystem: subsystem, | |
Name: "queue_capacity", | |
Help: "The capacity of the queue of samples to be sent to the remote storage.", | |
}, | |
[]string{queue}, | |
) | |
numShards = prometheus.NewGaugeVec( | |
prometheus.GaugeOpts{ | |
Namespace: namespace, | |
Subsystem: subsystem, | |
Name: "shards", | |
Help: "The number of shards used for parallel sending to the remote storage.", | |
}, | |
[]string{queue}, | |
) |
That means that this PR will only get you select metrics into Stackdriver. If this is an issue for you, we'd appreciate the feedback on issue #8. I think we should find the time to make the change now that OpenCensus supports gauges idiomatically.
That's exactly what I'd like to achieve. I am working on another PR that will add a few OpenCensus metrics, so just wanted to make sure there's a way to get them reported to Stackdriver, not just Prometheus. |
@@ -228,6 +230,8 @@ func main() { | |||
a.Flag("prometheus.api-address", "Address to listen on for UI, API, and telemetry."). | |||
Default("http://127.0.0.1:9090/").URLVar(&cfg.prometheusURL) | |||
|
|||
a.Flag("stackdriver.enable-internal-metrics", "Whether to report Sidecar metrics to Stackdriver").Default("false").BoolVar(&cfg.sdOpencensus) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to be too picky about this, but the flag name is unclear. I'd call it something like monitoring.backend and make the default value "prometheus" and have "stackdriver" as optional. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that's a good idea. Renamed to --monitoring.backend
.
Currently OpenCensus metrics are only exposed to Prometheus for scraping. This adds a flag that also makes them reported to Stackdriver.
CC @jkohen who owns #8 this is probably related to.