Skip to content
Merged
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
5 changes: 4 additions & 1 deletion src/handlers/http/ingest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ pub async fn ingest_internal_stream(stream_name: String, body: Bytes) -> Result<
// Handler for POST /v1/logs to ingest OTEL logs
// ingests events by extracting stream name from header
// creates if stream does not exist
pub async fn ingest_otel_logs(req: HttpRequest, body: Bytes) -> Result<HttpResponse, PostError> {
pub async fn handle_otel_ingestion(
req: HttpRequest,
body: Bytes,
) -> Result<HttpResponse, PostError> {
if let Some((_, stream_name)) = req
.headers()
.iter()
Expand Down
35 changes: 28 additions & 7 deletions src/handlers/http/modal/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,35 @@ impl Server {
}

// /v1/logs endpoint to be used for OTEL log ingestion only
pub fn get_ingest_otel_factory() -> Resource {
web::resource("/v1/logs")
.route(
web::post()
.to(ingest::ingest_otel_logs)
.authorize_for_stream(Action::Ingest),
pub fn get_ingest_otel_factory() -> Scope {
web::scope("/v1")
.service(
web::resource("/logs")
.route(
web::post()
.to(ingest::handle_otel_ingestion)
.authorize_for_stream(Action::Ingest),
)
.app_data(web::PayloadConfig::default().limit(MAX_EVENT_PAYLOAD_SIZE)),
)
.service(
web::resource("/metrics")
.route(
web::post()
.to(ingest::handle_otel_ingestion)
.authorize_for_stream(Action::Ingest),
)
.app_data(web::PayloadConfig::default().limit(MAX_EVENT_PAYLOAD_SIZE)),
)
.service(
web::resource("/traces")
.route(
web::post()
.to(ingest::handle_otel_ingestion)
.authorize_for_stream(Action::Ingest),
)
.app_data(web::PayloadConfig::default().limit(MAX_EVENT_PAYLOAD_SIZE)),
)
.app_data(web::PayloadConfig::default().limit(MAX_EVENT_PAYLOAD_SIZE))
}

// get the oauth webscope
Expand Down
Loading