Skip to content

Commit

Permalink
v0.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Aug 8, 2024
1 parent 3b053ad commit db0efda
Show file tree
Hide file tree
Showing 17 changed files with 315 additions and 118 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).

## [0.9.1] - 2024-08-08

To upgrade replace the `stalwart-mail` binary and then upgrade to the latest web-admin.

## Added
- Metrics support (closes #478)
- OpenTelemetry Push Exporter
- Prometheus Pull Exporter (closes #275)
- HTTP endpoint access controls (closes #266 #329 #542)
- Add `options` setting to PostgreSQL driver (closes #662)
- Add `isActive` property to defaults on Sieve/get JMAP method (closes #624)

### Changed
- Perform must-match-sender checks after sender rewriting (closes #394)
- Only perform email ingest duplicate check on the target mailbox (#632)

### Fixed
- Properly parse Forwarded and X-Forwarded for headers (fixes #669)
- Resolve DKIM macros when generating DNS records (fixes #666)
- Fixed `is_local_domain` Sieve function (fixes #622)

## [0.9.0] - 2024-08-01

To upgrade replace the `stalwart-mail` binary and then upgrade to the latest web-admin. This version includes breaking changes to the Webhooks configuration and produces a slightly different log output, read [UPGRADING.md](UPGRADING.md) for details.
Expand Down
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Stalwart Labs Ltd. <[email protected]>"]
license = "AGPL-3.0-only OR LicenseRef-SEL"
repository = "https://github.com/stalwartlabs/cli"
homepage = "https://github.com/stalwartlabs/cli"
version = "0.9.0"
version = "0.9.1"
edition = "2021"
readme = "README.md"
resolver = "2"
Expand Down
2 changes: 1 addition & 1 deletion crates/common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "common"
version = "0.9.0"
version = "0.9.1"
edition = "2021"
resolver = "2"

Expand Down
179 changes: 90 additions & 89 deletions crates/common/src/config/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,13 @@ impl Telemetry {

// Parse metrics
if config
.property_or_default("metrics.prometheus.enable", "true")
.unwrap_or(true)
|| config
.property_or_default("metrics.open-telemetry.enable", "false")
.unwrap_or(false)
.property_or_default("metrics.prometheus.enable", "false")
.unwrap_or(false)
|| ["http", "grpc"].contains(
&config
.value("metrics.open-telemetry.transport")
.unwrap_or("disabled"),
)
{
apply_events(
config
Expand All @@ -141,7 +143,9 @@ impl Telemetry {
.map(|(_, e)| e),
false,
|event_type| {
telemetry.metrics.set(event_type);
if event_type.is_metric() {
telemetry.metrics.set(event_type);
}
},
);
}
Expand Down Expand Up @@ -577,10 +581,21 @@ impl Metrics {
});
}

if config
.property_or_default("metrics.open-telemetry.enable", "false")
.unwrap_or(false)
let otel_enabled = match config
.value("metrics.open-telemetry.transport")
.unwrap_or("disable")
{
"grpc" => true.into(),
"http" | "https" => false.into(),
"disable" | "disabled" => None,
transport => {
let err = format!("Invalid transport: {transport}");
config.new_parse_error("metrics.open-telemetry.transport", err);
None
}
};

if let Some(is_grpc) = otel_enabled {
let timeout = config
.property::<Duration>("metrics.open-telemetry.timeout")
.unwrap_or(Duration::from_secs(
Expand All @@ -597,92 +612,78 @@ impl Metrics {
.with_version(env!("CARGO_PKG_VERSION"))
.build();

match config
.value_require("metrics.open-telemetry.transport")
.unwrap_or_default()
{
"grpc" => {
let mut exporter = opentelemetry_otlp::new_exporter()
.tonic()
.with_protocol(opentelemetry_otlp::Protocol::Grpc)
.with_timeout(timeout);
if let Some(endpoint) = config.value("metrics.open-telemetry.endpoint") {
exporter = exporter.with_endpoint(endpoint);
}
if is_grpc {
let mut exporter = opentelemetry_otlp::new_exporter()
.tonic()
.with_protocol(opentelemetry_otlp::Protocol::Grpc)
.with_timeout(timeout);
if let Some(endpoint) = config.value("metrics.open-telemetry.endpoint") {
exporter = exporter.with_endpoint(endpoint);
}

match exporter.build_metrics_exporter(
Box::new(DefaultAggregationSelector::new()),
Box::new(DefaultTemporalitySelector::new()),
) {
Ok(exporter) => {
metrics.otel = Some(Arc::new(OtelMetrics {
exporter: Box::new(exporter),
interval,
resource,
instrumentation,
}));
}
Err(err) => {
config.new_build_error(
"metrics.open-telemetry",
format!("Failed to build OpenTelemetry metrics exporter: {err}"),
);
}
match exporter.build_metrics_exporter(
Box::new(DefaultAggregationSelector::new()),
Box::new(DefaultTemporalitySelector::new()),
) {
Ok(exporter) => {
metrics.otel = Some(Arc::new(OtelMetrics {
exporter: Box::new(exporter),
interval,
resource,
instrumentation,
}));
}
Err(err) => {
config.new_build_error(
"metrics.open-telemetry",
format!("Failed to build OpenTelemetry metrics exporter: {err}"),
);
}
}
"http" => {
if let Some(endpoint) = config
.value_require("metrics.open-telemetry.endpoint")
.map(|s| s.to_string())
{
let mut headers = HashMap::new();
let mut err = None;
for (_, value) in config.values("metrics.open-telemetry.headers") {
if let Some((key, value)) = value.split_once(':') {
headers.insert(key.trim().to_string(), value.trim().to_string());
} else {
err = format!("Invalid open-telemetry header {value:?}").into();
break;
}
}
if let Some(err) = err {
config.new_parse_error("metrics.open-telemetry.headers", err);
}
} else if let Some(endpoint) = config
.value_require("metrics.open-telemetry.endpoint")
.map(|s| s.to_string())
{
let mut headers = HashMap::new();
let mut err = None;
for (_, value) in config.values("metrics.open-telemetry.headers") {
if let Some((key, value)) = value.split_once(':') {
headers.insert(key.trim().to_string(), value.trim().to_string());
} else {
err = format!("Invalid open-telemetry header {value:?}").into();
break;
}
}
if let Some(err) = err {
config.new_parse_error("metrics.open-telemetry.headers", err);
}

let mut exporter = opentelemetry_otlp::new_exporter()
.http()
.with_endpoint(&endpoint)
.with_timeout(timeout);
if !headers.is_empty() {
exporter = exporter.with_headers(headers);
}
let mut exporter = opentelemetry_otlp::new_exporter()
.http()
.with_endpoint(&endpoint)
.with_timeout(timeout);
if !headers.is_empty() {
exporter = exporter.with_headers(headers);
}

match exporter.build_metrics_exporter(
Box::new(DefaultAggregationSelector::new()),
Box::new(DefaultTemporalitySelector::new()),
) {
Ok(exporter) => {
metrics.otel = Some(Arc::new(OtelMetrics {
exporter: Box::new(exporter),
interval,
resource,
instrumentation,
}));
}
Err(err) => {
config.new_build_error(
"metrics.open-telemetry",
format!(
"Failed to build OpenTelemetry metrics exporter: {err}"
),
);
}
}
match exporter.build_metrics_exporter(
Box::new(DefaultAggregationSelector::new()),
Box::new(DefaultTemporalitySelector::new()),
) {
Ok(exporter) => {
metrics.otel = Some(Arc::new(OtelMetrics {
exporter: Box::new(exporter),
interval,
resource,
instrumentation,
}));
}
Err(err) => {
config.new_build_error(
"metrics.open-telemetry",
format!("Failed to build OpenTelemetry metrics exporter: {err}"),
);
}
}
transport => {
let err = format!("Invalid transport: {transport}");
config.new_parse_error("metrics.open-telemetry.transport", err);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/directory/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "directory"
version = "0.9.0"
version = "0.9.1"
edition = "2021"
resolver = "2"

Expand Down
2 changes: 1 addition & 1 deletion crates/imap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "imap"
version = "0.9.0"
version = "0.9.1"
edition = "2021"
resolver = "2"

Expand Down
2 changes: 1 addition & 1 deletion crates/jmap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "jmap"
version = "0.9.0"
version = "0.9.1"
edition = "2021"
resolver = "2"

Expand Down
Loading

0 comments on commit db0efda

Please sign in to comment.