Skip to content
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

Simplify Sentry meta tag retrieval #586

Merged
merged 1 commit into from Oct 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/Sentry/Laravel/Integration.php
Expand Up @@ -216,6 +216,17 @@ private static function extractNameForActionRoute(string $action): string

/**
* Retrieve the meta tags with tracing information to link this request to front-end requests.
* This propagates the Dynamic Sampling Context.
*
* @return string
*/
public static function sentryMeta(): string
{
return self::sentryTracingMeta() . self::sentryBaggageMeta();
}

/**
* Retrieve the `sentry-trace` meta tag with tracing information to link this request to front-end requests.
*
* @return string
*/
Expand All @@ -227,13 +238,11 @@ public static function sentryTracingMeta(): string
return '';
}

$content = sprintf('<meta name="sentry-trace" content="%s"/>', $span->toTraceparent());

return $content;
return sprintf('<meta name="sentry-trace" content="%s"/>', $span->toTraceparent());
}

/**
* Retrieve the meta tags with baggage information to link this request to front-end requests.
* Retrieve the `baggage` meta tag with information to link this request to front-end requests.
* This propagates the Dynamic Sampling Context.
*
* @return string
Expand All @@ -246,9 +255,7 @@ public static function sentryBaggageMeta(): string
return '';
}

$content = sprintf('<meta name="baggage" content="%s"/>', $span->toBaggage());

return $content;
return sprintf('<meta name="baggage" content="%s"/>', $span->toBaggage());
}

/**
Expand Down