Struct relay_config::Config

source ·
pub struct Config { /* private fields */ }
Expand description

Config struct.

Implementations§

source§

impl Config

source

pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Config>

Loads a config from a given config folder.

source

pub fn from_json_value(value: Value) -> Result<Config>

Creates a config from a JSON value.

This is mostly useful for tests.

source

pub fn apply_override( &mut self, overrides: OverridableConfig ) -> Result<&mut Self>

Override configuration with values coming from other sources (e.g. env variables or command line parameters)

source

pub fn config_exists<P: AsRef<Path>>(path: P) -> bool

Checks if the config is already initialized.

source

pub fn path(&self) -> &Path

Returns the filename of the config file.

source

pub fn to_yaml_string(&self) -> Result<String>

Dumps out a YAML string of the values.

source

pub fn regenerate_credentials(&mut self, save: bool) -> Result<()>

Regenerates the relay credentials.

This also writes the credentials back to the file.

source

pub fn credentials(&self) -> Option<&Credentials>

Return the current credentials

source

pub fn replace_credentials( &mut self, credentials: Option<Credentials> ) -> Result<bool>

Set new credentials.

This also writes the credentials back to the file.

source

pub fn has_credentials(&self) -> bool

Returns true if the config is ready to use.

source

pub fn secret_key(&self) -> Option<&SecretKey>

Returns the secret key if set.

source

pub fn public_key(&self) -> Option<&PublicKey>

Returns the public key if set.

source

pub fn relay_id(&self) -> Option<&RelayId>

Returns the relay ID.

source

pub fn relay_mode(&self) -> RelayMode

Returns the relay mode.

source

pub fn upstream_descriptor(&self) -> &UpstreamDescriptor<'_>

Returns the upstream target as descriptor.

source

pub fn http_host_header(&self) -> Option<&str>

Returns the custom HTTP “Host” header.

source

pub fn listen_addr(&self) -> SocketAddr

Returns the listen address.

source

pub fn tls_listen_addr(&self) -> Option<SocketAddr>

Returns the TLS listen address.

source

pub fn tls_identity_path(&self) -> Option<&Path>

Returns the path to the identity bundle

source

pub fn tls_identity_password(&self) -> Option<&str>

Returns the password for the identity bundle

source

pub fn override_project_ids(&self) -> bool

Returns true when project IDs should be overriden rather than validated.

Defaults to false, which requires project ID validation.

source

pub fn requires_auth(&self) -> bool

Returns true if Relay requires authentication for readiness.

See ReadinessCondition for more information.

source

pub fn http_auth_interval(&self) -> Option<Duration>

Returns the interval at which Realy should try to re-authenticate with the upstream.

Always disabled in processing mode.

source

pub fn http_outage_grace_period(&self) -> Duration

The maximum time of experiencing uninterrupted network failures until Relay considers that it has encountered a network outage.

source

pub fn http_retry_delay(&self) -> Duration

Time Relay waits before retrying an upstream request.

Before going into a network outage, Relay may fail to make upstream requests. This is the time Relay waits before retrying the same request.

source

pub fn http_project_failure_interval(&self) -> Duration

Time of continued project request failures before Relay emits an error.

source

pub fn http_encoding(&self) -> HttpEncoding

Content encoding of upstream requests.

source

pub fn http_global_metrics(&self) -> bool

Returns whether metrics should be sent globally through a shared endpoint.

source

pub fn emit_outcomes(&self) -> EmitOutcomes

Returns whether this Relay should emit outcomes.

This is true either if outcomes.emit_outcomes is explicitly enabled, or if this Relay is in processing mode.

source

pub fn emit_client_outcomes(&self) -> bool

Returns whether this Relay should emit client outcomes

Relays that do not emit client outcomes will forward client recieved outcomes directly to the next relay in the chain as client report envelope. This is only done if this relay emits outcomes at all. A relay that will not emit outcomes will forward the envelope unchanged.

This flag can be explicitly disabled on processing relays as well to prevent the emitting of client outcomes to the kafka topic.

source

pub fn outcome_batch_size(&self) -> usize

Returns the maximum number of outcomes that are batched before being sent

source

pub fn outcome_batch_interval(&self) -> Duration

Returns the maximum interval that an outcome may be batched

source

pub fn outcome_source(&self) -> Option<&str>

The originating source of the outcome

source

pub fn outcome_aggregator(&self) -> &OutcomeAggregatorConfig

Returns the width of the buckets into which outcomes are aggregated, in seconds.

source

pub fn logging(&self) -> &LogConfig

Returns logging configuration.

source

pub fn sentry(&self) -> &SentryConfig

Returns logging configuration.

source

pub fn statsd_addrs(&self) -> Result<Vec<SocketAddr>>

Returns the socket addresses for statsd.

If stats is disabled an empty vector is returned.

source

pub fn metrics_prefix(&self) -> &str

Return the prefix for statsd metrics.

source

