I need to read following redis metrics
1. Version
2. Uptime
3. No of Jobs
4. Overall Health
5. Memory Stats (Allocated, Size in use)
6. Latency Details
in ASP.Net MVC application.
My question is
how can consume radis API in MVC controller to get above metrics?
Is there any other way(best practice) to do this?
I have read the redis metrics using StackExchange.Redis NuGet package in following way
ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost,allowAdmin=true");
IServer server = redis.GetServer("localhost", {portnumber});
var redisConfigurations = server.Info().ToList();
Related
We have been using high level API's to connect to dynamo db and fetching the data. Pagination was not setup before but since we have lot of data now, we want to setup pagination.
var scanConditions = new List<ScanCondition>();
scanConditions.Add(new ScanCondition("PartitionKey", ScanOperator.BeginsWith, "data"));
var files = await Context.ScanAsync(scanConditions).GetRemainingAsync();
return files.Select(i => i.Data).OrderByDescending(i => i.Date).ToList();
I read the aws documetation but did not find any info regarding pagination for high level api. Is pagination available for high level api? If not what options do I have here?
Thanks
You can use paginator methods using this .NET API
https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/DynamoDBv2/TIDynamoDBv2PaginatorFactory.html
THis is part of the AWS SDK for .NET V3.
When I use the Data sampling settings on Azure portal — it really works: reduces the amount of data ingestion.
It logs only 4% of the successful requests and this is good.
However it logs only 4% of the all exceptions. And this is bad. Because I miss the lonely and rare exceptions.
How to configure Azure Application Insights for Asp.Net Core 5.0 to send only 4% of Requests and 100% of Exceptions?
Can it be done in Asp.Net Core Startup.ConfigureServices method?
I think you can refer to this chapter
It mentioned that in asp.net core, we can disable the default adaptive sampling and set fixed-rate sampling by builder.UseSampling(fixedSamplingPercentage);, and according to the sdk, we can also set include and exclude options
public static TelemetryProcessorChainBuilder UseSampling(this TelemetryProcessorChainBuilder builder, double samplingPercentage, string excludedTypes = null, string includedTypes = null);
my code here:
var configuration = app.ApplicationServices.GetService<TelemetryConfiguration>();
var builder = configuration.DefaultTelemetrySink.TelemetryProcessorChainBuilder;
// For older versions of the Application Insights SDK, use the following line instead:
// var builder = configuration.TelemetryProcessorChainBuilder;
// Using fixed rate sampling
double fixedSamplingPercentage = 10;
string excludedTypes = "Exception";
string includedTypes = "Request";
builder.UseSampling(fixedSamplingPercentage, excludedTypes, includedTypes);
builder.Build();
Each request here will lead to an exception in my test, and here's the application insights detail:
Is there a way to configure near cache for a thin client?
It appears that this API is missing from .NET NuGet package. Here is sample code:
var ignite = Ignition.StartClient(cfg);
var cache = ignite.GetOrCreateCache<string, string>( "mycache");
GetOrCreateCache seems to be missing an overload that takes near cache configuration... Is this something that is simply not developed yet?
No, thin clients doesn't support near caches.
For your case you should use thick client and configure near cache as described here:
https://apacheignite-net.readme.io/docs/near-caches
According to the Azure DevOps Services REST API Reference, the request URI has the following format:
https://{instance}[/{team-project}]/_apis[/{area}]/{resource}?api-version={version}
Regarding the api-version:
Every API request should include an api-version to avoid having your app or service break as APIs evolve.
I started using the .NET client libraries for Azure DevOps Services (and TFS) to manage dashboards programmatically.
I am able to connect to Azure DevOps using a Personal Access Token:
var credential = new VssBasicCredential(string.Empty, "PersonalAccessToken");
using (VssConnection connection = new VssConnection(new Uri("...."), credential))
using (var client = connection.GetClient<DashboardHttpClient>())
{
// ...
}
How can I specify the API version? Does it still make sense to do it, when using the .NET client libraries?
The API version is decided by the client libraries. You can confirm this by disassembling them (e.g. using ILSpy).
For example, in the current stable release of Microsoft.TeamFoundationServer.Client, DashboardHttpClientBase has a CreateDashboardAsnc method that makes the following call:
this.SendAsync<Dashboard>(..., new ApiResourceVersion("4.1-preview.2"), ...);
Is there any way to flush aws API gateway cache for the particular stage through c# code?
I have a requirement to synchronize my api with frequently changing data at the backend.
Once data updated in database my code should clear the api gateway cache so that user will see the updated result on the UI.
I found articles in aws which uses CLI commands to clear cache.
Below is the link for reference
Please help me to find the similar c# code for the same.
{
AmazonAPIGatewayClient amazonAPIGatewayClient = new
AmazonAPIGatewayClient(Amazon.RegionEndpoint.EUWest1);
FlushStageCacheRequest req = new FlushStageCacheRequest
{
RestApiId = "APIID",
StageName = "yourAPIstagename"
};
FlushStageCacheResponse response =
amazonAPIGatewayClient.FlushStageCacheAsync(req).Result;
}