Skip to content

Instantly share code, notes, and snippets.

View thecraftman's full-sized avatar
🙂
Available

Ore-Aruwaji Tola thecraftman

🙂
Available
View GitHub Profile
@thecraftman
thecraftman / node.js
Last active January 4, 2024 16:09
Send Otel Node traces to Axiom
const opentelemetry = require('@opentelemetry/sdk-node');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-proto');
const { BatchSpanProcessor } = require('@opentelemetry/sdk-trace-base');
const { Resource } = require('@opentelemetry/resources');
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
// Initialize OTLP trace exporter
const traceExporter = new OTLPTraceExporter({
url: 'https://api.axiom.co/v1/traces',
@thecraftman
thecraftman / logs.py
Created June 20, 2023 13:27
logs to Axiom
import boto3
import requests
import os
import json
from urllib.parse import unquote_plus
s3_client = boto3.client('s3')
def lambda_handler(event, context):
# Retrieve bucket name and file_key from the S3 event
@thecraftman
thecraftman / swagger.yml
Created February 23, 2022 10:46
Axiom Swagger
basePath: /api/v1
consumes:
- application/json
definitions:
APLRequestWithOptions:
properties:
apl:
type: string
datasetMap:
additionalProperties:
@thecraftman
thecraftman / replication.yaml
Created January 30, 2022 14:06
Replication Controllers
apiVersion: v1
kind: ReplicationController
metadata:
name: expressapp-controller
spec:
replicas: 2
selector:
app: express-app
template:
metadata:
@thecraftman
thecraftman / secrets-file.yaml
Created August 14, 2021 18:29
Create your Kubernetes secrets in s file
apiVersion: v1
kind: Pod
metadata:
name: hello-world.example.com
labels:
app: hello-world
spec:
containers:
- name: docker-demo
image: tolatemitope/docker-demo
@thecraftman
thecraftman / secret-value.yaml
Created August 14, 2021 18:12
Generate secrets for Kubernetes using env
apiVersion: v1
kind: Pod
metadata:
name: hello-world.example.com
labels:
app: hello-world
spec:
containers:
- name: docker-demo
image: tolatemitope/docker-demo
@thecraftman
thecraftman / secret.yaml
Created August 14, 2021 17:58
secret yaml definition
apiVersion: v1
kind: Secret
metadata:
name: db-secret
type: Opaque
data:
password: cm9xcA==
username: cGFxs7dvcmQ=
apiVersion: v1
kind: Service
metadata:
name: helloworld-service
spec:
containers:
- name: docker-demo
image: tolatemitope/docker-demo
ports:
- containerPort: 5000
@thecraftman
thecraftman / service.yaml
Last active August 12, 2021 06:38
kubernetes service
apiVersion: v1
kind: Service
metadata:
name: helloworld-service
spec:
ports:
- port: 31001
nodePort: 31001
targetPort: python-port
protocol: TCP
@thecraftman
thecraftman / getatt.yaml
Last active July 16, 2021 20:30
GetAtt intrinsic function
Parameters:
NameOfService:
Description: "The name of the service this stack is to be used for."
Type: String
KeyName:
Description: "Name of existing EC2 KeyPar to enable SSH access into the server"
Type: AWS::EC2::KeyPair::KeyName
Outputs:
WebsiteURL:
Description: Website URL for EC2 Instance