Skip to content
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

Show the FQDN instance in prometheus metrics #6863

Closed
wants to merge 2 commits into from

Conversation

turboFei
Copy link
Member

@turboFei turboFei commented Dec 25, 2024

Why are the changes needed?

The instance list shown in the new added grafana dashboard is not human readable.
image

In this PR, I try to add instance label with FQDN in the prometheus metrics.

How was this patch tested?

I will check the metrics for before and after to keep the compatibility.

Was this patch authored or co-authored using generative AI tooling?

@turboFei turboFei marked this pull request as draft December 25, 2024 05:11
sb.append(
s"${prefix}{quantile=\"0.99\",type=\"timers\",$instanceLabel} ${snapshot.get99thPercentile()}\n")
sb.append(
s"${prefix}{quantile=\"0.999\",type=\"timers\",$instanceLabel} ${snapshot.get999thPercentile()}\n")
Copy link
Member Author

Choose a reason for hiding this comment

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

before, timer example:

# HELP kyuubi_backend_service_execute_statement Generated from Dropwizard metric import (metric=kyuubi.backend_service.execute_statement, type=com.codahale.metrics.Timer)
# TYPE kyuubi_backend_service_execute_statement summary
kyuubi_backend_service_execute_statement{quantile="0.5",} 0.038373501000000004
kyuubi_backend_service_execute_statement{quantile="0.75",} 0.039456969
kyuubi_backend_service_execute_statement{quantile="0.95",} 0.041447420000000006
kyuubi_backend_service_execute_statement{quantile="0.98",} 0.042374208000000003
kyuubi_backend_service_execute_statement{quantile="0.99",} 0.05199264000000001
kyuubi_backend_service_execute_statement{quantile="0.999",} 0.10801610800000001
kyuubi_backend_service_execute_statement_count 815642.0

}
}
registry.getCounters.asScala.foreach { case (k, v) =>
sb.append(s"${normalizeKey(k)}$countersLabel ${v.getCount}\n")
Copy link
Member Author

@turboFei turboFei Dec 25, 2024

Choose a reason for hiding this comment

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

Gauge and counter example before:

# HELP kyuubi_connection_opened_b_citrst Generated from Dropwizard metric import (metric=kyuubi.connection.opened.b_citrst, type=com.codahale.metrics.Counter)
# TYPE kyuubi_connection_opened_b_citrst gauge
kyuubi_connection_opened_b_citrst 0.0

sb.append(s"${prefix}{quantile=\"0.98\",type=\"histograms\",$instanceLabel} ${snapshot.get98thPercentile()}\n")
sb.append(s"${prefix}{quantile=\"0.99\",type=\"histograms\",$instanceLabel} ${snapshot.get99thPercentile()}\n")
sb.append(s"${prefix}{quantile=\"0.999\",type=\"histograms\",$instanceLabel} ${snapshot.get999thPercentile()}\n")
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Example before:

# HELP kyuubi_operation_exec_time_ExecuteStatement_hermesrno_yuanqguo Generated from Dropwizard metric import (metric=kyuubi.operation.exec_time.ExecuteStatement.hermesrno.yuanqguo, type=com.codahale.metrics.Histogram)
# TYPE kyuubi_operation_exec_time_ExecuteStatement_hermesrno_yuanqguo summary
kyuubi_operation_exec_time_ExecuteStatement_hermesrno_yuanqguo{quantile="0.5",} 0.0
kyuubi_operation_exec_time_ExecuteStatement_hermesrno_yuanqguo{quantile="0.75",} 0.0
kyuubi_operation_exec_time_ExecuteStatement_hermesrno_yuanqguo{quantile="0.95",} 0.0
kyuubi_operation_exec_time_ExecuteStatement_hermesrno_yuanqguo{quantile="0.98",} 0.0
kyuubi_operation_exec_time_ExecuteStatement_hermesrno_yuanqguo{quantile="0.99",} 0.0
kyuubi_operation_exec_time_ExecuteStatement_hermesrno_yuanqguo{quantile="0.999",} 0.0
kyuubi_operation_exec_time_ExecuteStatement_hermesrno_yuanqguo_count 1.0

val prefix = normalizeKey(kv.getKey)
val meter = kv.getValue
sb.append(s"${prefix}$metersLabel ${meter.getCount}\n")
sb.append(s"${prefix}_MeanRate$metersLabel ${meter.getMeanRate}\n")
Copy link
Member Author

Choose a reason for hiding this comment

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

Meter example before

# HELP kyuubi_operation_state_initialized_total Generated from Dropwizard metric import (metric=kyuubi.operation.state.initialized, type=com.codahale.metrics.Meter)
# TYPE kyuubi_operation_state_initialized_total counter
kyuubi_operation_state_initialized_total 1371702.0

@turboFei turboFei force-pushed the prometheus_label branch 2 times, most recently from fcee248 to 02722bf Compare December 25, 2024 06:25
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.

1 participant