Skip to content

Implement the monitoring interface for performance tests #3465

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Alan4506
Copy link

@Alan4506 Alan4506 commented Jun 24, 2025

Description of changes:

This PR adds performance metrics reporting for SDK service operations. It implements a monitoring interface that collects latency data and outputs it in JSON format.

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Aws::String unit;
int64_t date;
Aws::Vector<int64_t> measurements;
Aws::Vector<std::pair<Aws::String, Aws::String>> dimensions;
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be a Aws::Map<Aws::String, Aws::String>? would we ever have duplicate keys or want to handle duplicate keys?

Copy link
Author

Choose a reason for hiding this comment

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

We will not have duplicate keys here. In this case, Aws::Map<Aws::String, Aws::String> can be more efficient.

Aws::String name;
Aws::String description;
Aws::String unit;
int64_t date;
Copy link
Contributor

Choose a reason for hiding this comment

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

why int64_t instead of Aws::Utils::Datetime? using the datetime data type is likely what we want to do, then extract the time we want from it.

Aws::String description;
Aws::String unit;
int64_t date;
Aws::Vector<int64_t> measurements;
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of using int64_t for measurements, you may want to make a Measurement type that can have different implementations, so we can support floating point measurements in the future.

void DumpJson() const;

mutable Aws::Vector<PerformanceMetricRecord> m_performanceRecords;
static Aws::Vector<std::pair<Aws::String, Aws::String>> TestDimensions;
Copy link
Contributor

Choose a reason for hiding this comment

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

these should not be static variables to the class, they should be member variables that are assigned in the constructor.

* Sets test dimensions that will be included with all performance records.
* @param dimensions Vector of key-value pairs representing test dimensions (e.g., size, bucket type)
*/
static void SetTestContext(const Aws::Vector<std::pair<Aws::String, Aws::String>>& dimensions);
Copy link
Contributor

Choose a reason for hiding this comment

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

i comment on this further, but we should avoid creating static state that is shared between instances of the metrics reporter, instead using member variables that are assigned in a constructor.


void JsonReportingMetrics::SetOutputFilename(const Aws::String& filename) { OutputFilename = filename; }

JsonReportingMetrics::~JsonReportingMetrics() { DumpJson(); }
Copy link
Contributor

Choose a reason for hiding this comment

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

nice RAII!

auto iterator = metricsFromCore.httpClientMetrics.find(latencyKey);
if (iterator != metricsFromCore.httpClientMetrics.end()) {
durationMs = iterator->second;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

if we don't find the record we likely want to fail instead of reporting the metric. is there anyway we can report back to the runner that we have failed to collect metrics instead of reporting 0?


void* JsonReportingMetrics::OnRequestStarted(const Aws::String&, const Aws::String&,
const std::shared_ptr<const Aws::Http::HttpRequest>&) const {
return nullptr;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we might have a little problem here specifically about how you create durationMs and are tracking it here. and i suggest you look at DefaultMonitoring about how we do it in the default monitor . we need to start the duration count here, and finish it when we succeed. You actually try following the pattern in that file.

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