mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 15:04:52 +09:00
Move exposition content type to its own var
Remove anti-pattern of setting properties on Function object that is difficult to document.
This commit is contained in:
1 parent
80e1904175
commit
b66138587b
2 files changed
+6
-5
No files matched your search
@@ -95,7 +95,7 @@ async function getMetrics(req: Request, res: Response, next: any) {
|
||||
// Should wrap results into a Generator functions ?
|
||||
// @ts-ignore
|
||||
let text = await lib.exposition(results);
|
||||
res.set("Content-Type", lib.exposition.contentType);
|
||||
res.set("Content-Type", lib.expositionContentType);
|
||||
res.send(text);
|
||||
}
|
||||
|
||||
|
||||
@@ -1664,9 +1664,6 @@ async function* expositionLines(resultsIterator: AsyncIterable<CollectorResult>)
|
||||
* exposition for. Defaults to collecting results from {@link
|
||||
* defaultRegistry}.
|
||||
* @returns Prometheus exposition.
|
||||
*
|
||||
* @property exposition.contentType
|
||||
* HTTP Content-Type for the exposition format that's implemented
|
||||
*/
|
||||
export async function exposition(resultsIterator = defaultRegistry.collect()) {
|
||||
let lines = "";
|
||||
@@ -1675,7 +1672,11 @@ export async function exposition(resultsIterator = defaultRegistry.collect()) {
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
exposition.contentType = "text/plain; version=0.0.4";
|
||||
/**
|
||||
* HTTP Content-Type for the exposition format that's implemented by {@link
|
||||
* exposition}.
|
||||
*/
|
||||
export const expositionContentType = "text/plain; version=0.0.4";
|
||||
|
||||
/**
|
||||
* Serialize CollectorResult into a plain object
|
||||
|
||||
Reference in new issue
Block a user