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

[MetricsAdvisor] CreateDataFeed takes a whole DataFeed; DataSource property added to DataFeed #16366

Merged
merged 7 commits into from
Oct 29, 2020

Conversation

kinelski
Copy link
Member

@kinelski kinelski commented Oct 28, 2020

Adding a DataSource property to DataFeed made some restructuring necessary. We are not keeping an internal DataFeedDetail instance anymore. Instead, a new DataFeedDetail is built right before we serialize the model and send it to the service.

These three possible scenarios are being covered:

  • User has a DataFeed object and calls CreateDataFeed. DataFeed.GetDataFeedDetail is called to build a DataFeedDetail from scratch. It goes as follows:
    • Firstly, a call to DataFeedSource.InstantiateDataFeedDetail is made to get the right DataFeedDetail derived class to build (AzureBlobDataFeed, for instance).
    • Finally, all properties of the created instance are assigned based on the properties of the DataFeed.

  • User has a DataFeed object and calls UpdateDataFeed. DataFeed.GetPatchModel is called to build a DataFeedDetailPatch from scratch. It goes as follows:
    • Firstly, a call to DataFeedSource.InstantiateDataFeedDetailPatch is made to get the right DataFeedDetailPatch derived class to build (AzureBlobDataFeedPatch, for instance).
    • Finally, all properties of the created instance are assigned based on the properties of the DataFeed.

  • User calls GetDataFeed and a new DataFeed object must be built from DataFeedDetail. There are no major changes in the behavior, but we now need to be able to build a DataFeedSource from the DataFeedDetail returned by the service. The static method DataFeedSource.GetDataFeedSource was created for this purpose.

Fixes #16170.
Fixes #16313.

@kinelski kinelski added Client This issue points to a problem in the data-plane of the library. Cognitive - Metrics Advisor labels Oct 28, 2020
@kinelski kinelski marked this pull request as ready for review October 28, 2020 19:29
@kinelski kinelski requested review from christothes and maririos and removed request for tg-msft and KrzysztofCwalina October 28, 2020 19:30
@kinelski kinelski self-assigned this Oct 28, 2020
Copy link
Member

@christothes christothes left a comment

Choose a reason for hiding this comment

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

LGTM

/// <summary>
/// Initializes a new instance of a data source specific DataFeedDetail.
/// </summary>
internal DataFeedDetail InstantiateDataFeedDetail(string name, DataFeedGranularityType granularityType, IList<DataFeedMetric> metricColumns, DateTimeOffset ingestionStartTime)
Copy link
Member

Choose a reason for hiding this comment

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

Much cleaner! 👍

@kinelski kinelski merged commit e362517 into Azure:master Oct 29, 2020
@kinelski kinelski deleted the ma-feed branch October 29, 2020 17:30
annelo-msft pushed a commit to annelo-msft/azure-sdk-for-net that referenced this pull request Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. Cognitive - Metrics Advisor
Projects
None yet
2 participants