Skip to content

Instantly share code, notes, and snippets.

View dasiths's full-sized avatar
💭
Breaking and fixing things for the CSE team @ Microsoft

Dasith Wijesiriwardena dasiths

💭
Breaking and fixing things for the CSE team @ Microsoft
View GitHub Profile

https://www.linkedin.com/posts/akhilesh-mishra-0ab886124_the-moment-you-mention-%F0%9D%97%9E%F0%9D%98%82%F0%9D%97%AF%F0%9D%97%B2%F0%9D%97%BF%F0%9D%97%BB%F0%9D%97%B2%F0%9D%98%81%F0%9D%97%B2-activity-7343950304729583616-u0Zm/

The moment you mention 𝗞𝘂𝗯𝗲𝗿𝗻𝗲𝘁𝗲𝘀 in a Devops interview, expect a deep dive

Here are 17 Kubernetes questions I was asked that dive into architecture, troubleshooting, and real-world decision-making:

  1. Your pod keeps getting stuck in CrashLoopBackOff, but logs show no errors. How would you approach debugging and resolution?

  2. You have a StatefulSet deployed with persistent volumes, and one of the pods is not recreating properly after deletion. What could be the reasons, and how do you fix it without data loss?

@dasiths
dasiths / example.py
Created March 8, 2025 17:35
How to handle custom business specific context propagation in FastAPI and httpx using OpenTelemetry
import os
from typing import Optional, Dict, Any
from contextvars import ContextVar
from fastapi import FastAPI, Request, Depends, HTTPException
import httpx
import logging
import uvicorn
from functools import wraps
# OpenTelemetry imports
@dasiths
dasiths / promptflow-opentelemetry.py
Created May 3, 2024 14:46
Promptflow OpenTelemetry Custom Tracing Example
import logging
import threading
from typing import Dict, List
from azure.monitor.opentelemetry.exporter import (
AzureMonitorLogExporter,
AzureMonitorTraceExporter,
)
from flow_nodes.core.ConfigProvider import (
IsDevelopmentEnvironment,
@dasiths
dasiths / program.cs
Last active January 23, 2022 12:17
EF Core string to datetime/datetimeoffset value converter example with CAST SQL generation
using Microsoft.EntityFrameworkCore;
Console.WriteLine("Hello, World!");
using var x = new MyDbContext();
x.Database.EnsureCreated();
var paramValueDateTimeOffset = DateTimeOffset.Now.AddDays(-1);
var paramValueDateTime = DateTime.Now.AddDays(-1);
var query = x.CustomerLeases.Where(c => c.TextDateTime >= DateTimeOffset.Now
@dasiths
dasiths / TokenCredentialFactory.cs
Last active June 20, 2021 08:24
TokenCredential based on IConfiguration for .Azure Managed Identity in .NET
/*
More about Azure.Identity client library: https://devblogs.microsoft.com/azure-sdk/azure-identity-august-2020-ga/
Guidance on migrating from old Microsoft.Azure.Services.AppAuthentication library: https://docs.microsoft.com/en-us/dotnet/api/overview/azure/app-auth-migration
This is useful when the user account running the application locally in Visual Studio doesn't have permissions to the resources (i.e. Due to network restrictions/vpn or policy requirements).
We create a SP/AppRegistration and use that identity when running things locally.
TokenCredential is the base class for all credential types used for identity in Azure
like DefaultAzureCredential, ManagedIdentityCredential, EnvironmentCredential, ClientSecretCredential, VisualStudioCrdential etc (https://devblogs.microsoft.com/azure-sdk/azure-identity-august-2020-ga/#more-credential-types)
@dasiths
dasiths / trace.cs
Created May 14, 2021 13:58
Tracing + Telemetry using .NET and Application Insights
// Reading
// https://tsuyoshiushio.medium.com/correlation-with-activity-with-application-insights-1-overview-753a48a645fb
// https://tsuyoshiushio.medium.com/correlation-with-activity-with-application-insights-2-activity-deep-dive-2a4147919659
// https://medium.com/prospa-engineering/implementing-distributed-tracing-with-azures-application-insights-5a09cc1c200c
var activity = new Activity("Call to CosmosDB");
// activity.SetParentId("correlation id from request")
//RequestTelemetry for Request, DependencyTelemtry for Dependencies
using var operation = telemetryClient.StartOperation<DependencyTelemetry>(activity);