-
Notifications
You must be signed in to change notification settings - Fork 107
Add --record option to crank-agent for custom measurements #848
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: sebastienros <1165805+sebastienros@users.noreply.github.com>
Co-authored-by: sebastienros <1165805+sebastienros@users.noreply.github.com>
Co-authored-by: sebastienros <1165805+sebastienros@users.noreply.github.com>
|
@copilot The agent should not do command substitution. This should be handled by the shell itself. Just read the raw value from the argument. |
Co-authored-by: sebastienros <1165805+sebastienros@users.noreply.github.com>
Done. Removed the |
| continue; | ||
| } | ||
|
|
||
| var separatorIndex = recordValue.IndexOf('='); |
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.
By splitting the string with recordValue.Split('=', 2) there is no need to do substring after.
Summary
This PR implements the
--record(or-r) command line option forcrank-agentto enable recording custom measurements that are automatically added to every benchmark job the agent runs.Motivation
Agents often need to record system-specific information like OpenSSL version, kernel version, or environment configuration for every benchmark. Previously, there was no way to automatically capture this information without modifying each benchmark. This feature allows administrators to configure custom measurements once at agent startup, which then apply to all benchmarks.
Usage
The new option accepts
name=valuepairs and can be specified multiple times. Command substitution is handled by the shell before the arguments reach the agent:Implementation Details
Format:
=characterCommand Substitution:
Automatic Addition:
job.Measurementswhen each job startsError Handling:
=, empty name): logged as warnings and skippedExample Output
When a job runs on an agent started with
--record "system/openssl=$(openssl version)", the results will include:Measurement:
{ "name": "system/openssl", "timestamp": "2024-02-23T13:01:56.12Z", "value": "OpenSSL 3.0.13 30 Jan 2024" }Metadata:
{ "source": "Agent", "name": "system/openssl", "aggregate": "First", "reduce": "First", "format": "", "longDescription": "Custom measurement: system/openssl", "shortDescription": "system/openssl" }Changes
_recordOptioncommand line option with-r|--recordflags_customMeasurementsdictionary to store parsed measurementsMarkAsRunning()to add custom measurements and metadata to each jobdocs/measurements.mdSecurity Considerations
The agent reads values directly from command line arguments provided by the administrator. Command substitution is handled by the shell, not by the agent, following standard Unix conventions. The database should not record sensitive information per the issue requirements.
Fixes #847
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.