Skip to content

Commit

Permalink
chore: add schema urls to otlp logs (#4876)
Browse files Browse the repository at this point in the history
* chore: add schema urls to otlp logs table

* chore: update meter-macros version to remove anymap warning

* chore: change span id and trace id to field
  • Loading branch information
shuiyisong authored Oct 25, 2024
1 parent 4e9c251 commit 32a0023
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 170 deletions.
26 changes: 5 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ tokio-rustls = { git = "https://github.com/GreptimeTeam/tokio-rustls" }

[workspace.dependencies.meter-macros]
git = "https://github.com/GreptimeTeam/greptime-meter.git"
rev = "80eb97c24c88af4dd9a86f8bbaf50e741d4eb8cd"
rev = "a10facb353b41460eeb98578868ebf19c2084fac"

[profile.release]
debug = 1
Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/instance/otlp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ impl OpenTelemetryProtocolHandler for Instance {
.plugins
.get::<OpenTelemetryProtocolInterceptorRef<servers::error::Error>>();
interceptor_ref.pre_execute(ctx.clone())?;

let (requests, rows) = otlp::logs::to_grpc_insert_requests(request, pipeline, table_name)?;
self.handle_log_inserts(requests, ctx)
.await
Expand Down
18 changes: 6 additions & 12 deletions src/servers/src/http/otlp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ use snafu::prelude::*;

use super::header::constants::GREPTIME_LOG_EXTRACT_KEYS_HEADER_NAME;
use super::header::{write_cost_header_map, CONTENT_TYPE_PROTOBUF};
use crate::error::{self, Result};
use crate::error::{self, PipelineSnafu, Result};
use crate::http::header::constants::{
GREPTIME_LOG_PIPELINE_NAME_HEADER_NAME, GREPTIME_LOG_PIPELINE_VERSION_HEADER_NAME,
GREPTIME_LOG_TABLE_NAME_HEADER_NAME,
Expand Down Expand Up @@ -227,15 +227,9 @@ pub async fn logs(
.start_timer();
let request = ExportLogsServiceRequest::decode(bytes).context(error::DecodeOtlpRequestSnafu)?;

let pipeline_way;
if let Some(pipeline_name) = &pipeline_info.pipeline_name {
let pipeline_way = if let Some(pipeline_name) = &pipeline_info.pipeline_name {
let pipeline_version =
to_pipeline_version(pipeline_info.pipeline_version).map_err(|_| {
error::InvalidParameterSnafu {
reason: GREPTIME_LOG_PIPELINE_VERSION_HEADER_NAME,
}
.build()
})?;
to_pipeline_version(pipeline_info.pipeline_version).context(PipelineSnafu)?;
let pipeline = match handler
.get_pipeline(pipeline_name, pipeline_version, query_ctx.clone())
.await
Expand All @@ -245,10 +239,10 @@ pub async fn logs(
return Err(e);
}
};
pipeline_way = PipelineWay::Custom(pipeline);
PipelineWay::Custom(pipeline)
} else {
pipeline_way = PipelineWay::OtlpLog(Box::new(select_info));
}
PipelineWay::OtlpLog(Box::new(select_info))
};

handler
.logs(request, pipeline_way, table_info.table_name, query_ctx)
Expand Down
Loading

0 comments on commit 32a0023

Please sign in to comment.