packages feed

eventlog-live-otelcol-0.7.0.0: eventlog-live-otelcol.cabal

cabal-version: 3.0
name: eventlog-live-otelcol
version: 0.7.0.0
synopsis: Stream eventlog data to the OpenTelemetry Collector.
description:
  This executable collects telemetry data from any Haskell application
  and sends it over the OpenTelemetry protocol. The next release of this
  executable will be as part of the
  [@eventlog-live@ package](https://hackage.haskell.org/package/eventlog-live)
  under the name @eventlog-live-otlp@.

  For more information, see [the README](https://github.com/well-typed/eventlog-live#readme).

  > Usage: eventlog-live-otelcol (--eventlog-stdin | --eventlog-file FILE |
  >                                --eventlog-socket SOCKET |
  >                                --eventlog-socket-host HOST
  >                                --eventlog-socket-port PORT)
  >                              [--eventlog-socket-timeout SECONDS]
  >                              [--eventlog-socket-exponent NUMBER]
  >                              [--eventlog-flush-interval SECONDS]
  >                              [--eventlog-log-file FILE] [-h Tcmdyrbi]
  >                              [--service-name STRING] [--ipedb FILE]
  >                              [--ccdb FILE]
  >                              [-v|--verbosity fatal|error|warning|info|debug|trace]
  >                              [-s|--stats] [--config FILE] [--otlp-protocol ARG]
  >                              --otlp-endpoint ARG
  >                              [--otlp-grpc-certificate-store FILE]
  >                              [--otlp-grpc-ssl-key-log FILE |
  >                                --otlp-grpc-ssl-key-log-from-env]
  >                              [--otlp-http-headers ARG] [--print-defaults]
  >                              [--print-config-json-schema]
  >
  > Available options:
  >   --eventlog-stdin         Read the eventlog from stdin.
  >   --eventlog-file FILE     Read the eventlog from a file.
  >   --eventlog-socket SOCKET Read the eventlog from a Unix socket.
  >   --eventlog-socket-host HOST
  >                            Read the eventlog from a TCP/IP socket.
  >   --eventlog-socket-port PORT
  >                            Read the eventlog from a TCP/IP socket.
  >   --eventlog-socket-timeout SECONDS
  >                            Eventlog socket connection retry timeout in seconds.
  >   --eventlog-socket-exponent NUMBER
  >                            Eventlog socket connection retry timeout exponent.
  >   --eventlog-flush-interval SECONDS
  >                            Eventlog flush interval in seconds.
  >                            Should match the option passed to the application.
  >   --eventlog-log-file FILE Use file to log binary eventlog data.
  >   -h Tcmdyrbi              Heap profile breakdown.
  >                            Should match the option passed to the application.
  >   --service-name STRING    The name of the profiled service.
  >   --ipedb FILE             The path to an IPE database.
  >   --ccdb FILE              The path a cost-centre database.
  >   -v,--verbosity fatal|error|warning|info|debug|trace
  >                            The severity threshold for logging.
  >   -s,--stats               Display runtime statistics.
  >   --config FILE            The path to a detailed configuration file.
  >   --print-defaults         Print default configuration options.
  >   --print-config-json-schema
  >                            Print JSON Schema for configuration format.
  >   --help                   Show this help text.
  >   --version                Show version information
  >
  > OTLP Exporter Options
  >   --otlp-protocol ARG      The OTLP transport protocol to be used for all telemetry data (gRPC, HTTP/Protobuf).
  >                            Default value: gRPC
  >   --otlp-endpoint ARG      The OTLP endpoint URL for all telemetry data, with an optionally-specified port number.
  >                            Default value:
  >                              gRPC: http://localhost:4317
  >                              HTTP: http://localhost:4318
  >                            Example:
  >                              gRPC: https://my-api-endpoint:443
  >                              HTTP: http://my-api-endpoint/
  >   --otlp-grpc-certificate-store FILE
  >                            Store for certificate validation.
  >   --otlp-grpc-ssl-key-log FILE
  >                            Use file to log SSL keys.
  >   --otlp-grpc-ssl-key-log-from-env
  >                            Use SSLKEYLOGFILE to log SSL keys.
  >   --otlp-http-headers ARG  A list of headers to apply to all outgoing data.
  >
  > Control Server Options
  >   --control                Unsupported. Requires build with -f+control.
  >                            Start the control server.
  >   --control-port           Unsupported. Requires build with -f+control.
  >                            The port number for the control server.
  >   --control-cors-allow-origin
  >                            Unsupported. Requires build with -f+control.
  >                            Set the allowed origins for the control server CORS policy.
  >   --control-cors-max-age   Unsupported. Requires build with -f+control.
  >                            Set the maximum age of a cached CORS preflight request for the control server CORS policy.
  >   --control-cors-require-origin
  >                            Unsupported. Requires build with -f+control.
  >                            If enabled, the control server will not accept requests without an Origin header.
  >   --control-cors-ignore-failure
  >                            Unsupported. Requires build with -f+control.
  >                            If enabled, the control server will accept malformed CORS preflight requests.
  >
  > Debug Options
  >   --my-eventlog-socket-unix
  >                            Unsupported. Requires build with -f+use-eventlog-socket.
  >                            Open an eventlog socket for this program on the given Unix socket.
  >   --my-ghc-debug-socket    Unsupported. Requires build with -f+use-ghc-debug-stub.
  >                            Open the default ghc-debug socket for this program.
  >   --my-ghc-debug-socket-unix
  >                            Unsupported. Requires build with -f+use-ghc-debug-stub.
  >                            Open a ghc-debug Unix domain socket with the given file path.
  >   --my-ghc-debug-socket-tcp
  >                            Unsupported. Requires build with -f+use-ghc-debug-stub.
  >                            Open a ghc-debug TCP/IP socket with the given address as 'host:port'.

license: BSD-3-Clause
license-file: LICENSE
author: Wen Kokke
maintainer: wen@well-typed.com
copyright: (c) 2025 Well-Typed
build-type: Simple
category: Debug, Monitoring, System
extra-doc-files: CHANGELOG.md
extra-source-files:
  data/config.schema.json
  data/default.yaml

tested-with:
  ghc ==9.2.8 || ==9.4.8 || ==9.6.7 || ==9.8.4 || ==9.10.2

source-repository head
  type: git
  location: https://github.com/well-typed/eventlog-live.git
  subdir: eventlog-live-otelcol

source-repository this
  type: git
  location: https://github.com/well-typed/eventlog-live.git
  subdir: eventlog-live-otelcol
  tag: eventlog-live-otelcol-v0.7.0.0

-- This flag enables the control command server, which is an HTTP endpoint
-- that gets started by eventlog-live-otelcol. If +control is set, then
-- eventlog-socket SHOULD also be compiled with +control. If this flag is
-- set at compile-time, the control server can be enabled at runtime.
flag control
  description: Enable control command server.
  default: False
  manual: True

-- 2026-04-02:
-- This flag should enable switching the use of eventlog-socket on
-- and off, since it may cause issues with certain versions of GHC.
flag use-eventlog-socket
  description: Use eventlog-socket
  default: False
  manual: True

-- 2025-11-10:
-- This flag should enable switching the use of ghc-debug-stub on
-- and off, since it may cause issues with certain versions of GHC.
-- See https://github.com/well-typed/eventlog-live/issues/88
flag use-ghc-debug-stub
  description: Use ghc-debug-stub
  default: False
  manual: True

-- 2025-11-06:
-- This flag should enable switching between template-haskell and
-- template-haskell-lift, because the latter is not on nixpkgs.
flag use-template-haskell-lift
  description: Use template-haskell-lift in place of template-haskell
  default: False
  manual: False

common language
  ghc-options:
    -Wall
    -Wcompat
    -Widentities
    -Wprepositive-qualified-module
    -Wredundant-constraints
    -Wunticked-promoted-constructors
    -Wunused-packages

  default-language: Haskell2010
  default-extensions:
    BangPatterns
    ConstraintKinds
    DataKinds
    DefaultSignatures
    DeriveFoldable
    DeriveFunctor
    DeriveGeneric
    DeriveLift
    DeriveTraversable
    DerivingStrategies
    DuplicateRecordFields
    FlexibleContexts
    FlexibleInstances
    FunctionalDependencies
    GADTs
    GeneralizedNewtypeDeriving
    ImportQualifiedPost
    InstanceSigs
    KindSignatures
    LambdaCase
    MultiParamTypeClasses
    NoFieldSelectors
    NumericUnderscores
    OverloadedRecordDot
    PatternSynonyms
    RankNTypes
    RecordWildCards
    ScopedTypeVariables
    StandaloneKindSignatures
    TupleSections
    TypeApplications
    TypeFamilies
    TypeOperators

library
  import: language
  hs-source-dirs:
    src

  exposed-modules:
    GHC.Eventlog.Live.Otelcol

  other-modules:
    GHC.Eventlog.Live.Otelcol.Config
    GHC.Eventlog.Live.Otelcol.Config.Default
    GHC.Eventlog.Live.Otelcol.Config.Default.Raw
    GHC.Eventlog.Live.Otelcol.Config.Types
    GHC.Eventlog.Live.Otelcol.Control
    GHC.Eventlog.Live.Otelcol.Exporter.Core
    GHC.Eventlog.Live.Otelcol.Exporter.Logs
    GHC.Eventlog.Live.Otelcol.Exporter.Metrics
    GHC.Eventlog.Live.Otelcol.Exporter.Profiles
    GHC.Eventlog.Live.Otelcol.Exporter.Traces
    GHC.Eventlog.Live.Otelcol.Options
    GHC.Eventlog.Live.Otelcol.Processor.Common.Core
    GHC.Eventlog.Live.Otelcol.Processor.Common.Logs
    GHC.Eventlog.Live.Otelcol.Processor.Common.Metrics
    GHC.Eventlog.Live.Otelcol.Processor.Common.ProfilesDictionary
    GHC.Eventlog.Live.Otelcol.Processor.Common.SymbolTable
    GHC.Eventlog.Live.Otelcol.Processor.Common.Traces
    GHC.Eventlog.Live.Otelcol.Processor.Heap
    GHC.Eventlog.Live.Otelcol.Processor.Logs
    GHC.Eventlog.Live.Otelcol.Processor.Profiles
    GHC.Eventlog.Live.Otelcol.Processor.Threads
    GHC.Eventlog.Live.Otelcol.Stats

  hs-source-dirs:
    src-internal

  other-modules:
    GHC.Debug.Stub.Compat
    GHC.Eventlog.Socket.Compat
    Language.Haskell.TH.Lift.Compat
    Options.Applicative.Compat
    Options.Applicative.Extra.Feature
    Paths_eventlog_live_otelcol
    System.Random.Compat

  autogen-modules: Paths_eventlog_live_otelcol
  build-depends:
    ansi-terminal >=1.1 && <1.2,
    base >=4.16 && <4.22,
    bytestring >=0.11 && <0.13,
    case-insensitive >=1.2 && <1.3,
    containers >=0.6 && <0.8,
    data-default >=0.2 && <0.9,
    dlist >=1.0 && <1.1,
    eventlog-live ==0.6.0.0,
    file-embed >=0.0.16 && <0.1,
    ghc-events >=0.20 && <0.21,
    grapesy >=1.0.0 && <1.2,
    hashable >=1.4 && <1.6,
    hs-opentelemetry-otlp >=0.2.0 && <0.3,
    HsYAML >=0.2 && <0.3,
    http-client >=0.7 && <0.8,
    http-client-tls >=0.3 && <0.4,
    http-types >=0.12 && <0.13,
    ipedb >=0.2.0.1 && <0.3,
    lens-family >=2.1.3 && <2.2,
    machines >=0.7.4 && <0.8,
    network-uri >=2.6 && <2.8,
    optparse-applicative >=0.17 && <0.20,
    proto-lens >=0.7.1 && <0.8,
    random >=1.2 && <1.4,
    stm >=2.5 && <2.6,
    strict-list >=0.1 && <0.2,
    table-layout >=1.0 && <1.1,
    text >=1.2 && <2.2,
    transformers >=0.2 && <0.7,
    unordered-containers >=0.2.20 && <0.3,
    vector >=0.11 && <0.14,

  if flag(control)
    build-depends:
      aeson >=2.2 && <2.3,
      binary >=0.8 && <0.9,
      eventlog-socket-control >=0.1.1 && <0.2,
      fast-logger >=3.0 && <3.3,
      http-api-data >=0.6 && <0.7,
      network >=3.2.7 && <3.3,
      servant >=0.20 && <0.21,
      servant-server >=0.20 && <0.21,
      wai >=3.2 && <3.3,
      wai-cors >=0.2 && <0.3,
      wai-extra >=3.1 && <3.2,
      warp >=3.4 && <3.5,

    cpp-options: -DEVENTLOG_LIVE_OTELCOL_FEATURE_CONTROL

  if flag(use-eventlog-socket)
    build-depends: eventlog-socket >=0.1.2 && <0.2
    cpp-options: -DEVENTLOG_LIVE_OTELCOL_USE_EVENTLOG_SOCKET

  if flag(use-ghc-debug-stub)
    build-depends: ghc-debug-stub >=0.1 && <1
    cpp-options: -DEVENTLOG_LIVE_OTELCOL_USE_GHC_DEBUG_STUB

  if flag(use-template-haskell-lift)
    build-depends: template-haskell-lift >=0.1 && <0.2
    cpp-options: -DEVENTLOG_LIVE_OTELCOL_USE_TEMPLATE_HASKELL_LIFT
  else
    build-depends: template-haskell >=2.2 && <3

executable eventlog-live-otelcol
  import: language
  main-is: Main.hs
  hs-source-dirs: app
  build-depends: eventlog-live-otelcol
  ghc-options:
    -threaded
    -rtsopts
    -finfo-table-map