Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.env
dist-newstyle/
*.eventlog
*.eventlog.json
*.hp
*.prof
/nix/*/result
cabal.project.local
28 changes: 28 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ packages: examples/oddball
packages: examples/parfib
packages: examples/spectral-norm

if impl(ghc >=9.10)
packages: examples/ecosim

source-repository-package
type: git
location: https://github.com/well-typed/eventlog-socket
Expand Down Expand Up @@ -43,3 +46,28 @@ if impl(ghc >=9.4)
allow-newer:
, concurrent-machines-0.3.1.5:base
, concurrent-machines-0.3.1.5:containers

if impl(ghc >=9.12)
allow-newer:
, proto-lens-runtime:base
, proto-lens-runtime:containers
, proto-lens:base
, proto-lens:ghc-prim

source-repository-package
type: git
location: https://github.com/fendor/hs-opentelemetry.git
tag: bc65d8a2e7d31f51226590d22af2a531b9363e2b
subdir: otlp

if impl(ghc >=9.10)
source-repository-package
type: git
location: https://github.com/well-typed/ghc-stack-profiler.git
tag: 2fb2410b1abffa6be7b1d5e993ae089f5a61d2c9
subdir: ghc-stack-profiler

source-repository-package
type: git
location: https://github.com/well-typed/ghc-stack-annotations.git
tag: 0667af1cec1b20ba7fed4a5de675afe81a8ae07d
43 changes: 43 additions & 0 deletions dockerfiles/Dockerfile.ecosim
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# syntax=docker/dockerfile:1.7-labs

# To build this image, run:
# docker build --tag well-typed/eventlog-live-example-ecosim:0.1.0.0 --file ./dockerfiles/Dockerfile.ecosim .

# Use the Haskell image with GHC 9.10
# See: https://hub.docker.com/_/haskell
FROM haskell:9.10-slim-bullseye AS build

# Configure eventlog-live
ARG GHC_EVENTLOG_SOCKET="/tmp/ghc_eventlog.sock"
ENV GHC_EVENTLOG_SOCKET=${GHC_EVENTLOG_SOCKET}

# Copy required packages to container
WORKDIR "/eventlog-live"
COPY --parents \
"./eventlog-live/" \
"./examples/ecosim/" \
"/eventlog-live/"

# Create cabal.project file
COPY <<EOF /eventlog-live/cabal.project
packages: examples/ecosim
packages: eventlog-live
EOF

# Build ecosim
RUN <<EOF
cabal update
mkdir "/eventlog-live/bin"
cabal install \
--overwrite-policy=always \
--install-method=copy \
--installdir="/eventlog-live/bin" \
ecosim
EOF

# Copy ecosim to output stage
FROM debian:bullseye-slim AS output
COPY --from=build "/eventlog-live/bin/ecosim" "/bin/ecosim"

# Run command
CMD sleep 5 && ecosim --unix ${GHC_EVENTLOG_SOCKET} --interval=0
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile.eventlog-live-otelcol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ package grpc-spec
EOF

# Install protoc
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y protobuf-compiler
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y protobuf-compiler libsnappy-dev

# Build eventlog-live-otelcol
RUN <<EOF
Expand Down
5 changes: 5 additions & 0 deletions dockerfiles/Dockerfile.oddball
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ COPY --parents \
"./examples/oddball/" \
"/eventlog-live/"

# Create cabal.project file
COPY <<EOF /eventlog-live/examples/oddball/cabal.project
packages: .
EOF

# Build oddball
RUN <<EOF
cabal update
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"description": "Dashboard for the RTS Callstack Profile of your program",
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 4,
"links": [],
"panels": [
{
"datasource": {
"type": "grafana-pyroscope-datasource",
"uid": "P02E4190217B50628"
},
"description": "Flamegraph of the RTS Callstack",
"fieldConfig": {
"defaults": {
"unit": "Sample"
},
"overrides": []
},
"gridPos": {
"h": 16,
"w": 24,
"x": 0,
"y": 0
},
"id": 1,
"options": {},
"pluginVersion": "12.2.1",
"targets": [
{
"datasource": {
"type": "grafana-pyroscope-datasource",
"uid": "P02E4190217B50628"
},
"groupBy": [],
"labelSelector": "{}",
"profileTypeId": "process_cpu:stack:samples::",
"queryType": "profile",
"refId": "A",
"spanSelector": []
}
],
"title": "RTS Stack Profile",
"type": "flamegraph"
}
],
"preload": false,
"schemaVersion": 42,
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "browser",
"title": "Eventlog Stack Profile",
"uid": "ad7v28q",
"version": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ datasources:
type: tempo
access: proxy
url: http://tempo:3200
- name: Pyroscope
type: grafana-pyroscope-datasource
access: proxy
url: http://pyroscope:4040
7 changes: 7 additions & 0 deletions dockerfiles/eventlog-live-otelcol/config/otelcol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ exporters:
insecure: true
prometheus:
endpoint: "0.0.0.0:9090"
otlp/pyroscope:
endpoint: "pyroscope:4040"
tls:
insecure: true

service:
pipelines:
Expand All @@ -33,3 +37,6 @@ service:
traces:
receivers: [otlp]
exporters: [debug, otlp/tempo]
profiles:
receivers: [otlp]
exporters: [debug, otlp/pyroscope]
Empty file.
19 changes: 18 additions & 1 deletion dockerfiles/eventlog-live-otelcol/docker-compose-external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ services:
interval: 1m
timeout: 10s
retries: 5
environment:
- GF_PLUGINS_PREINSTALL_SYNC=grafana-pyroscope-app
volumes:
- "./config/grafana-datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml"
- "./config/grafana-dashboards.yaml:/etc/grafana/provisioning/dashboards/dashboards.yaml"
- "./config/grafana-dashboards-eventlog-heap.json:/var/lib/grafana/dashboards/eventlog-heap.json"
- "./config/grafana-dashboards-eventlog-logs.json:/var/lib/grafana/dashboards/eventlog-logs.json"
- "./config/grafana-dashboards-eventlog-stack-profile.json:/var/lib/grafana/dashboards/eventlog-stack-profile.json"
- "./config/grafana-dashboards-eventlog-threads.json:/var/lib/grafana/dashboards/eventlog-threads.json"

loki:
Expand All @@ -28,16 +31,20 @@ services:

otelcol:
# container_name: otelcol
image: otel/opentelemetry-collector-contrib:latest
image: otel/opentelemetry-collector-contrib:0.140.1

depends_on:
loki:
condition: "service_started"
prometheus:
condition: "service_started"
tempo:
condition: "service_started"
pyroscope:
condition: "service_started"
command:
- "--config=/etc/otelcol/config.yaml"
- "--feature-gates=service.profilesSupport"
volumes:
- "./config/otelcol.yaml:/etc/otelcol/config.yaml"
ports:
Expand All @@ -55,6 +62,16 @@ services:
ports:
- "9090:9090" # Prometheus

pyroscope:
# container_name: pyroscope
image: grafana/pyroscope:1.16.0
command:
- "-config.file=/etc/pyroscope.yaml"
volumes:
- "./config/pyroscope.yaml:/etc/pyroscope.yaml"
ports:
- 4040:4040 # Pyroscope

tempo:
# container_name: tempo
image: grafana/tempo:latest
Expand Down
14 changes: 14 additions & 0 deletions dockerfiles/eventlog-live-otelcol/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ services:
- "--eventlog-socket=/run/ghc-eventlog-socket/ghc-eventlog.sock"
- "-hT"
- "--otelcol-host=otelcol"
- "--eventlog-flush-interval=1"

grafana:
# container_name: grafana
Expand All @@ -41,11 +42,14 @@ services:
interval: 1m
timeout: 10s
retries: 5
environment:
- GF_PLUGINS_PREINSTALL_SYNC=grafana-pyroscope-app
volumes:
- "./config/grafana-datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml"
- "./config/grafana-dashboards.yaml:/etc/grafana/provisioning/dashboards/dashboards.yaml"
- "./config/grafana-dashboards-eventlog-heap.json:/var/lib/grafana/dashboards/eventlog-heap.json"
- "./config/grafana-dashboards-eventlog-logs.json:/var/lib/grafana/dashboards/eventlog-logs.json"
- "./config/grafana-dashboards-eventlog-stack-profile.json:/var/lib/grafana/dashboards/eventlog-stack-profile.json"
- "./config/grafana-dashboards-eventlog-threads.json:/var/lib/grafana/dashboards/eventlog-threads.json"

loki:
Expand All @@ -70,6 +74,7 @@ services:
condition: "service_started"
command:
- "--config=/etc/otelcol/config.yaml"
- "--feature-gates=service.profilesSupport"
volumes:
- "./config/otelcol.yaml:/etc/otelcol/config.yaml"
ports:
Expand All @@ -87,6 +92,15 @@ services:
ports:
- "9090:9090" # Prometheus

pyroscope:
# container_name: pyroscope
image: grafana/pyroscope:1.16.0
command: ["-config.file=/etc/pyroscope.yaml"]
volumes:
- "./config/pyroscope.yaml:/etc/pyroscope.yaml"
ports:
- 4040:4040 # Pyroscope

tempo:
# container_name: tempo
image: grafana/tempo:latest
Expand Down
5 changes: 5 additions & 0 deletions eventlog-live-otelcol/data/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,8 @@ processors:
name: ghc_eventlog_ThreadState
description: A trace of thread state changes (either running or stopped).
export: false
profiles:
stack_sample:
name: ghc_eventlog_StackSampleProfile
description: A thread RTS callstack sample.
export: 5s # one of [boolean, `${number}x`]
Loading
Loading