+
Skip to content

Make version number of DraCor Metrics Service accessible #331

@ingoboerner

Description

@ingoboerner

The /info endpoint includes the version number of the DraCor API, but also the used eXist-DB version. Could we add the version number of the DraCor Metrics Service running as well? I would need this information in the RDF rendering because the generated networks are dependend on the current version TEI Source File (indentified with a GitHub Hash), the mode of extraction in the API Code (identified by the API Version), but also by the algorithm implemented in the DraCor Metrics Service.

I found a way to get this version number by sending a GET request to the base-url of the DraCor Metrics Sevice as contained in $config:metrics-server, but it would be easier if I could just use an existing util:function/api:function (api:info()) for that.

(:~
: Get the version number of the running metrics service
:)
declare function local:metrics-service-version() 
as xs:string {

(: When the base-uri of the running metrics service is queried, it returns the version info in a JSON
: {"service":"dracor-metrics","version":"1.4.0"}
 :)

let $metrics-base-url := substring-before($config:metrics-server, "/metrics/") (: this is unsafe! Might result in unwanted URLS :)
let $request :=
    <hc:request method="get"/>
let $response := hc:send-request($request, $metrics-base-url)
let $info := $response[2] => util:base64-decode() => parse-json()
return $info?version 
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载