-
Notifications
You must be signed in to change notification settings - Fork 238
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 database_observability.mysql
component
#2053
Conversation
b65a89c
to
9472049
Compare
852d168
to
21028c3
Compare
grafanacloud.database_observability
component
71331b1
to
be1f752
Compare
grafanacloud.database_observability
componentgrafanacloud.database_observability
component
internal/component/database_observability/mysql/collector/query_sample.go
Outdated
Show resolved
Hide resolved
internal/component/database_observability/mysql/collector/query_sample.go
Outdated
Show resolved
Hide resolved
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.
LGTM on the SQL collector part!
docs/sources/reference/components/grafanacloud/grafanacloud.database_observability.mysql.md
Outdated
Show resolved
Hide resolved
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.
Nice work, looking forward to see the cool features that this component can enable!
docs/sources/reference/components/grafanacloud/grafanacloud.database_observability.mysql.md
Outdated
Show resolved
Hide resolved
internal/component/database_observability/mysql/collector/connection_info.go
Show resolved
Hide resolved
internal/component/database_observability/mysql/collector/connection_info.go
Outdated
Show resolved
Hide resolved
internal/component/database_observability/mysql/collector/query_sample.go
Show resolved
Hide resolved
} | ||
|
||
type Exports struct { | ||
Targets []discovery.Target `alloy:"targets,attr"` |
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.
I don't think that this component should expose targets to be scrapped. If you want this component to expose its own metrics you can use the Registerer that's part of the component options that you get in the New() function
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.
My understanding is that opts.Registerer
is for metrics regarding the component itself. If I switch to using opts.Registerer
then the connection_info
metric is available at http://localhost:12345/metrics
.
Our intention is to expose metrics that can be piped into a remote write, e.g.
grafanacloud.database_observability.mysql "orders_db" {
data_source_name = "mysql:3306"
forward_to = [loki.write.logs_service.receiver] // not used in this example
}
prometheus.scrape "orders_db" {
targets = grafanacloud.database_observability.mysql.orders_db.targets
honor_labels = true
forward_to = [prometheus.remote_write.metrics_service.receiver]
}
prometheus.remote_write "metrics_service" {
endpoint {
url = sys.env("GCLOUD_HOSTED_METRICS_URL")
basic_auth {
username = sys.env("GCLOUD_HOSTED_METRICS_ID")
password = sys.env("GCLOUD_RW_API_KEY")
}
}
}
Is there a different way of doing 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.
that's correct, but given that you are planning to use the existing exporter for the metrics + that you only have the "connection_info" as a metric here, I thought that it would fit as a metric regarding the component itself. If you want to expose more metrics from this component in the future and you think that it doesn't fit as metrics about the component itself then you can expose them the way you did
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.
We want the metrics to come out of database_observability.mysql
(or whatever final name). If we create them as metrics attached to the component itself then one would need to scrape the Alloy /metrics
endpoint to ingest those metrics, right? It's not what we want in this case: don't think the discriminator should be the fact we currently have only 1 metric, as it pushes us toward a totally different usage model.
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.
yes that's correct. I get your point and that's ok if you want to go this way. I do think that the amount of metrics you have matters a bit in the solution because if it stays with one metric that's actually a constant then it seems overkill to have the scrape complexity in the component + require the need to scrape this component just for this one info. But if you think that you might add more metrics to it later and that it would be worth it for users to scrape it then that's totally fine.
Also it may not work with clustering if the target is not exactly the same across all instances (not sure if that's the case or not for you. If it is then it should be warned in the doc because this is a common pitfall that confuses users)
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 planning to make this work for clustering. I do see your point about the number of metrics, I think we want to keep the door open for now and have this component produce its own metrics. Things will be more clear once we approach moving out of "experimental".
internal/component/database_observability/mysql/collector/query_sample_test.go
Show resolved
Hide resolved
6b3702a
to
084baff
Compare
grafanacloud.database_observability
componentdatabase_observability.mysql
component
docs/sources/reference/components/database_observability/database_observability.mysql.md
Outdated
Show resolved
Hide resolved
docs/sources/reference/components/database_observability/database_observability.mysql.md
Outdated
Show resolved
Hide resolved
Co-authored-by: MattNolf <[email protected]>
…ection_info.go Co-authored-by: William Dumont <[email protected]>
…ase_observability.mysql.md Co-authored-by: Clayton Cornell <[email protected]>
…ase_observability.mysql.md Co-authored-by: Clayton Cornell <[email protected]>
170d0ef
to
ab9a21b
Compare
@wildum I think all major points are addressed and what's left is probably not a blocker for merging this PR? Could you please take another look? |
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.
Thanks for working on the feedback, I just have a few little comments left and then we can merge it
PR Description
Add new component
database_observability.mysql
.Which issue(s) this PR fixes
Relates to #1827
Notes to the Reviewer
PR Checklist