Skip to content

Instantly share code, notes, and snippets.

"""
Alternative approach for working with prometheus metrics.
If the component actively works with metrics,
it is convenient to initialize the controller with labels and further
use methods to change the metric through this controller.
Example:
# declare controller
class MetricsController(BaseMetricsController):
_mandatory_label_names = ['label1', 'label2']
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
WITH corp_payments AS (
SELECT
p.member_no,
c.corp_no,
c.corp_name,
p.payment_amt
FROM `member` m
JOIN payment p
ON m.member_no = p.member_no
RIGHT JOIN corporation c
WITH charge_by_cat_prov AS (
SELECT
p.provider_no,
p.provider_name,
ca.category_no,
ca.category_desc,
ch.charge_amt
FROM charge ch
JOIN provider p
ON ch.provider_no = p.provider_no
WITH charge_by_categories AS (
SELECT
ca.category_no,
ca.category_desc,
ch.charge_amt
FROM charge ch
JOIN category ca
ON ch.category_no = ca.category_no
)
SELECT
WITH deltas AS (
SELECT
sub.task_id,
sub.start_date,
sub.end_date,
sub.end_date - sub.end_date_prev tasks_delta
FROM (
SELECT p.*,
lag(p.end_date, 1) OVER () end_date_prev
FROM projects p