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
44 changes: 40 additions & 4 deletions build.mill
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import mill.scalalib.publish.Developer
import mill.scalalib.publish.VersionControl
import mill.scalalib.publish.License
import mill.scalalib.publish.PomSettings
import mill.eval.Evaluator
import smithy4s.codegen.LSP
import com.goyeau.mill.scalafix.ScalafixModule
Expand Down Expand Up @@ -37,25 +41,57 @@ object slsSmithy extends CommonScalaModule with Smithy4sModule {
)
}

object profilingRuntime extends CommonScalaModule with PublishModule {
def ivyDeps = Agg(
ivy"io.pyroscope:agent:2.1.2",
ivy"org.typelevel::cats-effect:3.6.3",
ivy"org.typelevel::otel4s-sdk:0.13.1",
ivy"org.typelevel::otel4s-sdk-exporter:0.13.1",
ivy"org.typelevel::otel4s-experimental-metrics:0.7.0",
ivy"org.typelevel::otel4s-instrumentation-metrics:0.13.1"
)

def pomSettings: T[PomSettings] = PomSettings(
description = "A runtime with pyroscope profiling and OpenTelemetry tracing",
url = "",
licenses = Seq(License.`MPL-2.0`),
organization = "org.scala.abusers",
versionControl = VersionControl.github("simple-scala-tooling", "simple-language-server"),
developers = Seq(
Developer("rochala", "Jędrzej Rochala", url = "https://github.com/rochala")
)
)

def publishVersion: T[String] = "0.0.1-SNAPSHOT"
}

object sls extends CommonScalaModule {

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

def moduleDeps: Seq[JavaModule] = Seq(slsSmithy)
def moduleDeps: Seq[JavaModule] = Seq(slsSmithy, profilingRuntime)

override def forkArgs: T[Seq[String]] = Seq(
"-Dcats.effect.trackFiberContext=true"
)

def ivyDeps = Agg(
ivy"org.typelevel::cats-effect:3.6.2",
ivy"org.typelevel::cats-effect:3.6.3",
ivy"co.fs2::fs2-io:3.13.0-M2",
ivy"io.scalaland::chimney:1.8.1",
ivy"io.scalaland::chimney-java-collections:1.8.1",
ivy"tech.neander::jsonrpclib-fs2::$jsonrpcVersion",
ivy"ch.qos.logback:logback-classic:1.4.14",
ivy"com.lihaoyi::os-lib:0.11.4",
ivy"org.polyvariant.smithy4s-bsp::bsp4s:0.5.0",
ivy"org.scalameta:mtags-interfaces:1.5.1",
ivy"org.scalameta:mtags-interfaces:1.6.3",
ivy"com.evolution::scache:5.1.2",
ivy"org.typelevel::cats-parse:1.1.0",
ivy"io.get-coursier:interface:1.0.28"
ivy"io.get-coursier:interface:1.0.28",
)

def javacOptions = Seq(
"-Dotel.service.name=simple-language-server",
)

object test extends ScalaTests {
Expand Down
63 changes: 63 additions & 0 deletions otel4s/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
services:
otel-collector:
image: otel/opentelemetry-collector-contrib
command: [--config=/etc/otel-collector-config.yaml]
volumes:
- "./opentelemetry/otel-collector-config.yaml:/etc/otel-collector-config.yaml"
ports:
- "8888:8888" # Prometheus metrics exposed by the collector
- "8889:8889" # Prometheus exporter metrics
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP http receiver
networks:
- static-network

tempo:
image: grafana/tempo
command: [ "-config.file=/etc/tempo.yaml" ]
volumes:
- "./tempo/tempo.yaml:/etc/tempo.yaml"
ports:
- "3200:3200"
- "4317"
- "4318"
networks:
- static-network

prometheus:
image: prom/prometheus:latest
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--web.enable-remote-write-receiver'
volumes:
- "./prometheus/prometheus.yaml:/etc/prometheus/prometheus.yml"
ports:
- "9090:9090"
networks:
- static-network

pyroscope:
image: grafana/pyroscope
ports:
- "4040:4040"
networks:
- static-network

grafana:
image: grafana/grafana
restart: unless-stopped
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_DISABLE_LOGIN_FORM=true
volumes:
- "./grafana/datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml"
- "./grafana/dashboards.yaml:/etc/grafana/provisioning/dashboards/dashboards.yaml"
- "./grafana/dashboards/:/var/lib/grafana/dashboards/"
ports:
- "3000:3000"
networks:
- static-network

networks:
static-network:
24 changes: 24 additions & 0 deletions otel4s/grafana/dashboards.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: 1

providers:
# <string> an unique provider name. Required
- name: 'dashboards'
# <int> Org id. Default to 1
orgId: 1
# <string> name of the dashboard folder.
folder: ''
# <string> folder UID. will be automatically generated if not specified
folderUid: ''
# <string> provider type. Default to 'file'
type: file
# <bool> disable dashboard deletion
disableDeletion: false
# <int> how often Grafana will scan for changed dashboards
updateIntervalSeconds: 10
# <bool> allow updating provisioned dashboards from the UI
allowUiUpdates: true
options:
# <string, required> path to dashboard files on disk. Required when using the 'file' type
path: /var/lib/grafana/dashboards
# <bool> use folder names from filesystem to create folders in Grafana
foldersFromFilesStructure: true
Loading