Skip to content

Commit 95a915f

Browse files
restructure: moved otel module from handlers to src
1 parent fd5b8d2 commit 95a915f

File tree

9 files changed

+32
-19
lines changed

9 files changed

+32
-19
lines changed

src/handlers/http/ingest.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818

1919
use super::logstream::error::{CreateStreamError, StreamError};
2020
use super::modal::utils::ingest_utils::{flatten_and_push_logs, push_logs};
21-
use super::otel::logs::flatten_otel_logs;
22-
use super::otel::metrics::flatten_otel_metrics;
23-
use super::otel::traces::flatten_otel_traces;
2421
use super::users::dashboards::DashboardError;
2522
use super::users::filters::FiltersError;
2623
use crate::event::{
@@ -33,6 +30,9 @@ use crate::handlers::STREAM_NAME_HEADER_KEY;
3330
use crate::metadata::error::stream_info::MetadataError;
3431
use crate::metadata::STREAM_INFO;
3532
use crate::option::{Mode, CONFIG};
33+
use crate::otel::logs::flatten_otel_logs;
34+
use crate::otel::metrics::flatten_otel_metrics;
35+
use crate::otel::traces::flatten_otel_traces;
3636
use crate::storage::{ObjectStorageError, StreamType};
3737
use crate::utils::header_parsing::ParseHeaderError;
3838
use actix_web::{http::header::ContentType, HttpRequest, HttpResponse};

src/handlers/http/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ pub mod logstream;
3737
pub mod middleware;
3838
pub mod modal;
3939
pub mod oidc;
40-
pub mod otel;
4140
pub mod query;
4241
pub mod rbac;
4342
pub mod role;

src/handlers/http/modal/utils/ingest_utils.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,12 @@ use crate::{
3232
format::{self, EventFormat},
3333
},
3434
handlers::{
35-
http::{
36-
ingest::PostError,
37-
kinesis,
38-
otel::{
39-
logs::flatten_otel_logs, metrics::flatten_otel_metrics, traces::flatten_otel_traces,
40-
},
41-
},
35+
http::{ingest::PostError, kinesis},
4236
LOG_SOURCE_KEY, LOG_SOURCE_KINESIS, LOG_SOURCE_OTEL_LOGS, LOG_SOURCE_OTEL_METRICS,
4337
LOG_SOURCE_OTEL_TRACES, PREFIX_META, PREFIX_TAGS, SEPARATOR,
4438
},
4539
metadata::STREAM_INFO,
40+
otel::{logs::flatten_otel_logs, metrics::flatten_otel_metrics, traces::flatten_otel_traces},
4641
storage::StreamType,
4742
utils::{header_parsing::collect_labelled_headers, json::convert_array_to_object},
4843
};

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ pub mod metrics;
3232
pub mod migration;
3333
mod oidc;
3434
pub mod option;
35+
pub mod otel;
3536
mod query;
3637
pub mod rbac;
3738
mod response;
@@ -42,7 +43,6 @@ pub mod sync;
4243
pub mod users;
4344
mod utils;
4445
mod validator;
45-
4646
pub use handlers::http::modal::{
4747
ingest_server::IngestServer, query_server::QueryServer, server::Server, ParseableServer,
4848
};

src/otel.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Parseable Server (C) 2022 - 2024 Parseable, Inc.
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU Affero General Public License as
6+
* published by the Free Software Foundation, either version 3 of the
7+
* License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU Affero General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU Affero General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
*/
18+
19+
pub mod logs;
20+
pub mod metrics;
21+
pub mod otel_utils;
22+
pub mod traces;

src/handlers/http/otel/logs.rs renamed to src/otel/logs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ use opentelemetry_proto::tonic::logs::v1::SeverityNumber;
2424
use serde_json::Value;
2525
use std::collections::BTreeMap;
2626

27-
use super::collect_json_from_values;
28-
use super::insert_attributes;
27+
use super::otel_utils::collect_json_from_values;
28+
use super::otel_utils::insert_attributes;
2929

3030
/// otel log event has severity number
3131
/// there is a mapping of severity number to severity text provided in proto

src/handlers/http/otel/metrics.rs renamed to src/otel/metrics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use opentelemetry_proto::tonic::metrics::v1::{
2626
};
2727
use serde_json::Value;
2828

29-
use super::{insert_attributes, insert_number_if_some};
29+
use super::otel_utils::{insert_attributes, insert_number_if_some};
3030

3131
/// otel metrics event has json array for exemplar
3232
/// this function flatten the exemplar json array

src/handlers/http/otel.rs renamed to src/otel/otel_utils.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
*
1717
*/
1818

19-
pub mod logs;
20-
pub mod metrics;
21-
pub mod traces;
2219
use opentelemetry_proto::tonic::common::v1::{any_value::Value as OtelValue, AnyValue, KeyValue};
2320
use serde_json::Value;
2421
use std::collections::BTreeMap;

src/handlers/http/otel/traces.rs renamed to src/otel/traces.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use opentelemetry_proto::tonic::trace::v1::TracesData;
2727
use serde_json::Value;
2828
use std::collections::BTreeMap;
2929

30-
use super::insert_attributes;
30+
use super::otel_utils::insert_attributes;
3131

3232
/// this function flattens the `ScopeSpans` object
3333
/// and returns a `Vec` of `BTreeMap` of the flattened json

0 commit comments

Comments
 (0)