Skip to content

Commit

Permalink
Merge pull request #336 from iRevive/semantic-convention-gen
Browse files Browse the repository at this point in the history
Generate semantic conventions using sbt
  • Loading branch information
iRevive committed Oct 20, 2023
2 parents 73f3ba4 + c196576 commit b38d583
Show file tree
Hide file tree
Showing 12 changed files with 2,436 additions and 1,089 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,31 @@ jobs:
modules-ignore: otel4s-sdk-common_native0.4_2.13 otel4s-sdk-common_native0.4_3 otel4s-benchmarks_2.13 otel4s-benchmarks_3 otel4s-examples_2.13 otel4s-examples_3 otel4s-sdk-common_sjs1_2.13 otel4s-sdk-common_sjs1_3 otel4s-sdk-trace_sjs1_2.13 otel4s-sdk-trace_sjs1_3 otel4s_2.13 otel4s_3 docs_2.13 docs_3 otel4s-sdk_native0.4_2.13 otel4s-sdk_native0.4_3 otel4s-sdk-common_2.13 otel4s-sdk-common_3 otel4s_2.13 otel4s_3 otel4s_2.13 otel4s_3 otel4s-sdk-trace_native0.4_2.13 otel4s-sdk-trace_native0.4_3 otel4s-sdk_sjs1_2.13 otel4s-sdk_sjs1_3 otel4s-sdk_2.13 otel4s-sdk_3 otel4s-sdk-trace_2.13 otel4s-sdk-trace_3
configs-ignore: test scala-tool scala-doc-tool test-internal

validate-steward:
name: Validate Steward Config
strategy:
matrix:
os: [ubuntu-latest]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (fast)
uses: actions/checkout@v4

- name: Setup Java (temurin@11)
id: setup-java-temurin-11
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11

- uses: coursier/setup-action@v1
with:
apps: scala-steward

- run: scala-steward validate-repo-config .scala-steward.conf

site:
name: Generate Site
strategy:
Expand Down
6 changes: 6 additions & 0 deletions .scala-steward.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
postUpdateHooks = [{
command = ["sbt", "; root/semanticConventionsGenerate; scalafixAll; scalafmtAll"],
commitMessage = "Regenerate semantic conventions",
groupId = "io.opentelemetry.semconv",
artifactId = "opentelemetry-semconv"
}]
19 changes: 19 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ val MUnitVersion = "1.0.0-M10"
val MUnitCatsEffectVersion = "2.0.0-M3"
val MUnitDisciplineVersion = "2.0.0-M3"
val OpenTelemetryVersion = "1.31.0"
val OpenTelemetrySemConvVersion = "1.21.0-alpha"
val PlatformVersion = "1.0.2"
val ScodecVersion = "1.1.37"
val VaultVersion = "3.5.0"
Expand All @@ -54,6 +55,15 @@ lazy val munitDependencies = Def.settings(
)
)

lazy val semanticConventionsGenerate =
taskKey[Unit]("Generate semantic conventions")
semanticConventionsGenerate := {
SemanticConventionsGenerator.generate(
OpenTelemetrySemConvVersion.stripSuffix("-alpha"),
baseDirectory.value
)
}

lazy val root = tlCrossRootProject
.aggregate(
`core-common`,
Expand Down Expand Up @@ -302,12 +312,21 @@ lazy val java = project

lazy val semconv = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.enablePlugins(BuildInfoPlugin)
.in(file("semconv"))
.dependsOn(`core-common`)
.settings(
name := "otel4s-semconv",
startYear := Some(2023),
// We use opentelemetry-semconv dependency to track releases of the OpenTelemetry semantic convention spec
libraryDependencies += "io.opentelemetry.semconv" % "opentelemetry-semconv" % OpenTelemetrySemConvVersion % "compile-internal" intransitive (),
buildInfoPackage := "org.typelevel.otel4s.semconv",
buildInfoOptions += sbtbuildinfo.BuildInfoOption.PackagePrivate,
buildInfoKeys := Seq[BuildInfoKey](
"openTelemetrySemanticConventionsVersion" -> OpenTelemetrySemConvVersion
)
)
.settings(munitDependencies)
.settings(scalafixSettings)

lazy val benchmarks = project
Expand Down
3 changes: 2 additions & 1 deletion buildscripts/semantic-convention/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
opentelemetry-specification/
semantic-conventions-*/
semantic-conventions.zip
52 changes: 0 additions & 52 deletions buildscripts/semantic-convention/generate.sh

This file was deleted.

Loading

0 comments on commit b38d583

Please sign in to comment.