-
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
10,361 additions
and
7,111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
migrations/multitenant/0010-delete-cache-cache-notifier-on-delete.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
CREATE FUNCTION tenants_delete_notify_trigger () | ||
RETURNS TRIGGER | ||
AS $$ | ||
BEGIN | ||
PERFORM | ||
pg_notify('tenants_update', '"' || OLD.id || '"'); | ||
RETURN NULL; | ||
END; | ||
$$ | ||
LANGUAGE plpgsql; | ||
CREATE TRIGGER tenants_delete_notify_trigger | ||
AFTER DELETE ON tenants | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE tenants_delete_notify_trigger (); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
ALTER TABLE tenants ADD COLUMN tracing_mode text NOT NULL DEFAULT 'basic'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
http: | ||
|
||
processors: | ||
memory_limiter: | ||
check_interval: 1s | ||
limit_percentage: 70 | ||
spike_limit_percentage: 20 | ||
batch: | ||
send_batch_size: 10000 | ||
timeout: 10s | ||
tail_sampling/storage: | ||
decision_wait: 10s | ||
expected_new_traces_per_sec: 10000 | ||
num_traces: 50000 | ||
policies: | ||
[ | ||
# Exclude probes URLs | ||
{ | ||
name: exclude-urls, | ||
type: string_attribute, | ||
string_attribute: { key: http.route, values: [ \/health.*, \/metrics, \/tenants, \/version, \/status ], enabled_regex_matching: true, invert_match: true } | ||
}, | ||
# All error are sampled | ||
{ | ||
name: error-status-codes, | ||
type: numeric_attribute, | ||
numeric_attribute: { key: http.status_code, min_value: 500, max_value: 599 } | ||
}, | ||
# Always sample high latency traces that are not uploads | ||
{ | ||
name: high-latency-excluding-uploads, | ||
type: and, | ||
and: { | ||
and_sub_policy: | ||
[ | ||
{ | ||
type: latency, | ||
latency: { threshold_ms: 5000 } | ||
}, | ||
# Exclude upload operations | ||
{ | ||
type: string_attribute, | ||
string_attribute: { | ||
key: http.operation, | ||
values: [ .*upload.* ], | ||
enabled_regex_matching: true, | ||
invert_match: true | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
# Always sample high latency uploads | ||
{ | ||
name: high-latency-uploads, | ||
type: and, | ||
and: { | ||
and_sub_policy: | ||
[ | ||
{ | ||
type: latency, | ||
latency: { threshold_ms: 300000 } | ||
}, | ||
# Only upload operations | ||
{ | ||
type: string_attribute, | ||
string_attribute: { | ||
key: http.operation, | ||
values: [ .*upload.* ], | ||
enabled_regex_matching: true, | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
# Sample traces for tenants with default mode | ||
# Default mode is the mode where the trace.mode attribute is set to basic | ||
# and only 0.2 of traces are sampled for each tenant | ||
{ | ||
name: sampling-basic-tenants, | ||
type: and, | ||
and: { | ||
and_sub_policy: | ||
[ | ||
{ | ||
# must have tenant.ref attribute | ||
name: has-tenant-ref, | ||
type: string_attribute, | ||
string_attribute: | ||
{ | ||
key: tenant.ref, | ||
values: [ .* ], | ||
enabled_regex_matching: true | ||
}, | ||
}, | ||
{ | ||
# trace.mode = basic | ||
name: trace-mode-default, | ||
type: string_attribute, | ||
string_attribute: | ||
{ | ||
key: trace.mode, | ||
values: [ basic ], | ||
}, | ||
}, | ||
{ | ||
name: success-status-codes, | ||
type: numeric_attribute, | ||
numeric_attribute: { key: http.status_code, min_value: 200, max_value: 399 } | ||
}, | ||
{ | ||
name: basic-sampling, | ||
type: probabilistic, | ||
probabilistic: { | ||
sampling_percentage: 5 | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
|
||
# Sample traces for tenants with premium mode | ||
# Premium mode sample 100% of traces for each tenant | ||
{ | ||
name: sampling-premium-tenants, | ||
type: and, | ||
and: { | ||
and_sub_policy: | ||
[ | ||
{ | ||
# must have tenant.ref attribute | ||
name: has-tenant-ref, | ||
type: string_attribute, | ||
string_attribute: | ||
{ | ||
key: tenant.ref, | ||
values: [ .* ], | ||
enabled_regex_matching: true | ||
}, | ||
}, | ||
{ | ||
# trace.mode = premium | ||
name: trace-mode-default, | ||
type: string_attribute, | ||
string_attribute: | ||
{ | ||
key: trace.mode, | ||
values: [ full ], | ||
}, | ||
}, | ||
{ | ||
name: success-status-codes, | ||
type: numeric_attribute, | ||
numeric_attribute: { key: http.status_code, min_value: 200, max_value: 399 } | ||
}, | ||
{ | ||
name: full-sampling, | ||
type: probabilistic, | ||
probabilistic: { | ||
sampling_percentage: 100 | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
|
||
exporters: | ||
otlp/jaeger: | ||
endpoint: "jaeger:4317" | ||
tls: | ||
insecure: true | ||
|
||
service: | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
processors: [memory_limiter, tail_sampling/storage, batch] | ||
exporters: [otlp/jaeger] |
Oops, something went wrong.