@@ -55,7 +55,7 @@ import GHC.Eventlog.Live.Machine.WithStartTime qualified as M
5555import GHC.Eventlog.Live.Options
5656import GHC.Eventlog.Live.Otelcol.Config (Config )
5757import GHC.Eventlog.Live.Otelcol.Config qualified as C
58- import GHC.Eventlog.Live.Otelcol.Config.Default.Raw (defaultConfigString )
58+ import GHC.Eventlog.Live.Otelcol.Config.Default.Raw (defaultConfigByteString , defaultConfigJSONSchemaByteString )
5959import GHC.Eventlog.Live.Otelcol.Exporter (exportResourceMetrics , exportResourceSpans )
6060import GHC.Eventlog.Live.Otelcol.Stats (Stat (.. ), eventCountTick , processStats )
6161import GHC.Eventlog.Live.Socket (runWithEventlogSource )
@@ -851,6 +851,7 @@ options =
851851 ( optionsParser
852852 O. <**> defaultsPrinter
853853 O. <**> debugDefaultsPrinter
854+ O. <**> configJSONSchemaPrinter
854855 O. <**> OE. helperWith (O. long " help" <> O. help " Show this help text." )
855856 O. <**> OC. simpleVersioner (showVersion EventlogLive. version)
856857 )
@@ -938,9 +939,16 @@ configFileParser =
938939
939940defaultsPrinter :: O. Parser (a -> a )
940941defaultsPrinter =
941- O. infoOption defaultConfigString . mconcat $
942+ O. infoOption (fromByteString defaultConfigByteString) . mconcat $
942943 [ O. long " print-defaults"
943- , O. help " Print default configuration options that can be used in config.yaml"
944+ , O. help " Print default configuration options."
945+ ]
946+
947+ configJSONSchemaPrinter :: O. Parser (a -> a )
948+ configJSONSchemaPrinter =
949+ O. infoOption (fromByteString defaultConfigJSONSchemaByteString) . mconcat $
950+ [ O. long " print-config-json-schema"
951+ , O. help " Print JSON Schema for configuration format."
944952 ]
945953
946954debugDefaultsPrinter :: O. Parser (a -> a )
@@ -952,7 +960,14 @@ debugDefaultsPrinter =
952960 ]
953961 where
954962 defaultConfigDebugString =
955- T. unpack . TE. decodeUtf8Lenient . Y. encode $ (def :: Config )
963+ fromByteString . Y. encode $ (def :: Config )
964+
965+ {- |
966+ Internal helper.
967+ Decode a `ByteString` to a `String`.
968+ -}
969+ fromByteString :: ByteString -> String
970+ fromByteString = T. unpack . TE. decodeUtf8Lenient
956971
957972--------------------------------------------------------------------------------
958973-- Service Name
0 commit comments