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

Integrate the initial node metrics #11481

Merged
merged 11 commits into from
Feb 26, 2025
Merged

Integrate the initial node metrics #11481

merged 11 commits into from
Feb 26, 2025

Conversation

JanKrivanek
Copy link
Member

@JanKrivanek JanKrivanek commented Feb 21, 2025

Fixes #11480

Context

Connects the exposed data into the telemetry collector, converts them into json format.

Testing

TBD

Also - we need to test the resulting output on Orchard to have an idea on volume/size of resulting data - we may need to aggregate/filter targets a bit?

Notes

Sample of resulting data:

"Tasks":

[
  "TaskA": {
    "ExecTimeMs": 2000,
    "ExecCnt": 5,
    "MemKBs": 0.5322265625,
    "IsCustom": false,
    "IsFromNuget": true
  },
  "75745449d67e47c3288fa8db4bf6961b455bdf65f6597a4e1c897e1740ebdc1a": {
    "ExecTimeMs": 254548000,
    "ExecCnt": 6,
    "MemKBs": 53267.0419921875,
    "IsCustom": true,
    "IsFromNuget": false
  }
]



"Targets":

[
  "TargetA": {
    "WasExecuted": false,
    "IsCustom": false,
    "IsFromNuget": true,
    "IsMetaproj": false
  },
  "ce5582cb3fdd2433a022932a42185f9bd62696888bc8102d0bad33363c43aa96": {
    "WasExecuted": false,
    "IsCustom": true,
    "IsFromNuget": true,
    "IsMetaproj": false
  },
  "TargetB": {
    "WasExecuted": false,
    "IsCustom": false,
    "IsFromNuget": false,
    "IsMetaproj": true
  }
]


"TargetsSummary":

"Loaded": {
  "Total": 3,
  "Microsoft": {
    "Total": 1,
    "FromNuget": 1,
    "FromMetaproj": 0
  },
  "Custom": {
    "Total": 2,
    "FromNuget": 1,
    "FromMetaproj": 1
  }
},
"Executed": {
  "Total": 0
}


"TasksSummary":

"Microsoft": {
  "Total": {
    "TotalExecutionsCount": 5,
    "CumulativeExecutionTimeMs": 2000,
    "CumulativeConsumedMemoryKB": 0.5322265625
  },
  "FromNuget": {
    "TotalExecutionsCount": 5,
    "CumulativeExecutionTimeMs": 2000,
    "CumulativeConsumedMemoryKB": 0.5322265625
  }
},
"Custom": {
  "Total": {
    "TotalExecutionsCount": 6,
    "CumulativeExecutionTimeMs": 254548000,
    "CumulativeConsumedMemoryKB": 53267.0419921875
  }
}

@JanKrivanek
Copy link
Member Author

As discussed offline - left for @JanProvaznik to handle:

  • VS perf integration tests when opted in
  • unit/e2e tests - since this is opt-in feature - it's fine to do manual verifications now, and handle unit or/and e2e tests in followup items
  • verifications that the 'tags' appended to main activity (the "Tasks", "Targets", "TargetsSummary", "TasksSummary") will appear as json subtags - not json encoded strings, that then would be hassle to query out
  • dump the sample data on OrchardCore or MSBuild or similar mid-size repo, to get the idea of size collected and verify with VS data platform folks that it's fine to send such sample size for sampled-in runs

@JanProvaznik
Copy link
Member

JanProvaznik commented Feb 24, 2025

ran $env:MSBUILDNODETELEMETRYFILENAME="telemetry.txt"; $env:MSBUILD_TELEMETRY_SAMPLE_RATE="1.0"; $env:MSBUILD_TELEMETRY_OPTIN="1" $env:MSBUILDOUTPUTNODESTELEMETRY="1"; .\artifacts\bin\bootstrap\net472\MSBuild\Current\Bin\MSBuild.exe ..\OrchardCore\
on restored orchardcore,

can't find the telemetry.txt

1668 targets (half metaproj)
266 tasks
the console flush seems to be same ballpark as the json, this results in 200kb of data

we might want to aggregate metaproj targets, if they're hashed then it's not very useful to have their details

@JanProvaznik
Copy link
Member

maybe the csv serialization will be needed after all🤔

@JanProvaznik JanProvaznik self-assigned this Feb 24, 2025
Copy link
Member Author

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

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

As a co-author I cannot approve - but all changes by @JanProvaznik looks good to go!

Copy link
Member

@JanProvaznik JanProvaznik left a comment

Choose a reason for hiding this comment

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

@JanKrivanek
Copy link
Member Author

it breaks VS C++ scenarios, needs more testing. https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=11074124&view=ms.vss-test-web.build-test-results-tab&runId=122902221&resultId=100000&paneView=debug

This was a recent change of 'ExecutionsCount' type change from short to int, that wasn't reflected on the receiving side (it was caught by the failing WorkerNodeTelemetryEventArgs_Tests unit test, that is green now)

@JanProvaznik
Copy link
Member

JanProvaznik commented Feb 26, 2025

strategy to get this in 17.14p2:

  • experimental insertion + always on override
  • meanwhile merge and run real insertion
  • completereal insert if both suceed
  • if no, revert from main :( and reopen
  • address all comments and issues in followup pr

// We do not want decimals
writer.WriteNumber("CumulativeExecutionTimeMs", (long)stats.CumulativeExecutionTime.TotalMilliseconds);
// We do not want decimals
writer.WriteNumber("CumulativeConsumedMemoryKB", stats.TotalMemoryConsumption / 1024);
Copy link
Member

Choose a reason for hiding this comment

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

can we use consistent naming for the variables and json keys, so it can be nameof(prop), instead on the hardcoded strings?

WriteStat(writer, value.CustomTasksInfo, "Custom");
writer.WriteEndObject();

void WriteStat(Utf8JsonWriter writer, TasksInfo tasksInfo, string name)
Copy link
Member

Choose a reason for hiding this comment

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

is it dupe of line 222?

}
}

void UpdateStatistics(
Copy link
Member

Choose a reason for hiding this comment

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

please add short description for the method


private static JsonSerializerOptions _serializerOptions = CreateSerializerOptions();

private static JsonSerializerOptions CreateSerializerOptions()
Copy link
Member

Choose a reason for hiding this comment

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

why we can't make it as a static property without a separation ?

{
internal static class TelemetryDataUtils
{
public static IActivityTelemetryDataHolder? AsActivityDataHolder(this IWorkerNodeTelemetryData? telemetryData, bool includeTasksDetails, bool includeTargetDetails)
Copy link
Member

Choose a reason for hiding this comment

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

please document this method

Copy link
Member

@YuliiaKovalova YuliiaKovalova left a comment

Choose a reason for hiding this comment

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

agreed to fix the comment in the separate PR

@JanProvaznik JanProvaznik merged commit 7e8d5f5 into main Feb 26, 2025
10 checks passed
@JanProvaznik JanProvaznik deleted the telemetry/integrate branch February 26, 2025 12:47
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.

Integrate the initial Tasks/Targets metric to the new telemetry infra
3 participants