Skip to content

Commit

Permalink
[new] Add initial code, content
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaoussanis committed Mar 2, 2024
1 parent 143dc2b commit 3e519bb
Show file tree
Hide file tree
Showing 26 changed files with 2,233 additions and 3 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/graal-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Graal tests
on: [push, pull_request]

jobs:
test:
strategy:
matrix:
java: ['17']
os: [ubuntu-latest, macOS-latest, windows-latest]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: ${{ matrix.java }}
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}

- uses: DeLaGuardo/setup-clojure@12.5
with:
lein: latest
bb: latest

- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: deps-${{ hashFiles('deps.edn') }}
restore-keys: deps-

- run: bb graal-tests
30 changes: 30 additions & 0 deletions .github/workflows/main-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Main tests
on: [push, pull_request]

jobs:
tests:
strategy:
matrix:
java: ['17', '18', '19']
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: ${{ matrix.java }}

- uses: DeLaGuardo/setup-clojure@12.5
with:
lein: latest

- uses: actions/cache@v4
id: cache-deps
with:
path: ~/.m2/repository
key: deps-${{ hashFiles('project.clj') }}
restore-keys: deps-

- run: lein test-all
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This project uses [**Break Versioning**](https://www.taoensso.com/break-versioning).

---
2 changes: 2 additions & 0 deletions FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: ptaoussanis
custom: "https://www.taoensso.com/clojure"
59 changes: 57 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,57 @@
# telemere
Coming later
<a href="https://www.taoensso.com/clojure" title="More stuff by @ptaoussanis at www.taoensso.com"><img src="https://www.taoensso.com/open-source.png" alt="Taoensso open source" width="340"/></a>
[**Documentation**](#documentation) | [Latest releases](#latest-releases) | [Get support][GitHub issues]

# Telemere

### Structured telemetry library for Clojure/Script

This library is **still under development** and not available yet for public use.

## Latest release/s

- Coming [~Mar-Apr 2024](https://www.taoensso.com/roadmap)

[![Main tests][Main tests SVG]][Main tests URL]
[![Graal tests][Graal tests SVG]][Graal tests URL]

See [here][GitHub releases] for earlier releases.

## Why Telemere?

- Coming later

## Documentation

- [Wiki][GitHub wiki] (getting started, usage, etc.)
- API reference: [Codox][Codox docs], [clj-doc][clj-doc docs]

## Funding

You can [help support][sponsor] continued work on this project, thank you!! 🙏

## License

Copyright &copy; 2023-2024 [Peter Taoussanis][].
Licensed under [EPL 1.0](LICENSE.txt) (same as Clojure).

<!-- Common -->

[GitHub releases]: ../../releases
[GitHub issues]: ../../issues
[GitHub wiki]: ../../wiki

[Peter Taoussanis]: https://www.taoensso.com
[sponsor]: https://www.taoensso.com/sponsor

<!-- Project -->

[Codox docs]: https://taoensso.github.io/telemere/
[clj-doc docs]: https://cljdoc.org/d/com.taoensso/telemere/

[Clojars SVG]: https://img.shields.io/clojars/v/com.taoensso/telemere.svg
[Clojars URL]: https://clojars.org/com.taoensso/telemere

[Main tests SVG]: https://github.com/taoensso/telemere/actions/workflows/main-tests.yml/badge.svg
[Main tests URL]: https://github.com/taoensso/telemere/actions/workflows/main-tests.yml
[Graal tests SVG]: https://github.com/taoensso/telemere/actions/workflows/graal-tests.yml/badge.svg
[Graal tests URL]: https://github.com/taoensso/telemere/actions/workflows/graal-tests.yml
13 changes: 13 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Security policy

## Advisories

All security advisories will be posted [on GitHub](https://github.com/taoensso/telemere/security/advisories).

## Reporting a vulnerability

Please report possible security vulnerabilities [via GitHub](https://github.com/taoensso/telemere/security/advisories), or by emailing me at `my first name at taoensso.com`. You may encrypt emails with [my public PGP/GPG key](https://www.taoensso.com/pgp).

Thank you!

\- [Peter Taoussanis](https://www.taoensso.com)
10 changes: 10 additions & 0 deletions bb.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{:paths ["bb"]
:tasks
{:requires ([graal-tests])
graal-tests
{:doc "Run Graal native-image tests"
:task
(do
(graal-tests/uberjar)
(graal-tests/native-image)
(graal-tests/run-tests))}}}
38 changes: 38 additions & 0 deletions bb/graal_tests.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bb

(ns graal-tests
(:require
[clojure.string :as str]
[babashka.fs :as fs]
[babashka.process :refer [shell]]))

(defn uberjar []
(let [command "lein with-profiles +graal-tests uberjar"
command
(if (fs/windows?)
(if (fs/which "lein")
command
;; Assume PowerShell powershell module
(str "powershell.exe -command " (pr-str command)))
command)]

(shell command)))

(defn executable [dir name]
(-> (fs/glob dir (if (fs/windows?) (str name ".{exe,bat,cmd}") name))
first
fs/canonicalize
str))

(defn native-image []
(let [graalvm-home (System/getenv "GRAALVM_HOME")
bin-dir (str (fs/file graalvm-home "bin"))]
(shell (executable bin-dir "gu") "install" "native-image")
(shell (executable bin-dir "native-image")
"--features=clj_easy.graal_build_time.InitClojureClasses"
"--no-fallback" "-jar" "target/graal-tests.jar" "graal_tests")))

(defn run-tests []
(let [{:keys [out]} (shell {:out :string} (executable "." "graal_tests"))]
(assert (str/includes? out "loaded") out)
(println "Native image works!")))
2 changes: 2 additions & 0 deletions doc/cljdoc.edn
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{:cljdoc/docstring-format :plaintext}

86 changes: 86 additions & 0 deletions project.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
(defproject com.taoensso/telemere "1.0.0-SNAPSHOT"
:author "Peter Taoussanis <https://www.taoensso.com>"
:description "Structured telemetry library for Clojure/Script"
:url "https://www.taoensso.com/telemere"

:license
{:name "Eclipse Public License - v 1.0"
:url "https://www.eclipse.org/legal/epl-v10.html"}

:dependencies
[[com.taoensso/encore "3.88.0"]
[org.clj-commons/pretty "2.2.1"]]

:test-paths ["test" #_"src"]

:profiles
{;; :default [:base :system :user :provided :dev]
:provided {:dependencies [[org.clojure/clojurescript "1.11.132"]
[org.clojure/clojure "1.11.1"]]}
:c1.11 {:dependencies [[org.clojure/clojure "1.11.1"]]}
:c1.10 {:dependencies [[org.clojure/clojure "1.10.1"]]}
:c1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]}

:graal-tests
{:source-paths ["test"]
:main taoensso.graal-tests
:aot [taoensso.graal-tests]
:uberjar-name "graal-tests.jar"
:dependencies
[[org.clojure/clojure "1.11.1"]
[com.github.clj-easy/graal-build-time "1.0.5"]]}

:dev
{:jvm-opts
["-server"
"-Dtaoensso.elide-deprecated=true"
"-Dclojure.tools.logging->telemere?=true"]

:global-vars
{*warn-on-reflection* true
*assert* true
*unchecked-math* false #_:warn-on-boxed}

:dependencies
[[org.clojure/test.check "1.1.1"]
[org.clojure/tools.logging "1.3.0"]
[org.slf4j/slf4j-api "2.0.12"]
[com.taoensso/slf4j-telemere "1.0.0-SNAPSHOT"]
;; [org.slf4j/slf4j-simple "2.0.12"]
;; [org.slf4j/slf4j-nop "2.0.12"]
[io.opentelemetry/opentelemetry-api "1.35.0"]]

:plugins
[[lein-pprint "1.3.2"]
[lein-ancient "0.7.0"]
[lein-cljsbuild "1.1.8"]
[com.taoensso.forks/lein-codox "0.10.11"]]

:codox
{:language #{:clojure :clojurescript}
:base-language :clojure}}}

:cljsbuild
{:test-commands {"node" ["node" "target/test.js"]}
:builds
[{:id :main
:source-paths ["src"]
:compiler
{:output-to "target/main.js"
:optimizations :advanced}}

{:id :test
:source-paths ["src" "test"]
:compiler
{:output-to "target/test.js"
:target :nodejs
:optimizations :simple}}]}

:aliases
{"start-dev" ["with-profile" "+dev" "repl" ":headless"]
"build-once" ["do" ["clean"] ["cljsbuild" "once"]]
"deploy-lib" ["do" ["build-once"] ["deploy" "clojars"] ["install"]]

"test-clj" ["with-profile" "+c1.11:+c1.10:+c1.9" "test"]
"test-cljs" ["with-profile" "+test" "cljsbuild" "test"]
"test-all" ["do" ["clean"] ["test-clj"] ["test-cljs"]]})
16 changes: 16 additions & 0 deletions slf4j/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
pom.xml*
.lein*
.nrepl-port
*.jar
*.class
.env
.DS_Store
/lib/
/classes/
/target/
/checkouts/
/logs/
/.clj-kondo/.cache
.idea/
*.iml
/wiki/.git
22 changes: 22 additions & 0 deletions slf4j/project.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(defproject com.taoensso/slf4j-telemere "1.0.0-SNAPSHOT"
:author "Peter Taoussanis <https://www.taoensso.com>"
:description "Telemere backend/provider for SLF4J API v2"
:url "https://www.taoensso.com/telemere"

:license
{:name "Eclipse Public License - v 1.0"
:url "https://www.eclipse.org/legal/epl-v10.html"}

:java-source-paths ["src/java"]
:javac-options ["--release" "11" "-g"] ; Support Java >= v11
:dependencies []

:profiles
{:provided
{:dependencies
[[org.clojure/clojure "1.11.1"]
[org.slf4j/slf4j-api "2.0.12"]
[com.taoensso/telemere "1.0.0-SNAPSHOT"]]}}

:aliases
{"deploy-lib" ["do" #_["build-once"] ["deploy" "clojars"] ["install"]]})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.taoensso.telemere.slf4j.TelemereServiceProvider
Loading

0 comments on commit 3e519bb

Please sign in to comment.