This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task CloneTeamPermissions() | |
{ | |
var gitApi = new GitHubClient(new ProductHeaderValue("my-app")); | |
var tokenAuth = new Credentials("finely-grained-pat-with-repo-permissions"); | |
gitApi.Credentials = tokenAuth; | |
const string organisationName = "your-org"; | |
const string teamToClonePermissionsFrom = "your-team"; | |
const string targetTeamToApplyPermissionsTo = "your-target-team"; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"IsEncrypted": false, | |
"Values": { | |
"AzureWebJobsStorage": "UseDevelopmentStorage=true", | |
"AAD.ClientId": "your-aad-client-id", | |
"AAD.Secret": "the-secret-value-for-the-client", | |
"AAD.Tenant": "your-aad-tenant-id", | |
"Azure.SubscriptionId": "your-subscription-id" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"criteria": { | |
"odata.type": "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", | |
"allOf": [ | |
{ | |
"name" : "1st criterion", | |
"metricName": "[parameters('metricName')]", | |
"metricNamespace": "[parameters('metricNamespace')]", | |
"dimensions":[], | |
"operator": "[parameters('operator')]", | |
"threshold" : "[parameters('threshold')]", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task CalculateMetrics() | |
{ | |
var processingWork = new List<Task>(); | |
var namespaces = await _azureManagementClient.ServiceBusNamespaces.ListAsync(); | |
foreach (var serviceBusNamespace in namespaces) | |
{ | |
var namespaceProcessor = ProcessServiceBusNamespace(serviceBusNamespace); | |
processingWork.Add(namespaceProcessor); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MetricsApiAccessTokenProvider | |
{ | |
private readonly CredentialConfiguration _settings; | |
public MetricsApiAccessTokenProvider(CredentialConfiguration settings) | |
{ | |
_settings = settings; | |
} | |
public async Task<string> GetAccessToken() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ServiceBusPercentageUsed | |
{ | |
private const string EveryFiveMinutes = "* */5 * * * *"; | |
[FunctionName("ServiceBusPercentageUsed")] | |
public static async Task Run( | |
[TimerTrigger(EveryFiveMinutes)] TimerInfo input, | |
[Inject] ServiceBusPercentageUsedMetricsGenerator metricsGenerator) | |
{ | |
await metricsGenerator.CalculateMetrics(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"time": "2019-04-01T16:34:20", | |
"data": { | |
"baseData": { | |
"metric": "CapacityUsedPercent", | |
"namespace": "ASOS Custom Metrics", | |
"dimNames": [ | |
"EntityName" | |
], | |
"series": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task Run([EventHubTrigger("HubName", | |
Connection = "EventHubConnectionStringSettingName", | |
ConsumerGroup = "Consumer-Group-If-Applicable")] EventData[] messageBatch, PartitionContext partitionContext, ILogger log) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EventStreamBacklogTracing | |
{ | |
public static void LogSequenceDifference(EventData message, PartitionContext context) | |
{ | |
var messageSequence = message.SystemProperties.SequenceNumber; | |
var lastEnqueuedSequence = context.RuntimeInformation.LastSequenceNumber; | |
var sequenceDifference = lastEnqueuedSequence - messageSequence; | |
var client = new TelemetryClient(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "2.0", | |
"extensions": { | |
"eventHubs": { | |
"batchCheckpointFrequency": 2, | |
"eventProcessorOptions": { | |
"maxBatchSize": 5, | |
"prefetchCount": 10, | |
"enableReceiverRuntimeMetric": true | |
} |