Skip to content

feat: emit more data in prom metrics#15657

Merged
julienrbrt merged 10 commits into
cosmos:mainfrom
dhanusaputra:emit-promotheus-version
Apr 6, 2023
Merged

feat: emit more data in prom metrics#15657
julienrbrt merged 10 commits into
cosmos:mainfrom
dhanusaputra:emit-promotheus-version

Conversation

@dhanusaputra
Copy link
Copy Markdown
Contributor

@dhanusaputra dhanusaputra commented Apr 1, 2023

Description

Closes: #15593


Workscope

  • add go version to prometheus metrics
  • add software version to metrics
  • add height of next upgrade
  • see if anything else can be added

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@dhanusaputra dhanusaputra requested a review from a team April 1, 2023 06:49
@ghost ghost requested review from a team, julienrbrt and samricotta and removed request for a team April 1, 2023 06:49
Copy link
Copy Markdown
Contributor

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thank you!
(Edit: I'll try it out with simd in a bit)

Comment thread telemetry/metrics.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we only use the height, we do not need to parse the rest.

Comment thread telemetry/metrics.go Fixed
@julienrbrt
Copy link
Copy Markdown
Contributor

before

image

after

metrics

Do we want this information as global label actually @tac0turtle?

@tac0turtle
Copy link
Copy Markdown
Contributor

tac0turtle commented Apr 3, 2023

hmm we shouldnt have it as a global but instead have a single metric

@dhanusaputra dhanusaputra force-pushed the emit-promotheus-version branch from 6eb1f32 to 8a5bf4f Compare April 3, 2023 12:58
Comment thread server/start.go Outdated
Comment on lines 528 to 529
Copy link
Copy Markdown
Contributor

@tac0turtle tac0turtle Apr 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can go in the upgrade module. helps avoid the upgrade dep in server

Copy link
Copy Markdown
Contributor

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
note: I have tried to check the upgrade height, have you @dhanusaputra?

Comment thread server/start.go Outdated
Comment thread x/upgrade/module.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not tried if it works, but if it does it will only work for app wiring app (app_v2). Could you add this additionally to the app.go?

Comment thread x/upgrade/module.go Outdated
Copy link
Copy Markdown
Contributor

@julienrbrt julienrbrt Apr 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
telemetry.SetGaugeWithLabels([]string{"server", "info"}, 1, []metrics.Label{telemetry.NewLabel("upgrade_height", strconv.FormatInt(upgradePlan.Height, 10))})
if upgradePlan.Height > 0 {
telemetry.SetGaugeWithLabels([]string{"server", "info"}, 1, []metrics.Label{telemetry.NewLabel("upgrade_height", strconv.FormatInt(upgradePlan.Height, 10))})
}

Prob need this because the app is instantiated the first time with a temporary directory, for getting the application encoding (

tempApp := simapp.NewSimApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(tempDir()))
)

@dhanusaputra
Copy link
Copy Markdown
Contributor Author

note: I have tried to check the upgrade height, have you @dhanusaputra?

not yet, will try run the simapp with better PC soon

@dhanusaputra dhanusaputra force-pushed the emit-promotheus-version branch from 9c5f858 to 97cca91 Compare April 4, 2023 11:03
Comment thread x/upgrade/module.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will only set it on startup, we should set it where its called the plan is set. also this assumes the application is using depinject which isnt the case yet.

func (k Keeper) ScheduleUpgrade(ctx sdk.Context, plan types.Plan) error {

@dhanusaputra
Copy link
Copy Markdown
Contributor Author

no luck testing the upgrade height
tried this guide but the cosmovisor keep running without dumping new version, not sure why
image

Comment thread simapp/app.go Outdated
@dhanusaputra dhanusaputra force-pushed the emit-promotheus-version branch from 4f2dfcf to 603e96c Compare April 6, 2023 11:45
Copy link
Copy Markdown
Contributor

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@tac0turtle tac0turtle requested a review from julienrbrt April 6, 2023 12:22
@julienrbrt julienrbrt enabled auto-merge (squash) April 6, 2023 12:41
@julienrbrt julienrbrt merged commit 17debf2 into cosmos:main Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

emit more data in prom metrics

4 participants