Skip to content

Instantly share code, notes, and snippets.

View anuraaga's full-sized avatar
🐻
Coding

Anuraag (Rag) Agrawal anuraaga

🐻
Coding
View GitHub Profile
@anuraaga
anuraaga / PrismaMetricProducer.ts
Created November 7, 2023 07:08
Exporting prisma metrics with OTel
import { PrismaClient } from 'generatedprisma';
import {
AggregationTemporality,
CollectionResult,
DataPointType,
InstrumentType,
MetricCollectOptions,
ScopeMetrics,
} from '@opentelemetry/sdk-metrics';
import { Resource } from '@opentelemetry/resources';
200000
200001
200002
200003
200004
999999
901318
901410
905100
905110
# Example to use Docker instead of containerd & nerdctl
# $ limactl start ./docker.yaml
# $ limactl shell docker docker run -it -v $HOME:$HOME --rm alpine
# Hint: To allow `docker` CLI on the host to connect to the Docker daemon running inside the guest,
# add `NoHostAuthenticationForLocalhost yes` in ~/.ssh/config , and then run the following commands:
# $ export DOCKER_HOST=ssh://localhost:60006
# $ docker ...
# If ssh:// ... does not work, try the following commands:
// Code generated by Wire protocol buffer compiler, do not edit.
// Source: opentelemetry.proto.trace.v1.Span in opentelemetry/proto/trace/v1/trace.proto
package io.opentelemetry.proto.trace.v1.internal;
import io.opentelemetry.exporter.otlp.internal.ProtoEnumInfo;
import io.opentelemetry.exporter.otlp.internal.ProtoFieldInfo;
public final class Span {
public static final ProtoFieldInfo TRACE_ID = ProtoFieldInfo.create(1, 10, "traceId");
Benchmark Mode Cnt Score Error Units
WeakMapBenchmark.caffeineMap_fiveThreads avgt 15 0.531 ± 0.038 us/op
WeakMapBenchmark.caffeineMap_fiveThreads:heap.total.after avgt 15 200627541.333 ± 25175702.522 bytes
WeakMapBenchmark.caffeineMap_fiveThreads:heap.total.before avgt 15 50890888.533 ± 4902182.376 bytes
WeakMapBenchmark.caffeineMap_fiveThreads:heap.used.after avgt 15 65596400.533 ± 36362333.631 bytes
WeakMapBenchmark.caffeineMap_fiveThreads:heap.used.before avgt 15 9423175.467 ± 8210.121 bytes
WeakMapBenchmark.caffeineMap_fiveThreads:·gc.alloc.rate avgt 15 1333.782 ± 94.251 MB/sec
WeakMapBenchmark.caffeineMap_fiveThreads:·gc.alloc.rate.norm
MpscArrayQueue (PR)
```
MpscArrayQueue
Benchmark (delayMs) Mode Cnt Score Error Units
BatchSpanProcessorMultiThreadBenchmark.export_01Thread 0 thrpt 5 2296429.801 ± 272876.870 ops/s
BatchSpanProcessorMultiThreadBenchmark.export_01Thread:droppedSpans 0 thrpt 5 3627.383 ± 6572.121 ops/s
BatchSpanProcessorMultiThreadBenchmark.export_01Thread:exportedSpans 0 thrpt 5 7326458.460 ± 13975117.084 ops/s
BatchSpanProcessorMultiThreadBenchmark.export_01Thread:·gc.alloc.rate 0 thrpt 5 893.120 ± 105.885 MB/sec
BatchSpanProcessorMultiThreadBenchmark.export_01Thread:·gc.alloc.rate.norm 0 thrpt 5 448.864 ± 0.104 B/op
@anuraaga
anuraaga / gist:6676c9f8b17de23164c3a367c85fd088
Created December 7, 2020 05:13
Context implementations
Benchmark (size) Mode Cnt Score Error Units
ContextBenchmark.readAll 2 thrpt 15 58908.213 ± 515.437 ops/ms
ContextBenchmark.readAll:·gc.alloc.rate 2 thrpt 15 ≈ 10⁻⁴ MB/sec
ContextBenchmark.readAll:·gc.alloc.rate.norm 2 thrpt 15 ≈ 10⁻⁵ B/op
ContextBenchmark.readAll:·gc.count 2 thrpt 15 ≈ 0 counts
ContextBenchmark.readAll 3 thrpt 15 38788.407 ± 1441.183 ops/ms
ContextBenchmark.readAll:·gc.alloc.rate 3 thrpt 15 ≈ 10⁻⁴ MB/sec
ContextBenchmark.readAll:·gc.alloc.rate.norm 3 thrpt 15 ≈ 10⁻⁵ B/op
ContextBenchmark.readAll:·gc.count 3 thrpt 15 ≈ 0 counts
ContextBenchmark.readAll
Trie
Benchmark (size) Mode Cnt Score Error Units
ContextBenchmark.readAll 2 thrpt 15 58908.213 ± 515.437 ops/ms
ContextBenchmark.readAll:·gc.alloc.rate 2 thrpt 15 ≈ 10⁻⁴ MB/sec
ContextBenchmark.readAll:·gc.alloc.rate.norm 2 thrpt 15 ≈ 10⁻⁵ B/op
ContextBenchmark.readAll:·gc.count 2 thrpt 15 ≈ 0 counts
ContextBenchmark.readAll 3 thrpt 15 38788.407 ± 1441.183 ops/ms
ContextBenchmark.readAll:·gc.alloc.rate 3 thrpt 15 ≈ 10⁻⁴ MB/sec
ContextBenchmark.readAll:·gc.alloc.rate.norm 3 thrpt 15 ≈ 10⁻⁵ B/op
ContextBenchmark.readAll:·gc.count 3 thrpt 15 ≈ 0 counts
@anuraaga
anuraaga / gist:2f2187cf1886197b5d65c2018001750d
Created October 27, 2020 08:20
ContextBenchmark - array
Benchmark (size) Mode Cnt Score Error Units
ContextBenchmark.readAll 2 thrpt 5 59879.753 ± 7899.794 ops/ms
ContextBenchmark.readAll:·gc.alloc.rate 2 thrpt 5 ≈ 10⁻⁴ MB/sec
ContextBenchmark.readAll:·gc.alloc.rate.norm 2 thrpt 5 ≈ 10⁻⁵ B/op
ContextBenchmark.readAll:·gc.count 2 thrpt 5 ≈ 0 counts
ContextBenchmark.readAll 3 thrpt 5 50794.621 ± 7431.335 ops/ms
ContextBenchmark.readAll:·gc.alloc.rate 3 thrpt 5 ≈ 10⁻⁴ MB/sec
ContextBenchmark.readAll:·gc.alloc.rate.norm 3 thrpt 5 ≈ 10⁻⁵ B/op
ContextBenchmark.readAll:·gc.count 3 thrpt 5 ≈ 0 counts
ContextBenchmark.readAll
@anuraaga
anuraaga / gist:b67d32c6a08ad9d2a38d39fd357efb00
Created October 27, 2020 07:59
ContextBenchmark - trie
Benchmark (size) Mode Cnt Score Error Units
ContextBenchmark.readAll 2 thrpt 5 55420.529 ± 14328.822 ops/ms
ContextBenchmark.readAll:·gc.alloc.rate 2 thrpt 5 ≈ 10⁻⁴ MB/sec
ContextBenchmark.readAll:·gc.alloc.rate.norm 2 thrpt 5 ≈ 10⁻⁵ B/op
ContextBenchmark.readAll:·gc.count 2 thrpt 5 ≈ 0 counts
ContextBenchmark.readAll 3 thrpt 5 44838.736 ± 5562.721 ops/ms
ContextBenchmark.readAll:·gc.alloc.rate 3 thrpt 5 ≈ 10⁻⁴ MB/sec
ContextBenchmark.readAll:·gc.alloc.rate.norm 3 thrpt 5 ≈ 10⁻⁵ B/op
ContextBenchmark.readAll:·gc.count 3 thrpt 5 ≈ 0 counts
ContextBenchmark.readAll