Skip to content

Commit b242752

Browse files
committed
Profiling experiments
1 parent 0630b8f commit b242752

File tree

17 files changed

+3331
-33
lines changed

17 files changed

+3331
-33
lines changed

build.mill

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import mill.scalalib.publish.Developer
2+
import mill.scalalib.publish.VersionControl
3+
import mill.scalalib.publish.License
4+
import mill.scalalib.publish.PomSettings
15
import mill.eval.Evaluator
26
import smithy4s.codegen.LSP
37
import com.goyeau.mill.scalafix.ScalafixModule
@@ -37,14 +41,37 @@ object slsSmithy extends CommonScalaModule with Smithy4sModule {
3741
)
3842
}
3943

44+
object profilingRuntime extends CommonScalaModule with PublishModule {
45+
def ivyDeps = Agg(
46+
ivy"io.pyroscope:agent:2.1.2",
47+
ivy"org.typelevel::cats-effect:3.6.3",
48+
ivy"org.typelevel::otel4s-sdk:0.13.1",
49+
ivy"org.typelevel::otel4s-sdk-exporter:0.13.1",
50+
ivy"org.typelevel::otel4s-experimental-metrics:0.7.0",
51+
)
52+
53+
def pomSettings: T[PomSettings] = PomSettings(
54+
description = "A runtime with pyroscope profiling and OpenTelemetry tracing",
55+
url = "",
56+
licenses = Seq(License.`MPL-2.0`),
57+
organization = "org.scala.abusers",
58+
versionControl = VersionControl.github("simple-scala-tooling", "simple-language-server"),
59+
developers = Seq(
60+
Developer("rochala", "Jędrzej Rochala", url = "https://github.com/rochala")
61+
)
62+
)
63+
64+
def publishVersion: T[String] = "0.0.1-SNAPSHOT"
65+
}
66+
4067
object sls extends CommonScalaModule {
4168

4269
def mainClass = Some("org.scala.abusers.sls.SimpleScalaServer")
4370

44-
def moduleDeps: Seq[JavaModule] = Seq(slsSmithy)
71+
def moduleDeps: Seq[JavaModule] = Seq(slsSmithy, profilingRuntime)
4572

4673
def ivyDeps = Agg(
47-
ivy"org.typelevel::cats-effect:3.6.2",
74+
ivy"org.typelevel::cats-effect:3.6.3",
4875
ivy"co.fs2::fs2-io:3.13.0-M2",
4976
ivy"io.scalaland::chimney:1.8.1",
5077
ivy"io.scalaland::chimney-java-collections:1.8.1",
@@ -55,7 +82,12 @@ object sls extends CommonScalaModule {
5582
ivy"org.scalameta:mtags-interfaces:1.5.1",
5683
ivy"com.evolution::scache:5.1.2",
5784
ivy"org.typelevel::cats-parse:1.1.0",
58-
ivy"io.get-coursier:interface:1.0.28"
85+
ivy"io.get-coursier:interface:1.0.28",
86+
)
87+
88+
def javacOptions = Seq(
89+
"-Dotel.service.name=simple-language-server",
90+
"-Dcats.effect.trackFiberContext=true"
5991
)
6092

6193
object test extends ScalaTests {

otel4s/docker-compose.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
services:
2+
otel-collector:
3+
image: otel/opentelemetry-collector-contrib
4+
command: [--config=/etc/otel-collector-config.yaml]
5+
volumes:
6+
- "./opentelemetry/otel-collector-config.yaml:/etc/otel-collector-config.yaml"
7+
ports:
8+
- "8888:8888" # Prometheus metrics exposed by the collector
9+
- "8889:8889" # Prometheus exporter metrics
10+
- "4317:4317" # OTLP gRPC receiver
11+
- "4318:4318" # OTLP http receiver
12+
networks:
13+
- static-network
14+
15+
tempo:
16+
image: grafana/tempo
17+
command: [ "-config.file=/etc/tempo.yaml" ]
18+
volumes:
19+
- "./tempo/tempo.yaml:/etc/tempo.yaml"
20+
ports:
21+
- "3200:3200"
22+
- "4317"
23+
- "4318"
24+
networks:
25+
- static-network
26+
27+
prometheus:
28+
image: prom/prometheus:latest
29+
volumes:
30+
- "./prometheus/prometheus.yaml:/etc/prometheus/prometheus.yml"
31+
ports:
32+
- "9090:9090"
33+
networks:
34+
- static-network
35+
36+
pyroscope:
37+
image: grafana/pyroscope
38+
ports:
39+
- "4040:4040"
40+
networks:
41+
- static-network
42+
43+
grafana:
44+
image: grafana/grafana
45+
restart: unless-stopped
46+
volumes:
47+
- "./grafana/datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml"
48+
- "./grafana/dashboards.yaml:/etc/grafana/provisioning/dashboards/dashboards.yaml"
49+
- "./grafana/dashboards/:/var/lib/grafana/dashboards/"
50+
ports:
51+
- "3000:3000"
52+
networks:
53+
- static-network
54+
55+
networks:
56+
static-network:

otel4s/grafana/dashboards.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: 1
2+
3+
providers:
4+
# <string> an unique provider name. Required
5+
- name: 'dashboards'
6+
# <int> Org id. Default to 1
7+
orgId: 1
8+
# <string> name of the dashboard folder.
9+
folder: ''
10+
# <string> folder UID. will be automatically generated if not specified
11+
folderUid: ''
12+
# <string> provider type. Default to 'file'
13+
type: file
14+
# <bool> disable dashboard deletion
15+
disableDeletion: false
16+
# <int> how often Grafana will scan for changed dashboards
17+
updateIntervalSeconds: 10
18+
# <bool> allow updating provisioned dashboards from the UI
19+
allowUiUpdates: true
20+
options:
21+
# <string, required> path to dashboard files on disk. Required when using the 'file' type
22+
path: /var/lib/grafana/dashboards
23+
# <bool> use folder names from filesystem to create folders in Grafana
24+
foldersFromFilesStructure: true

0 commit comments

Comments
 (0)