Skip to content

Commit

Permalink
database_observability: add namespace to connection_info metric (#2613)
Browse files Browse the repository at this point in the history
Add the namespace `database_observability` to the `connection_info`
metric. A breaking change, but this is still unused.
  • Loading branch information
cristiangreco authored Feb 5, 2025
1 parent 2d18a2f commit 61029da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Main (unreleased)

- (_Experimental_) Better error handling for `database_observability.mysql` (@cristiangreco)

- (_Experimental_) Add namespace to `connection_info` metric in `database_observability.mysql` (@cristiangreco)

- Add json format support for log export via faro receiver (@ravishankar15)

### Bugfixes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ type ConnectionInfo struct {

func NewConnectionInfo(args ConnectionInfoArguments) (*ConnectionInfo, error) {
infoMetric := prometheus.NewGaugeVec(prometheus.GaugeOpts{
Name: "connection_info",
Help: "Information about the connection",
Namespace: "database_observability",
Name: "connection_info",
Help: "Information about the connection",
}, []string{"provider_name", "region", "db_instance_identifier"})

args.Registry.MustRegister(infoMetric)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ func TestConnectionInfo(t *testing.T) {
defer goleak.VerifyNone(t)

const baseExpectedMetrics = `
# HELP connection_info Information about the connection
# TYPE connection_info gauge
connection_info{db_instance_identifier="%s",provider_name="%s",region="%s"} 1
# HELP database_observability_connection_info Information about the connection
# TYPE database_observability_connection_info gauge
database_observability_connection_info{db_instance_identifier="%s",provider_name="%s",region="%s"} 1
`

testCases := []struct {
Expand Down

0 comments on commit 61029da

Please sign in to comment.