pub fn metrics_default_tags(&self) -> &BTreeMap<String, String>

Returns the default tags for statsd metrics.

source

pub fn metrics_hostname_tag(&self) -> Option<&str>

Returns the name of the hostname tag that should be attached to each outgoing metric.

source

pub fn metrics_sample_rate(&self) -> f32

Returns the global sample rate for all metrics.

source

pub fn metrics_meta_locations_max(&self) -> usize

Returns the maximum amount of code locations per metric.

source

pub fn metrics_meta_locations_expiry(&self) -> Duration

Returns the expiry for code locations.

source

pub fn http_timeout(&self) -> Duration

Returns the default timeout for all upstream HTTP requests.

source

pub fn http_connection_timeout(&self) -> Duration

Returns the connection timeout for all upstream HTTP requests.

source

pub fn http_max_retry_interval(&self) -> Duration

Returns the failed upstream request retry interval.

source

pub fn project_cache_expiry(&self) -> Duration

Returns the expiry timeout for cached projects.

source

pub fn request_full_project_config(&self) -> bool

Returns true if the full project state should be requested from upstream.

source

pub fn relay_cache_expiry(&self) -> Duration

Returns the expiry timeout for cached relay infos (public keys).

source

pub fn envelope_buffer_size(&self) -> usize

Returns the maximum number of buffered envelopes

source

pub fn cache_miss_expiry(&self) -> Duration

Returns the expiry timeout for cached misses before trying to refetch.

source

pub fn project_grace_period(&self) -> Duration

Returns the grace period for project caches.

source

pub fn query_batch_interval(&self) -> Duration

Returns the duration in which batchable project config queries are collected before sending them in a single request.

source

pub fn downstream_relays_batch_interval(&self) -> Duration

Returns the duration in which downstream relays are requested from upstream.

source

pub fn local_cache_interval(&self) -> Duration

Returns the interval in seconds in which local project configurations should be reloaded.

source

pub fn cache_eviction_interval(&self) -> Duration

Returns the interval in seconds in which projects configurations should be freed from memory when expired.

source

pub fn global_config_fetch_interval(&self) -> Duration

Returns the interval in seconds in which fresh global configs should be fetched from upstream.

source

pub fn spool_envelopes_path(&self) -> Option<PathBuf>

Returns the path of the buffer file if the cache.persistent_envelope_buffer.path is configured.

source

pub fn spool_envelopes_max_connections(&self) -> u32

Maximum number of connections to create to buffer file.

source

pub fn spool_envelopes_min_connections(&self) -> u32

Minimum number of connections to create to buffer file.

source

pub fn spool_envelopes_unspool_interval(&self) -> Duration

Unspool interval in milliseconds.

source

pub fn spool_envelopes_max_disk_size(&self) -> usize

The maximum size of the buffer, in bytes.

source

pub fn spool_envelopes_max_memory_size(&self) -> usize

The maximum size of the memory buffer, in bytes.

source

pub fn max_event_size(&self) -> usize

Returns the maximum size of an event payload in bytes.

source

pub fn max_attachment_size(&self) -> usize

Returns the maximum size of each attachment.

source

pub fn max_attachments_size(&self) -> usize

Returns the maximum combined size of attachments or payloads containing attachments (minidump, unreal, standalone attachments) in bytes.

source

pub fn max_client_reports_size(&self) -> usize

Returns the maximum combined size of client reports in bytes.

source

pub fn max_check_in_size(&self) -> usize

Returns the maximum payload size of a monitor check-in in bytes.

source

pub fn max_span_size(&self) -> usize

Returns the maximum payload size of a span in bytes.

source

pub fn max_envelope_size(&self) -> usize

Returns the maximum size of an envelope payload in bytes.

Individual item size limits still apply.

source

pub fn max_session_count(&self) -> usize

Returns the maximum number of sessions per envelope.

source

pub fn max_statsd_size(&self) -> usize

Returns the maximum payload size of a statsd metric in bytes.

source

pub fn max_metric_buckets_size(&self) -> usize

Returns the maximum payload size of metric buckets in bytes.

source

pub fn max_metric_meta_size(&self) -> usize

Returns the maximum payload size of metric metadata in bytes.

source

pub fn max_api_payload_size(&self) -> usize

Returns the maximum payload size for general API requests.

source

pub fn max_api_file_upload_size(&self) -> usize

Returns the maximum payload size for file uploads and chunks.

source

pub fn max_api_chunk_upload_size(&self) -> usize

Returns the maximum payload size for chunks

source

pub fn max_profile_size(&self) -> usize

Returns the maximum payload size for a profile

source

pub fn max_replay_compressed_size(&self) -> usize

Returns the maximum payload size for a compressed replay.

source

pub fn max_replay_uncompressed_size(&self) -> usize

Returns the maximum payload size for an uncompressed replay.

source

pub fn max_replay_message_size(&self) -> usize

Returns the maximum message size for an uncompressed replay.

