Skip to content

Support ACLP fetching entity metrics #777

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

Merged
merged 13 commits into from
Aug 12, 2025
Merged

Conversation

yec-akamai
Copy link
Contributor

@yec-akamai yec-akamai commented Jul 2, 2025

📝 Description

This PR introduced a new client MonitorClient, to make calls to a different host monitor-api. It utilizes PAT token generated by linode api. The endpoint for this client is fetching metrics for a list of entities. Also, updated test suite for the new client and test the fetching metrics endpoint.

✔️ How to Test

Unit test:

make test-unit TEST_ARGS="-run TestFetchEntityMetrics" 

Integration test:

make test-int TEST_ARGS="-run TestMonitorAPI_Fetch_Entity_Metrics"

@yec-akamai yec-akamai marked this pull request as ready for review July 10, 2025 13:50
@yec-akamai yec-akamai requested a review from a team as a code owner July 10, 2025 13:50
@yec-akamai yec-akamai requested review from zliang-akamai and ykim-akamai and removed request for a team July 10, 2025 13:50
@yec-akamai yec-akamai added new-feature for new features in the changelog. do-not-merge PRs that should not be merged until the commented issue is resolved labels Jul 10, 2025
@ykim-akamai ykim-akamai requested review from a team, jriddle-linode and PawelSnoch and removed request for ykim-akamai and a team July 18, 2025 21:46
@yec-akamai yec-akamai removed the do-not-merge PRs that should not be merged until the commented issue is resolved label Jul 22, 2025
@lgarber-akamai lgarber-akamai removed the request for review from PawelSnoch July 24, 2025 18:11
@yec-akamai yec-akamai requested a review from zliang-akamai July 28, 2025 13:49
Comment on lines +100 to +101
// FetchEntityMetrics returns metrics information for the individual entities within a specific service type
func (mc *MonitorClient) FetchEntityMetrics(ctx context.Context, serviceType string, opts *EntityMetricsFetchOptions) (*EntityMetrics, error) {
Copy link
Member

@zliang-akamai zliang-akamai Jul 29, 2025

Choose a reason for hiding this comment

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

Suggested change
// FetchEntityMetrics returns metrics information for the individual entities within a specific service type
func (mc *MonitorClient) FetchEntityMetrics(ctx context.Context, serviceType string, opts *EntityMetricsFetchOptions) (*EntityMetrics, error) {
// GetEntityMetrics returns metrics information for the individual entities within a specific service type
func (mc *MonitorClient) GetEntityMetrics(ctx context.Context, serviceType ServiceType, opts *GetEntityMetricsOptions) (*EntityMetrics, error) {

Should we change Fetch to Get to be consistent with the API doc?

And I think the type should be the alias of string ServiceType so users can use linodego.ServiceTypeDBaaS without casting it into string (string(linodego.ServiceTypeDBaaS)), and all other monitor functions may need this change as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using fetch here is because this endpoint is actually a POST. However, the prefix Get usually indicates an actual GET endpoint, which could be confusing. I've talked to the ACLP team about this situation, and they suggested fetch might be a better way to go.

I'm not sure if using a ServiceType string is better here. Because the ServiceType enum includes a list of services, however, here we only accept dbaas for now. It could be misleading that we also support other service types.

Copy link
Member

@zliang-akamai zliang-akamai Jul 29, 2025

Choose a reason for hiding this comment

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

Okay, Fetch seems to be fine then. Maybe there can be a chance to update the doc though. But ServiceType is defined for this usage, right? Meaning we will get those services supported in the future?
Maybe checking with ACLP team for their opinion?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The ServiceType was defined for another set of endpoints, Dashboard. It's a separate effort though. From what I've learnt there isn't a clear plan for what services will be support in the next for Metrics here.

@yec-akamai yec-akamai requested a review from zliang-akamai July 29, 2025 14:15
Copy link
Member

@zliang-akamai zliang-akamai left a comment

Choose a reason for hiding this comment

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

Looks good and works well!

Copy link
Collaborator

@jriddle-linode jriddle-linode left a comment

Choose a reason for hiding this comment

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

Looks good on my end and is working locally.

@yec-akamai yec-akamai merged commit 96cc59d into main Aug 12, 2025
10 checks passed
@yec-akamai yec-akamai deleted the TPT-3804/monitor-api-client branch August 12, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature for new features in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants