Skip to content

Instantly share code, notes, and snippets.

View sgsharma's full-sized avatar
💭
Sleeping

Sasha Sharma sgsharma

💭
Sleeping
View GitHub Profile
@sgsharma
sgsharma / otel-config.yaml
Created November 1, 2024 19:18 — forked from puckpuck/otel-config.yaml
otel span events to span attributes
receivers:
otlp:
protocols:
grpc:
http:
exporters:
otlp/honeycomb:
endpoint: api.honeycomb.io:443
headers:
@sgsharma
sgsharma / ssm_get_param.py
Created February 16, 2024 06:21
Get SSM parameter value from lambda
# boto3 docs here: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ssm/client/get_parameter.html
# make sure lambda role has policy/AmazonSSMFullAccess
import boto3
client = boto3.client('ssm')
def get_ssm_param(param: str) -> str:
session = boto3.session.Session()
ssm = session.client("ssm")
@sgsharma
sgsharma / README.md
Last active November 28, 2023 20:45
ec2_metrics_board

Prerequisites

You must have terraform installed. Follow these directions to install for your platform.

You will need a Honeycomb API key with the adequate permissions to create boards, queries etc.. Once you have the API key, you can set it like so:

export HONEYCOMB_API_KEY=<YOUR_API_KEY>

Or define it via the api_key variable.

@sgsharma
sgsharma / Parse aurora mysql logs
Last active May 31, 2023 08:12
Parse aurora mysql logs using lambda and send to Honeycomb
Parse Aurora mysql logs using cloudwatch, kinesis firehose, and lambda
receivers:
hostmetrics:
collection_interval: 15s
scrapers:
cpu:
memory:
metrics:
system.memory.utilization:
enabled: true
load:
@sgsharma
sgsharma / app.py
Created September 2, 2022 02:13
Sample Flask app
from collections import namedtuple
from random import choice
from apig_wsgi import make_lambda_handler
from flask import Flask, jsonify
Tax = namedtuple("Tax", ("sales_tax", "state"))
taxes = [
Tax(9, "California"),
@sgsharma
sgsharma / __main__.py
Last active July 9, 2022 03:55
pulumi_hny_query
"""A Python Pulumi program"""
import pulumi
from pulumi_honeycomb import Query, QueryAnnotation, get_query_specification
_DATASET = "microservices-demo"
query_spec = get_query_specification(
calculations=[
{
@sgsharma
sgsharma / consume.js
Created March 21, 2022 05:11
Node get/set context
require("./tracing.js");
const { SpanKind } = require("@opentelemetry/api");
const api = require("@opentelemetry/api");
const axios = require('axios');
const { kafka } = require("./kafka.js");
const tracer = api.trace.getTracer("message-consumer");
async function handleMessage(message){
@sgsharma
sgsharma / skip_ci
Created February 11, 2021 05:07
Skip CI build in CircleCI
# To skip building on a commit just include `[ci skip]` or `[skip ci]` to your commit message in which case CircleCi will skip that commit
@sgsharma
sgsharma / set_pip_index_url.sh
Created February 10, 2021 22:47
Set pip index URL
pip config set global.extra-index-url https://pypi.org/simple