This is greater than max_replay_compressed_size because it can include additional metadata about the replay in addition to the recording.

source

pub fn max_concurrent_requests(&self) -> usize

Returns the maximum number of active requests

source

pub fn max_concurrent_queries(&self) -> usize

Returns the maximum number of active queries

source

pub fn query_timeout(&self) -> Duration

The maximum number of seconds a query is allowed to take across retries.

source

pub fn shutdown_timeout(&self) -> Duration

The maximum number of seconds to wait for pending envelopes after receiving a shutdown signal.

source

pub fn keepalive_timeout(&self) -> Duration

Returns the server keep-alive timeout in seconds.

By default keep alive is set to a 5 seconds.

source

pub fn cpu_concurrency(&self) -> usize

Returns the number of cores to use for thread pools.

source

pub fn query_batch_size(&self) -> usize

Returns the maximum size of a project config query.

source

pub fn project_configs_path(&self) -> PathBuf

Get filename for static project config.

source

pub fn processing_enabled(&self) -> bool

True if the Relay should do processing.

source

pub fn normalization_level(&self) -> NormalizationLevel

Level of normalization for Relay to apply to incoming data.

source

pub fn geoip_path(&self) -> Option<&Path>

The path to the GeoIp database required for event processing.

source

pub fn max_secs_in_future(&self) -> i64

Maximum future timestamp of ingested data.

Events past this timestamp will be adjusted to now(). Sessions will be dropped.

source

pub fn max_secs_in_past(&self) -> i64

Maximum age of ingested events. Older events will be adjusted to now().

source

pub fn max_session_secs_in_past(&self) -> i64

Maximum age of ingested sessions. Older sessions will be dropped.

source

pub fn kafka_config( &self, topic: KafkaTopic ) -> Result<KafkaParams<'_>, KafkaConfigError>

Configuration name and list of Kafka configuration parameters for a given topic.

source

pub fn unused_topic_assignments(&self) -> &BTreeMap<String, TopicAssignment>

All unused but configured topic assignments.

source

pub fn redis(&self) -> Option<&RedisConfig>

Redis servers to connect to, for rate limiting.

source

pub fn attachment_chunk_size(&self) -> usize

Chunk size of attachments in bytes.

source

pub fn metrics_partitions(&self) -> Option<u64>

Amount of metric partitions.

source

pub fn metrics_max_batch_size_bytes(&self) -> usize

Maximum metrics batch size in bytes.

source

pub fn projectconfig_cache_prefix(&self) -> &str

Default prefix to use when looking up project configs in Redis. This is only done when Relay is in processing mode.

source

pub fn max_rate_limit(&self) -> Option<u64>

Maximum rate limit to report to clients in seconds.

source

pub fn cardinality_limiter_cache_vacuum_interval(&self) -> Duration

Cache vacuum interval for the cardinality limiter in memory cache.

The cache will scan for expired values based on this interval.

source

pub fn health_sys_info_refresh_interval(&self) -> Duration

Interval to refresh system information.

source

pub fn health_max_memory_watermark_bytes(&self) -> u64

Maximum memory watermark in bytes.

source

pub fn health_max_memory_watermark_percent(&self) -> f32

Maximum memory watermark as a percentage of maximum system memory.

source

pub fn health_probe_timeout(&self) -> Duration

Health check probe timeout.

source

pub fn cogs_enabled(&self) -> bool

Whether COGS measurements are enabled.

source

pub fn cogs_granularity(&self) -> Duration

Granularity for COGS measurements.

source

pub fn cogs_max_queue_size(&self) -> u64

Maximum amount of COGS measurements buffered in memory.

source

pub fn cogs_relay_resource_id(&self) -> &str

Resource ID to use for Relay COGS measurements.

source

pub fn permissive_aggregator_config(&self) -> AggregatorConfig

Creates an [AggregatorConfig] that is compatible with every other aggregator.

A lossless aggregator can be put in front of any of the configured aggregators without losing data that the configured aggregator would keep. This is useful for pre-aggregating metrics together in a single aggregator instance.

source

pub fn default_aggregator_config(&self) -> &AggregatorServiceConfig

Returns configuration for the default metrics aggregator.

source

pub fn secondary_aggregator_configs(&self) -> &Vec<ScopedAggregatorConfig>

Returns configuration for non-default metrics aggregators.

source

pub fn aggregator_config_for( &self, namespace: MetricNamespace ) -> &AggregatorServiceConfig

Returns aggregator config for a given metrics namespace.

source

pub fn static_relays(&self) -> &HashMap<RelayId, RelayInfo>

Return the statically configured Relays.

source

pub fn accept_unknown_items(&self) -> bool

Returns true if unknown items should be accepted and forwarded.

source

pub fn aws_runtime_api(&self) -> Option<&str>

Returns the host and port of the AWS lambda runtime API.

Trait Implementations§

source§

impl Debug for Config

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Config

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more