-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
honeycomb tracing subscription #1083
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5229036
honeycomb tracing subscription
Voxelot f2b4ffb
cargo lint
Voxelot df1e74a
more feature flags
Voxelot ce12932
Merge branch 'master' into Voxelot/honeycomb-tracing
Voxelot bb57831
remove unwraps
Voxelot 058b093
remove honercomb feature flag (was making the code pretty ugly). Also…
Voxelot a7a86bb
Merge branch 'master' into Voxelot/honeycomb-tracing
xgreenx a436549
Propagate to helm chart
xgreenx fc78ec2
Pass name
xgreenx 584b5a1
Fix honeycomb_api_key
xgreenx 5baf675
Fix env honeycomb_api_key
xgreenx 6a80395
Bump to `0.17.7` to be along with https://github.com/FuelLabs/fuel-co…
xgreenx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
use async_graphql::{ | ||
extensions::{ | ||
Extension, | ||
ExtensionContext, | ||
ExtensionFactory, | ||
NextExecute, | ||
NextParseQuery, | ||
NextRequest, | ||
NextResolve, | ||
NextSubscribe, | ||
NextValidation, | ||
ResolveInfo, | ||
Tracing, | ||
}, | ||
parser::types::ExecutableDocument, | ||
Response, | ||
ServerError, | ||
ServerResult, | ||
ValidationResult, | ||
Value, | ||
Variables, | ||
}; | ||
use futures::stream::BoxStream; | ||
use std::sync::Arc; | ||
use tracing::instrument; | ||
use tracing_honeycomb::{ | ||
register_dist_tracing_root, | ||
TraceId, | ||
}; | ||
|
||
pub(crate) struct HoneyTrace; | ||
|
||
impl ExtensionFactory for HoneyTrace { | ||
fn create(&self) -> Arc<dyn Extension> { | ||
Arc::new(InternalHoneyTrace { | ||
inner_trace: Tracing::create(&Tracing), | ||
}) | ||
} | ||
} | ||
|
||
struct InternalHoneyTrace { | ||
inner_trace: Arc<dyn Extension>, | ||
} | ||
|
||
#[async_trait::async_trait] | ||
impl Extension for InternalHoneyTrace { | ||
#[instrument(skip(self, ctx, next))] | ||
async fn request( | ||
&self, | ||
ctx: &ExtensionContext<'_>, | ||
next: NextRequest<'_>, | ||
) -> Response { | ||
let response = self.inner_trace.request(ctx, next); | ||
let _ = register_dist_tracing_root(TraceId::new(), None); | ||
response.await | ||
} | ||
|
||
#[instrument(skip(self, ctx, stream, next))] | ||
fn subscribe<'s>( | ||
&self, | ||
ctx: &ExtensionContext<'_>, | ||
stream: BoxStream<'s, Response>, | ||
next: NextSubscribe<'_>, | ||
) -> BoxStream<'s, Response> { | ||
let response = self.inner_trace.subscribe(ctx, stream, next); | ||
let _ = register_dist_tracing_root(TraceId::new(), None); | ||
response | ||
} | ||
|
||
#[instrument(skip(self, ctx, query, variables, next))] | ||
async fn parse_query( | ||
&self, | ||
ctx: &ExtensionContext<'_>, | ||
query: &str, | ||
variables: &Variables, | ||
next: NextParseQuery<'_>, | ||
) -> ServerResult<ExecutableDocument> { | ||
let response = self.inner_trace.parse_query(ctx, query, variables, next); | ||
let _ = register_dist_tracing_root(TraceId::new(), None); | ||
response.await | ||
} | ||
|
||
#[instrument(skip(self, ctx, next))] | ||
async fn validation( | ||
&self, | ||
ctx: &ExtensionContext<'_>, | ||
next: NextValidation<'_>, | ||
) -> Result<ValidationResult, Vec<ServerError>> { | ||
let response = self.inner_trace.validation(ctx, next); | ||
let _ = register_dist_tracing_root(TraceId::new(), None); | ||
response.await | ||
} | ||
|
||
#[instrument(skip(self, ctx, operation_name, next))] | ||
async fn execute( | ||
&self, | ||
ctx: &ExtensionContext<'_>, | ||
operation_name: Option<&str>, | ||
next: NextExecute<'_>, | ||
) -> Response { | ||
let response = self.inner_trace.execute(ctx, operation_name, next); | ||
let _ = register_dist_tracing_root(TraceId::new(), None); | ||
response.await | ||
} | ||
|
||
#[instrument(skip(self, ctx, info, next))] | ||
async fn resolve( | ||
&self, | ||
ctx: &ExtensionContext<'_>, | ||
info: ResolveInfo<'_>, | ||
next: NextResolve<'_>, | ||
) -> ServerResult<Option<Value>> { | ||
let response = self.inner_trace.resolve(ctx, info, next); | ||
let _ = register_dist_tracing_root(TraceId::new(), None); | ||
response.await | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to propagate it in the helm chart? Or do we plan to set it via the env variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have a setting on helm for this but it needs to be linked to the cli here