Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Batum paulbatum

View GitHub Profile
View functions-eventhubs-appinsights-queries.kql
// Query Notes
// -------------
// 1. This query display detailed information for Event Hub triggered functions using telemetry emitted by the Event Hubs extension 4.2.0 and greater.
//
// 2. The data is only emitted in the correct format if batched dispatch is used i.e. the function accepts multiple events for each execution. This is the recommended way to write Event Hub triggered functions. For an example see the documentation https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-hubs-trigger?tabs=csharp
//
// 3. If sampling is enabled in Application Insights, then there might be gaps in the data. To configure sampling see https://docs.microsoft.com/en-us/azure/azure-functions/configure-monitoring?tabs=v2#configure-sampling
//
// 4. The dispatchTimeMilliseconds value approximates the length of time between when the event was written to the event hub and when it was picked up by the Function App for processing. Note that:
// a) dispatchTimeMilliseconds could be negative or othe
@paulbatum
paulbatum / costcalculator.cs
Last active Apr 28, 2019
Azure Functions pricing calculation
View costcalculator.cs
const decimal executionCountCost = 0.20m / 1000000m;
const decimal gbSecCost = 0.000016m;
const decimal executionUnitsToGbSecConversion = 1m / (1024 * 1000);
long executionCountPerHour = 6500012;
long executionUnitsPerHour = 90305037184;
int runDurationDays = 9;
Console.WriteLine("All prices in USD");
@paulbatum
paulbatum / Function1.cs
Last active Jan 24, 2019
Event Hub Batch Example
View Function1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.EventHubs;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
namespace FunctionApp12
@paulbatum
paulbatum / gist:f7170955a46971456da2e69926af9d9d
Created Oct 19, 2018
Notification Hubs WebJobs SDK Extension error
View gist:f7170955a46971456da2e69926af9d9d
DryIoc.ContainerException
HResult=0x80131509
Message=Unable to get constructor of NotificationHubsExtensionConfigProvider using provided constructor selector when resolving singleton NotificationHubsExtensionConfigProvider: IExtensionConfigProvider {ServiceKey=DefaultKey(4), ReturnDefaultIfNotRegistered} #105
in wrapper IEnumerable<IExtensionConfigProvider> as parameter "registeredExtensions" #1
in singleton DefaultExtensionRegistryFactory: IExtensionRegistryFactory #52
from container.
Source=Microsoft.Azure.WebJobs.Script.WebHost
StackTrace:
at DryIoc.Throw.ThrowIfNull[T](T arg, Int32 error, Object arg0, Object arg1, Object arg2, Object arg3) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:line 8939
at DryIoc.ReflectionFactory.CreateExpressionOrDefault(Request request) in C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\DependencyInjection\DryIoc\Container.cs:line 6996
View host.json
{
"version": "2.0",
"extensions": {
"http": {
"maxConcurrentRequests": 1,
"maxOutstandingRequests": 4
}
}
}
View assemblyload.md

Assembly Resolution in Azure Functions

The goal of this post is to help .NET developers better understand assembly resolution and loading problems and limitations.

One common provide guidance on how to avoid or mitigate some of those issues, when possible, and go over some of the details on how this will be improved in the next version of Azure Functions.

In the following sections, we dive into the details of how things work today

View myfunctions.cs
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Host;
namespace FunctionApp14
{
@paulbatum
paulbatum / Test1.cs
Created Dec 22, 2017
Example test project for testing the default http trigger in azure functions
View Test1.cs
using System;
using System.Diagnostics;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Web.Http;
using FunctionApp22_UnitTesting;
using Microsoft.Azure.WebJobs.Host;
using Xunit;
@paulbatum
paulbatum / BCryptTest.cs
Created Nov 24, 2017
Functions Tiered Jit Test
View BCryptTest.cs
using System.IO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.WebJobs.Host;
using Newtonsoft.Json;
namespace TieredJitTest