Comments (8)
Thank you for your feedback. Tagging and routing to the team member best able to assist.
from azure-sdk-for-net.
Goodday, @ArthurMa1978 ,
do you have any advise or solution to my request.
thanks in advance.
Regards,
Mohamed Charif
from azure-sdk-for-net.
@jsquire and @ArthurMa1978 I would like an update please.
from azure-sdk-for-net.
@MCDPRO, our team is responsible for creating the SDK based on the provided Swagger spec. As such, our domain knowledge regarding the specific use cases for each API is limited.
Add @HarveyLink to assist with a sample; however, we cannot assure its accuracy.
from azure-sdk-for-net.
Goodday @HarveyLink
Any help concerning why not all columns are show in my Request to the API and if i can solve it with the SDK ?
kind regards,
Mohamed Charif
from azure-sdk-for-net.
Hi @MCDPRO , thank you for your feedback. Regarding the issue you mentioned, I will provide a runnable example. In Azure SDK, client.UsageQueryAsync()
by default only has Number type UsageDate and String type Currency in columns. Therefore, we need to add aggregation in the dataset parameter so that columns can have the cost we need. Also, if you want to get the cost of the last complete month, TimeframeType.TheLastBillingMonth
is a good choice. If you need to get it by year, the custom part in the original code is feasible. Here is a runnable example:
private static async Task GetCostForTimeFrame(ArmClient client, ResourceIdentifier id, TimeframeType timeFrame)
{
try
{
var queryDataSet = new QueryDataset()
{
Granularity = GranularityType.Daily,
Aggregation =
{
["Cost"] = new QueryAggregation(function: FunctionType.Sum, name: "PreTaxCost")
{
}
},
};
var query = new QueryDefinition(ExportType.Usage, timeFrame, queryDataSet);
if (timeFrame == TimeframeType.Custom)
{
var today = DateTime.UtcNow;
var startDate = new DateTime(today.Year, today.Month, 1).AddYears(-1);
var endDate = new DateTime(today.Year, today.Month, 1).AddDays(-1);
query.TimePeriod = new QueryTimePeriod(startDate, endDate);
}
var result = await client.UsageQueryAsync(id, query);
var x = result.Value;
var y = result.GetRawResponse();
foreach (var row in result.Value.Rows)
{
Console.WriteLine($"Date: {row[1]}, Cost: {row[0].ToString()}");
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
It's worth mentioning that row[2] represents the currency unit of the cost. If needed, you can add it yourself. Also, please make sure to write the subscription, resourcegroup, and resource correctly. If you need to query the cost data for an entire year, please be aware of the API endpoint's request limit to avoid errors like "too many requests". You can refer to this document for further work, it will help you to use the SDK better. If you have any further questions, please reply to me under this issue. I will reply as soon as I see it to help you solve the problem better.
from azure-sdk-for-net.
Hi @MCDPRO. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
from azure-sdk-for-net.
Hi @MCDPRO, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!
from azure-sdk-for-net.
Related Issues (20)
- Update Embedding Type to Support Narrow Data Types HOT 1
- [BUG] Activity.Tags not exported to customDimensions HOT 6
- [FEATURE REQ] Remove package reference workaround after Azure.Core new release
- Create an interface `IJsonModel` in `System.ClientModel` library
- [FEATURE REQ] Get rid of hardcoded OpenAI-endpoint in OpenAIClient HOT 1
- [BUG]Azure OpenAI library is failed in MAUI HOT 2
- [BUG] Azure.AI.OpenAI.Assistants - I'm not able to ask question about the content of a file uploaded in the Storage HOT 1
- [BUG] Azure Function with Event Hub trigger and `EventData` as argument, fails with serialization error HOT 1
- [BUG] Not overwrite in updateasync HOT 1
- Units not specified for buffer size HOT 1
- [BUG] Equality failures due to implicit cast on RequestFailedException.ErrorCode HOT 1
- Azure Maps SDK for Unity? HOT 1
- Documentation should mention about the parameter value in GetPageRangesDiffOptions HOT 1
- [BUG] Error while trying to access keys stored in Azure KeyVault HOT 4
- ClientModel: ClientRetryPolicy should consider `retry-after` header HOT 1
- [FEATURE REQ] Upgrade Azure.AI.OpenAI.Assistants to support latest API HOT 2
- Invalid URI: The format of the URI could not be determined HOT 1
- [BUG] Azure.Identity has a dependency to Windows.Forms (due to older MSAL) for all Windows builds HOT 1
- [FEATURE REQ] Azure.AI.OpenAI `include_usage` in chat completion options HOT 1
- Error uploading file when using Azure.AI.OpenAI.Assistants HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-sdk-for-net.