cabal-version: 3.4
name: baikai-trace-otel
version: 0.4.0.2
synopsis: OpenTelemetry TraceSink for baikai.
description:
Provides an opt-in OpenTelemetry adapter for the baikai 'TraceSink'
interface. Wiring 'otelSink' into 'Baikai.Trace.withTrace' produces
one OTel span per provider call, with GenAI semantic-convention
attributes plus baikai-specific cost and latency.
category: AI, Monitoring
license: BSD-3-Clause
license-file: LICENSE
author: Nadeem Bitar
maintainer: nadeem@gmail.com
copyright: (c) 2026 Nadeem Bitar
build-type: Simple
tested-with: ghc ==9.12.4
extra-doc-files: CHANGELOG.md
common common-options
ghc-options:
-Wall
-Wcompat
-Widentities
-Wincomplete-uni-patterns
-Wincomplete-record-updates
-Wredundant-constraints
-fhide-source-paths
-Wmissing-export-lists
-Wpartial-fields
-Wmissing-deriving-strategies
-- Exhaustiveness is an error, not a warning. A non-exhaustive match
-- is a crash the compiler already found: it fails at runtime, on
-- whichever input reaches the missing branch, usually in front of a
-- user. This is not hypothetical here — adding a constructor to
-- AgentRunFailure left `failureExitCode` non-exhaustive and shipped a
-- pattern-match failure on `baikai agent run --require-evidence`,
-- because the warning scrolled past in a build log.
--
-- Promoted individually rather than through -Werror, which would also
-- fail the build on warnings that are stylistic or that a future GHC
-- invents, and would push people toward blanket suppression.
ghc-options:
-Werror=incomplete-patterns
-Werror=incomplete-uni-patterns
-Werror=incomplete-record-updates
default-language: GHC2024
default-extensions:
DeriveAnyClass
DuplicateRecordFields
OverloadedLabels
OverloadedStrings
library
import: common-options
hs-source-dirs: src
exposed-modules: Baikai.Trace.Sink.OpenTelemetry
build-depends:
aeson ^>=2.2,
baikai ^>=0.8.0,
base >=4.20 && <5,
containers ^>=0.7,
hs-opentelemetry-api >=1.0 && <1.1,
hs-opentelemetry-semantic-conventions >=1.40 && <2,
scientific ^>=0.3,
streamly-core >=0.3 && <0.5,
text ^>=2.1,
time ^>=1.14,
unordered-containers ^>=0.2,
test-suite baikai-trace-otel-test
import: common-options
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Main.hs
other-modules: PublicSurfaceSpec
ghc-options:
-threaded
-with-rtsopts=-N
build-depends:
aeson ^>=2.2,
baikai ^>=0.8.0,
baikai-trace-otel,
base,
generic-lens,
hs-opentelemetry-api >=1.0 && <1.1,
hs-opentelemetry-exporter-in-memory >=1.0 && <1.1,
hs-opentelemetry-sdk >=1.0 && <1.1,
lens ^>=5.3,
streamly-core >=0.3 && <0.5,
tasty,
tasty-hunit,
text,
time,
unordered-containers,
vector,