-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add prometheus prefix solution #1001
Changes from 2 commits
6172434
3a4f953
1a175df
e71a930
d5ca160
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -129,6 +129,10 @@ export async function generateNetworkSpec( | |||||||
parachains: [], | ||||||||
}; | ||||||||
|
||||||||
if (config.relaychain.prometheus_prefix) | ||||||||
networkSpec.relaychain.prometheusPrefix = | ||||||||
config.relaychain.prometheus_prefix; | ||||||||
|
||||||||
// check all imageURLs for validity | ||||||||
// TODO: These checks should be agains all config items that needs check | ||||||||
configurationFileChecks(config); | ||||||||
|
@@ -207,6 +211,12 @@ export async function generateNetworkSpec( | |||||||
nodeGroup.resources || networkSpec.relaychain.defaultResources, | ||||||||
db_snapshot: nodeGroup.db_snapshot, | ||||||||
}; | ||||||||
if (nodeGroup.prometheus_prefix) { | ||||||||
node.prometheus_prefix = nodeGroup.prometheus_prefix; | ||||||||
} else if (config.relaychain.prometheus_prefix) { | ||||||||
node.prometheus_prefix = config.relaychain.prometheus_prefix; | ||||||||
} | ||||||||
|
||||||||
const nodeSetup = await getNodeFromConfig( | ||||||||
networkSpec, | ||||||||
node, | ||||||||
|
@@ -256,7 +266,7 @@ export async function generateNetworkSpec( | |||||||
await getCollatorNodeFromConfig( | ||||||||
networkSpec, | ||||||||
collatorConfig, | ||||||||
parachain.id, | ||||||||
parachain, | ||||||||
paraChainName, | ||||||||
para, | ||||||||
bootnodes, | ||||||||
|
@@ -285,7 +295,7 @@ export async function generateNetworkSpec( | |||||||
await getCollatorNodeFromConfig( | ||||||||
networkSpec, | ||||||||
node, | ||||||||
parachain.id, | ||||||||
parachain, | ||||||||
paraChainName, | ||||||||
para, | ||||||||
bootnodes, | ||||||||
|
@@ -489,7 +499,7 @@ async function getLocalOverridePath( | |||||||
async function getCollatorNodeFromConfig( | ||||||||
networkSpec: any, | ||||||||
collatorConfig: NodeConfig, | ||||||||
para_id: number, | ||||||||
parachain: ParachainConfig, | ||||||||
chain: string, // relay-chain | ||||||||
para: PARA, | ||||||||
bootnodes: string[], // parachain bootnodes | ||||||||
|
@@ -533,14 +543,17 @@ async function getCollatorNodeFromConfig( | |||||||
prometheus: prometheusExternal(networkSpec), | ||||||||
overrides: [], | ||||||||
zombieRole: cumulusBased ? ZombieRole.CumulusCollator : ZombieRole.Collator, | ||||||||
parachainId: para_id, | ||||||||
parachainId: parachain.id, | ||||||||
dbSnapshot: collatorConfig.db_snapshot, | ||||||||
imagePullPolicy: networkSpec.settings.image_pull_policy || "Always", | ||||||||
...ports, | ||||||||
externalPorts, | ||||||||
p2pCertHash: collatorConfig.p2p_cert_hash, | ||||||||
}; | ||||||||
|
||||||||
if (parachain.prometheus_prefix) | ||||||||
node.prometheusPrefix = parachain.prometheus_prefix; | ||||||||
|
||||||||
return node; | ||||||||
} | ||||||||
|
||||||||
|
@@ -618,6 +631,9 @@ async function getNodeFromConfig( | |||||||
p2pCertHash: node.p2p_cert_hash, | ||||||||
}; | ||||||||
|
||||||||
if (node.prometheus_prefix) | ||||||||
nodeSetup.prometheusPrefix = node.prometheus_prefix; | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not really - prior to this if the key |
||||||||
|
||||||||
if (group) nodeSetup.group = group; | ||||||||
|
||||||||
const dbSnapshot = node.db_snapshot | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,8 +127,8 @@ export function getMetricName(metricName: string): string { | |
return metricNameTouse; | ||
} | ||
|
||
export function getProcessStartTimeKey() { | ||
return "substrate_process_start_time_seconds"; | ||
export function getProcessStartTimeKey(prefix = "substrate") { | ||
return `${prefix}_process_start_time_seconds`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
} | ||
|
||
function _extractMetrics(text: string): Metrics { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really; cause there is a chance that none of them exist, and in that case I want to avoid adding the key "prometheus_prefix" to the object