Skip to content

Instantly share code, notes, and snippets.

View liamwh's full-sized avatar

Liam Woodleigh-Hardinge liamwh

View GitHub Profile
@liamwh
liamwh / +page.svelte
Last active May 3, 2024 13:37
SvelteKit Otel
<script lang="ts">
import type { UserView } from '$lib/stubs/auth';
import { getContext, onMount } from 'svelte';
import { goto } from '$app/navigation';
import { getContacts } from '$lib/repositories/contacts';
import { browser } from '$app/environment';
import { CONTACTS_STORE_KEY, USER_STORE_KEY } from '$lib/store-keys';
import type { Writable } from 'svelte/store';
import AddContactButton from '$lib/components/Contacts/AddContact/AddContactButton.svelte';
import { db } from '$lib/surrealdb';
@liamwh
liamwh / .env
Last active October 3, 2023 09:59
Grafana not working
OTEL_EXPORTER_OTLP_PASS="TOKEN_HERE"
OTEL_EXPORTER_OTLP_ENDPOINT="https://otlp-gateway-prod-eu-west-3.grafana.net/otlp"
OTEL_EXPORTER_OTLP_USER="632205"
OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
@liamwh
liamwh / axum-websockets.rs
Last active July 6, 2023 07:30
Axum Websocket example
use std::{net::SocketAddr, sync::Arc};
use axum::{
debug_handler,
extract::{ws::WebSocket, ConnectInfo, Path, Query, State, WebSocketUpgrade},
response::{IntoResponse, Json},
};
use cloudevents::{AttributesReader, Event};
use serde::Deserialize;
use tokio::sync::broadcast::Receiver;
@liamwh
liamwh / observability.rs
Created May 15, 2023 10:03
Observability configuration for a Rust service
use opentelemetry_otlp::WithExportConfig;
use tracing_bunyan_formatter::{BunyanFormattingLayer, JsonStorageLayer};
use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt;
const OTEL_EXPORTER_OTLP_ENDPOINT_ENV_VAR: &str = "OTEL_EXPORTER_OTLP_ENDPOINT";
const OTEL_EXPORTER_OTLP_ENDPOINT_DEFAULT: &str = "http://localhost:4317";
const OBSERVABILITY_SERVICE_NAME_ENV_VAR: &str = "OBSERVABILITY_SERVICE_NAME";
const OBSERVABILITY_SERVICE_NAME_DEFAULT: &str = "my-service-name";

Keybase proof

I hereby claim:

  • I am liamwh on github.
  • I am liamwh (https://keybase.io/liamwh) on keybase.
  • I have a public key ASD8Wm6KFeIXxbl1c4I254nBOeuIisOhSIGBrc1HjjbIGwo

To claim this, I am signing this object: