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

Better Kusto Tracing for self-hosted runner. #405

Merged
merged 1 commit into from
Apr 9, 2020

Conversation

TingluoHuang
Copy link
Member

Adding following telemetry for self-hosted runner

  • Add OrchestrationId when self-hosted runner renew lock.
  • Add OAuth ClientId into useragent so we can distinguish hosted vs. self-hosted

if (credData != null &&
credData.Data.TryGetValue("clientId", out var clientId))
{
_userAgents.Add(new ProductInfoHeaderValue($"RunnerId", clientId));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only self-hosted runner has the oauth app clientid

var additionalHeaders = new Dictionary<string, string>();
if (!string.IsNullOrEmpty(orchestrationId))
{
additionalHeaders["X-VSS-OrchestrationId"] = orchestrationId;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this Header will make everything on the service for this request has the same orchestrationid (activitylog/producttrace)

{
var jwt = JsonWebToken.Create(accessToken);
var claims = jwt.ExtractClaims();
orchestrationId = claims.FirstOrDefault(x => string.Equals(x.Type, "orchid", StringComparison.OrdinalIgnoreCase))?.Value;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

orchestrationid is part of the token's claims

@TingluoHuang TingluoHuang requested a review from ericsciple April 7, 2020 16:04
@TingluoHuang TingluoHuang force-pushed the users/tihuang/kustoimprove branch from d70fa9c to 7fb3b57 Compare April 9, 2020 18:02
@TingluoHuang TingluoHuang force-pushed the users/tihuang/kustoimprove branch from 7fb3b57 to 7d85f77 Compare April 9, 2020 18:20
@TingluoHuang TingluoHuang merged commit baa6ded into master Apr 9, 2020
@TingluoHuang TingluoHuang deleted the users/tihuang/kustoimprove branch April 9, 2020 18:33
AdamOlech pushed a commit to antmicro/runner that referenced this pull request Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants