Skip to content
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
13 changes: 8 additions & 5 deletions geoengine/operators/src/bin/gdalsource_process_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,16 @@ fn init_subscriber(
logging_config: &WorkerLoggingConfig,
open_telemetry_config: &OpenTelemetryConfig,
token: &str,
) -> (Option<SdkTracerProvider>, Option<WorkerGuard>) {
) -> (Option<SdkTracerProvider>, WorkerGuard, Option<WorkerGuard>) {
// ponytail: reuse the same non-blocking writer pattern as the file layer to avoid
// blocking the event thread when the PTY can't keep up; lines are dropped when full
let (non_blocking_writer, stderr_guard) = tracing_appender::non_blocking(std::io::stderr());
let stderr_layer = tracing_subscriber::fmt::layer()
.pretty()
.with_file(false)
.with_target(true)
.with_ansi(true)
.with_writer(std::io::stderr)
.with_writer(non_blocking_writer)
.with_filter(EnvFilter::new(&logging_config.log_spec));

let (file_layer, file_guard) = if logging_config.log_to_file {
Expand Down Expand Up @@ -162,14 +165,14 @@ fn init_subscriber(
.with(opentelemetry)
.init();

return (Some(provider), file_guard);
return (Some(provider), stderr_guard, file_guard);
}

tracing_subscriber::registry()
.with(stderr_layer)
.with(file_layer)
.init();
(None, file_guard)
(None, stderr_guard, file_guard)
}

// We use a custom formatter because there are still format flags within spans even when
Expand Down Expand Up @@ -227,7 +230,7 @@ fn main() {
.expect("Failed to create tokio runtime for telemetry");

let runtime_guard = runtime.enter();
let (provider, _file_guard) = init_subscriber(
let (provider, _stderr_guard, _file_guard) = init_subscriber(
&worker_config.logging,
&worker_config.open_telemetry,
&token,
Expand Down
16 changes: 11 additions & 5 deletions geoengine/services/src/bin/geoengine-server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ pub async fn start_server() -> Result<()> {
EnvFilter::try_new(&logging_config.log_spec).expect("to have a valid log spec");

// create a log layer for output to the console and add it to the registry
let registry = registry.with(console_layer_with_filter(console_filter));
let (console_layer, _console_guard) = console_layer_with_filter(console_filter);
let registry = registry.with(console_layer);

// create a filter for the log message level in file output. Since the console_filter is not copy or clone, we have to create a new one. TODO: allow a different log level for file output.
let file_filter =
Expand Down Expand Up @@ -111,18 +112,23 @@ where
Ok(opentelemetry)
}

fn console_layer_with_filter<S, F: Filter<S> + 'static>(filter: F) -> impl Layer<S>
fn console_layer_with_filter<S, F: Filter<S> + 'static>(
filter: F,
) -> (impl Layer<S> + use<S, F>, WorkerGuard)
where
S: Subscriber,
for<'a> S: LookupSpan<'a>,
{
tracing_subscriber::fmt::layer()
// blocking the event thread when the PTY can't keep up; lines are dropped when full
let (non_blocking_writer, guard) = tracing_appender::non_blocking(std::io::stderr());
let layer = tracing_subscriber::fmt::layer()
.pretty()
.with_file(false)
.with_target(true)
.with_ansi(true)
.with_writer(std::io::stderr)
.with_filter(filter)
.with_writer(non_blocking_writer)
.with_filter(filter);
(layer, guard)
}

// we use a custom formatter because there are still format flags within spans even when `with_ansi` is false due to bug: https://github.com/tokio-rs/tracing/issues/1817
Expand Down
8 changes: 7 additions & 1 deletion python/geoengine/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1751,8 +1751,14 @@ class GeoTransform:
def __init__(self, x_min: float, y_max: float, x_pixel_size: float, y_pixel_size: float):
"""Initialize a new `GeoTransform`"""

# Note: We use the GeoTransform in API to adress two types in the backend.
# The first type is the backend GeoTransform. In this case, the x_pixel_size is always positive \
# and the y_pixel_size is always negative.
# The second type is the GdalGeoTransform. In this case, the x_pixel_size is always positive \
# and the y_pixel_size is in most cases negative.
# BUT there are cases where y_pixel_size is positive. Therefore, we only check that y_pixel_size is not zero.
assert x_pixel_size > 0, "In Geo Engine, x_pixel_size is always positive."
assert y_pixel_size < 0, "In Geo Engine, y_pixel_size is always negative."
assert y_pixel_size != 0, "y_pixel_size must not be zero."

self.x_min = x_min
self.y_max = y_max
Expand Down
Loading