Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ parse_labels(char *input, PrometheusParseCtx *ctx)

value_start = input + i;

while ((input[i] != '"' || (input[i] == '"' && input[i-1] =='\\')) && input[i] != '\0')
while ((input[i] != '"' || (input[i] == '"' && input[i-1] =='\\' && input[i-2] !='\\')) && input[i] != '\0')
{
i++;
}
Expand Down
48 changes: 24 additions & 24 deletions test/expected/normalized.out
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,36 @@ SELECT create_prometheus_table('input');
(3 rows)

\d input
View "public.input"
Column | Type | Modifiers
--------+--------------------------+-----------
sample | prom_sample |
time | timestamp with time zone |
name | text |
value | double precision |
labels | jsonb |
View "public.input"
Column | Type | Collation | Nullable | Default
--------+--------------------------+-----------+----------+---------
sample | prom_sample | | |
time | timestamp with time zone | | |
name | text | | |
value | double precision | | |
labels | jsonb | | |
Triggers:
insert_trigger INSTEAD OF INSERT ON input FOR EACH ROW EXECUTE PROCEDURE prometheus.insert_view_normal('input_values', 'input_labels')

\d input_values
Table "public.input_values"
Column | Type | Modifiers
-----------+--------------------------+-----------
time | timestamp with time zone |
value | double precision |
labels_id | integer |
Table "public.input_values"
Column | Type | Collation | Nullable | Default
-----------+--------------------------+-----------+----------+---------
time | timestamp with time zone | | |
value | double precision | | |
labels_id | integer | | |
Indexes:
"input_values_labels_id_idx" btree (labels_id, "time" DESC)
Foreign-key constraints:
"input_values_labels_id_fkey" FOREIGN KEY (labels_id) REFERENCES input_labels(id)

\d input_labels
Table "public.input_labels"
Column | Type | Modifiers
-------------+---------+-----------------------------------------------------------
id | integer | not null default nextval('input_labels_id_seq'::regclass)
metric_name | text | not null
labels | jsonb |
Table "public.input_labels"
Column | Type | Collation | Nullable | Default
-------------+---------+-----------+----------+------------------------------------------
id | integer | | not null | nextval('input_labels_id_seq'::regclass)
metric_name | text | | not null |
labels | jsonb | | |
Indexes:
"input_labels_pkey" PRIMARY KEY, btree (id)
"input_labels_metric_name_labels_key" UNIQUE CONSTRAINT, btree (metric_name, labels)
Expand All @@ -62,10 +62,10 @@ Referenced by:
TABLE "input_values" CONSTRAINT "input_values_labels_id_fkey" FOREIGN KEY (labels_id) REFERENCES input_labels(id)

\d+ input_copy
Table "public.input_copy"
Column | Type | Modifiers | Storage | Stats target | Description
--------+-------------+-----------+---------+--------------+-------------
sample | prom_sample | not null | plain | |
Table "public.input_copy"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+-------------+-----------+----------+---------+---------+--------------+-------------
sample | prom_sample | | not null | | plain | |
Triggers:
insert_trigger BEFORE INSERT ON input_copy FOR EACH ROW EXECUTE PROCEDURE prometheus.insert_view_normal('input_values', 'input_labels')

Expand Down
8 changes: 4 additions & 4 deletions test/expected/raw.out
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ CREATE TABLE metrics (sample prom_sample);
CREATE INDEX metrics_time_idx ON metrics (prom_time(sample));
CREATE INDEX metrics_labels_idx ON metrics USING GIN (prom_labels(sample));
\d metrics
Table "public.metrics"
Column | Type | Modifiers
--------+-------------+-----------
sample | prom_sample |
Table "public.metrics"
Column | Type | Collation | Nullable | Default
--------+-------------+-----------+----------+---------
sample | prom_sample | | |
Indexes:
"metrics_labels_idx" gin (prom_labels(sample))
"metrics_time_idx" btree (prom_time(sample))
Expand Down