OpenTelemetry push exporter implementation (closes #478)
This commit is contained in:
@@ -30,6 +30,7 @@ X-References: <1234@local.machine.example> <3456@example.net>
|
||||
X-References: <789@local.machine.example> <abcd@example.net>
|
||||
X-Text: a b
|
||||
X-Text: this is some text
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/alternative;
|
||||
boundary="boundary_0"
|
||||
|
||||
|
||||
@@ -162,6 +162,10 @@
|
||||
"name": "X-Text",
|
||||
"value": " this is some text"
|
||||
},
|
||||
{
|
||||
"name": "MIME-Version",
|
||||
"value": " 1.0"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": " multipart/alternative; \r\n\tboundary=\"boundary_0\""
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
Date: Tue, 10 Jul 2018 01:03:11 +0000
|
||||
Message-ID: <my-message-id>
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
"name": "Message-ID",
|
||||
"value": " <my-message-id>"
|
||||
},
|
||||
{
|
||||
"name": "MIME-Version",
|
||||
"value": " 1.0"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": " text/plain; charset=\"utf-8\""
|
||||
@@ -54,6 +58,10 @@
|
||||
"name": "Message-ID",
|
||||
"value": " <my-message-id>"
|
||||
},
|
||||
{
|
||||
"name": "MIME-Version",
|
||||
"value": " 1.0"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": " text/plain; charset=\"utf-8\""
|
||||
@@ -81,6 +89,10 @@
|
||||
"name": "Message-ID",
|
||||
"value": " <my-message-id>"
|
||||
},
|
||||
{
|
||||
"name": "MIME-Version",
|
||||
"value": " 1.0"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": " text/plain; charset=\"utf-8\""
|
||||
|
||||
@@ -5,6 +5,7 @@ Subject: =?utf-8?Q?Why_not_both_importing_AND_exporting=3F_=E2=98=BA?=
|
||||
To: "Colleagues": "James Smythe" <james@vandelay.com>;
|
||||
"Friends": <jane@example.com>,
|
||||
"=?utf-8?Q?John_Sm=C3=AEth?=" <john@example.com>
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/mixed;
|
||||
boundary="boundary_0"
|
||||
|
||||
|
||||
@@ -55,6 +55,10 @@
|
||||
"name": "To",
|
||||
"value": " \"Colleagues\": \"James Smythe\" <james@vandelay.com>; \r\n\t\"Friends\": <jane@example.com>, \r\n\t\"=?utf-8?Q?John_Sm=C3=AEth?=\" <john@example.com>"
|
||||
},
|
||||
{
|
||||
"name": "MIME-Version",
|
||||
"value": " 1.0"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": " multipart/mixed; \r\n\tboundary=\"boundary_0\""
|
||||
|
||||
@@ -2,6 +2,7 @@ Date: Tue, 10 Jul 2018 01:03:11 +0000
|
||||
From: "Joe Bloggs" <joe@example.com>
|
||||
Message-ID: <my-message-id>
|
||||
Subject: RFC 8621 Section 4.1.4 test
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/mixed;
|
||||
boundary="boundary_0"
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@
|
||||
"name": "Subject",
|
||||
"value": " RFC 8621 Section 4.1.4 test"
|
||||
},
|
||||
{
|
||||
"name": "MIME-Version",
|
||||
"value": " 1.0"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": " multipart/mixed; \r\n\tboundary=\"boundary_0\""
|
||||
|
||||
@@ -2,6 +2,7 @@ Date: Tue, 10 Jul 2018 01:03:11 +0000
|
||||
From: "Joe Bloggs" <joe@example.com>
|
||||
Message-ID: <my-message-id>
|
||||
Subject: World domination
|
||||
MIME-Version: 1.0
|
||||
Content-Language: en
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
@@ -39,6 +39,10 @@
|
||||
"name": "Subject",
|
||||
"value": " World domination"
|
||||
},
|
||||
{
|
||||
"name": "MIME-Version",
|
||||
"value": " 1.0"
|
||||
},
|
||||
{
|
||||
"name": "Content-Language",
|
||||
"value": " en"
|
||||
@@ -87,6 +91,10 @@
|
||||
"name": "Subject",
|
||||
"value": " World domination"
|
||||
},
|
||||
{
|
||||
"name": "MIME-Version",
|
||||
"value": " 1.0"
|
||||
},
|
||||
{
|
||||
"name": "Content-Language",
|
||||
"value": " en"
|
||||
@@ -129,6 +137,10 @@
|
||||
"name": "Subject",
|
||||
"value": " World domination"
|
||||
},
|
||||
{
|
||||
"name": "MIME-Version",
|
||||
"value": " 1.0"
|
||||
},
|
||||
{
|
||||
"name": "Content-Language",
|
||||
"value": " en"
|
||||
|
||||
@@ -3,6 +3,7 @@ From: "Joe Bloggs" <joe@example.com>
|
||||
Message-ID: <my-message-id>
|
||||
Subject: World domination
|
||||
To: "John" <john@example.com>
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/alternative;
|
||||
boundary="boundary_0"
|
||||
|
||||
|
||||
@@ -46,6 +46,10 @@
|
||||
"name": "To",
|
||||
"value": " \"John\" <john@example.com>"
|
||||
},
|
||||
{
|
||||
"name": "MIME-Version",
|
||||
"value": " 1.0"
|
||||
},
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": " multipart/alternative; \r\n\tboundary=\"boundary_0\""
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# docker run -p 4317:4317 --network host --rm -v $(pwd)/otel-collector-config.yaml:/etc/otelcol/config.yaml otel/opentelemetry-collector
|
||||
# docker run -p 4317:4317 --network host --rm -v $(pwd)/tests/resources/otel/otel-collector-config.yaml:/etc/otelcol/config.yaml otel/opentelemetry-collector
|
||||
|
||||
receivers:
|
||||
otlp:
|
||||
@@ -38,3 +38,7 @@ service:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [debug]
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [debug]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
[tracer.otel]
|
||||
type = "otel"
|
||||
transport = "grpc"
|
||||
endpoint = "http://127.0.0.1:4317"
|
||||
level = "trace"
|
||||
|
||||
tracer.otel.type = "otel"
|
||||
tracer.otel.transport = "grpc"
|
||||
tracer.otel.endpoint = "http://127.0.0.1:4317"
|
||||
tracer.otel.level = "trace"
|
||||
metrics.open-telemetry.interval = "10s"
|
||||
metrics.open-telemetry.enable = true
|
||||
metrics.open-telemetry.endpoint = "http://127.0.0.1:4317"
|
||||
metrics.open-telemetry.transport = "grpc"
|
||||
|
||||
@@ -307,10 +307,10 @@ pub async fn test(params: &mut JMAPTest) {
|
||||
|
||||
// Check webhook events
|
||||
params.webhook.assert_contains(&[
|
||||
"store.ingest",
|
||||
"message-ingest.",
|
||||
"delivery.dsn",
|
||||
"\"from\": \"bill@example.com\"",
|
||||
"\"to\": \"john.doe@example.com\"",
|
||||
"\"john.doe@example.com\"",
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ use common::{
|
||||
};
|
||||
use hyper::{header::AUTHORIZATION, Method};
|
||||
use imap::core::{ImapSessionManager, IMAP};
|
||||
use jmap::{api::JmapSessionManager, services::housekeeper::Event, JMAP};
|
||||
use jmap::{api::JmapSessionManager, JMAP};
|
||||
use jmap_client::client::{Client, Credentials};
|
||||
use jmap_proto::{error::request::RequestError, types::id::Id};
|
||||
use managesieve::core::ManageSieveSessionManager;
|
||||
@@ -31,11 +31,11 @@ use smtp::core::{SmtpSessionManager, SMTP};
|
||||
|
||||
use store::{
|
||||
roaring::RoaringBitmap,
|
||||
write::{key::DeserializeBigEndian, AnyKey},
|
||||
IterateParams, Stores, SUBSPACE_PROPERTY,
|
||||
write::{key::DeserializeBigEndian, AnyKey, FtsQueueClass, ValueClass},
|
||||
IterateParams, Stores, ValueKey, SUBSPACE_PROPERTY,
|
||||
};
|
||||
use tokio::sync::{mpsc, watch};
|
||||
use utils::config::Config;
|
||||
use utils::{config::Config, BlobHash};
|
||||
use webhooks::{spawn_mock_webhook_endpoint, MockWebhookEndpoint};
|
||||
|
||||
use crate::{add_test_certs, directory::DirectoryStore, store::TempDir, AssertConfig};
|
||||
@@ -283,7 +283,7 @@ disabled-events = ["network.*"]
|
||||
|
||||
[webhook."test"]
|
||||
url = "http://127.0.0.1:8821/hook"
|
||||
events = ["auth.*", "delivery.dsn*", "store.ingest"]
|
||||
events = ["auth.*", "delivery.dsn*", "message-ingest.*"]
|
||||
signature-key = "ovos-moles"
|
||||
throttle = "100ms"
|
||||
|
||||
@@ -356,15 +356,44 @@ pub struct JMAPTest {
|
||||
|
||||
pub async fn wait_for_index(server: &JMAP) {
|
||||
loop {
|
||||
let (tx, rx) = tokio::sync::oneshot::channel();
|
||||
let mut has_index_tasks = false;
|
||||
server
|
||||
.inner
|
||||
.housekeeper_tx
|
||||
.send(Event::IndexIsActive(tx))
|
||||
.core
|
||||
.storage
|
||||
.data
|
||||
.iterate(
|
||||
IterateParams::new(
|
||||
ValueKey::<ValueClass<u32>> {
|
||||
account_id: 0,
|
||||
collection: 0,
|
||||
document_id: 0,
|
||||
class: ValueClass::FtsQueue(FtsQueueClass {
|
||||
seq: 0,
|
||||
hash: BlobHash::default(),
|
||||
}),
|
||||
},
|
||||
ValueKey::<ValueClass<u32>> {
|
||||
account_id: u32::MAX,
|
||||
collection: u8::MAX,
|
||||
document_id: u32::MAX,
|
||||
class: ValueClass::FtsQueue(FtsQueueClass {
|
||||
seq: u64::MAX,
|
||||
hash: BlobHash::default(),
|
||||
}),
|
||||
},
|
||||
)
|
||||
.ascending(),
|
||||
|_, _| {
|
||||
has_index_tasks = true;
|
||||
|
||||
Ok(false)
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
if rx.await.unwrap() {
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
|
||||
if has_index_tasks {
|
||||
tokio::time::sleep(Duration::from_millis(300)).await;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user