Skip to content

Commit

Permalink
Custom filter for aws sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
iamvigneshwars committed Apr 23, 2024
1 parent f215d1b commit c1e8a0b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/processed_data/charts/processed_data/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ type: application

version: 0.1.0

appVersion: 0.2.0-rc2
appVersion: 0.2.1-rc1
2 changes: 1 addition & 1 deletion processed_data/src/graphql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ impl AutoProcessing {

#[ComplexObject]
impl AutoProcFileAttachment {
/// Gives downloadable link for the processed image in the s3 bucket
/// Generate downloadable link for files in s3 bucket
async fn file_url(&self, ctx: &Context<'_>) -> async_graphql::Result<String> {
let s3_client = ctx.data::<aws_sdk_s3::Client>()?;
let bucket = ctx.data::<S3Bucket>()?;
Expand Down
7 changes: 6 additions & 1 deletion processed_data/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use std::{
};
use tokio::net::TcpListener;
use tracing::{info, instrument};
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
use tracing_subscriber::{filter::FilterFn, layer::SubscriberExt, util::SubscriberInitExt};
use url::Url;

use crate::route_handlers::GraphQLHandler;
Expand Down Expand Up @@ -174,6 +174,10 @@ fn setup_telemetry(
log_level: tracing::Level,
otel_collector_url: Option<Url>,
) -> Result<(), anyhow::Error> {
let custom_filter = FilterFn::new(|metadata| {
!metadata.target().contains("aws_smithy_runtime")
&& !metadata.target().contains("aws_credential_types")
});
let level_filter = tracing_subscriber::filter::LevelFilter::from_level(log_level);
let log_layer = tracing_subscriber::fmt::layer();
let service_name_resource = opentelemetry_sdk::Resource::new(vec![
Expand Down Expand Up @@ -224,6 +228,7 @@ fn setup_telemetry(
};

tracing_subscriber::Registry::default()
.with(custom_filter)
.with(level_filter)
.with(log_layer)
.with(metrics_layer)
Expand Down

0 comments on commit c1e8a0b

Please sign in to comment.