Skip to content

PutLogEvents request must be in chronological order #40

@giantcow

Description

@giantcow

In my use case, I'm combining my own logs from tracing, with logs from tracing-gstreamer. With the Gstreamer tracing logs enabled, I sometimes get the following error:

[tracing-cloudwatch] Unable to put logs to cloudwatch. Error: Other(InvalidParameterException: Log events in a single PutLogEvents request must be in chronological order.

Caused by:
    InvalidParameterException: Log events in a single PutLogEvents request must be in chronological order.

Stack backtrace:
   0: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
   1: tracing_cloudwatch::client::awssdk::<impl tracing_cloudwatch::client::CloudWatchClient for aws_sdk_cloudwatchlogs::client::Client>::put_logs::{{closure}}
   2: tracing_cloudwatch::export::BatchExporter<C>::run::{{closure}}
   3: tokio::runtime::task::core::Core<T,S>::poll
   4: tokio::runtime::task::harness::Harness<T,S>::poll
   5: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
   6: tokio::runtime::scheduler::multi_thread::worker::Context::run
   7: tokio::runtime::context::runtime::enter_runtime
   8: tokio::runtime::scheduler::multi_thread::worker::run
   9: tokio::runtime::task::core::Core<T,S>::poll
  10: tokio::runtime::task::harness::Harness<T,S>::poll
  11: tokio::runtime::blocking::pool::Inner::run
  12: std::sys::backtrace::__rust_begin_short_backtrace
  13: core::ops::function::FnOnce::call_once{{vtable.shim}}
  14: std::sys::pal::unix::thread::Thread::new::thread_start
  15: start_thread
  16: clone3) LogDestination { log_group_name: "<snip>", log_stream_name: "<snip>" }

I think we could easily add a sort, but I'm very worried about the efficiency implications

let logs = std::mem::take(&mut queue);
if let Err(err) = client.put_logs(config.destination.clone(), logs).await {

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions