Skip to content

Commit

Permalink
Update mysqlreceiver to use mdatagen v2 (#7507)
Browse files Browse the repository at this point in the history
  • Loading branch information
djaglowski committed Feb 2, 2022
1 parent 858ab33 commit 8a11e93
Show file tree
Hide file tree
Showing 9 changed files with 1,328 additions and 705 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
- `awscontainerinsightreceiver`: add full pod name when configured to AWS Container Insights Receiver (#7415)
- `hostreceiver/loadscraper`: Migrate the scraper to the mdatagen metrics builder (#7288)
- `awsecscontainermetricsreceiver`: Rename attributes to follow semantic conventions (#7425)
- `mysqlreceiver`: Add golden files for integration test
- `datadogexporter`: Always map conventional attributes to tags (#7185)

- `mysqlreceiver`: Add golden files for integration test (#7303)
- `mysqlreceiver`: Update to use mdatagen v2 (#7507)
## 🛑 Breaking changes 🛑

## 🚀 New components 🚀
Expand Down
17 changes: 17 additions & 0 deletions receiver/mysqlreceiver/codegen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http:https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate mdatagen --experimental-gen metadata.yaml

package mysqlreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mysqlreceiver"
3 changes: 3 additions & 0 deletions receiver/mysqlreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ package mysqlreceiver // import "github.com/open-telemetry/opentelemetry-collect
import (
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/receiver/scraperhelper"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mysqlreceiver/internal/metadata"
)

type Config struct {
Expand All @@ -26,4 +28,5 @@ type Config struct {
Database string `mapstructure:"database,omitempty"`
AllowNativePasswords bool `mapstructure:"allow_native_passwords,omitempty"`
confignet.NetAddr `mapstructure:",squash"`
Metrics metadata.MetricsSettings `mapstructure:"metrics"`
}
Binary file removed receiver/mysqlreceiver/debug.test
Binary file not shown.
5 changes: 3 additions & 2 deletions receiver/mysqlreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

package mysqlreceiver // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mysqlreceiver"

//go:generate mdatagen metadata.yaml

import (
"context"
"time"
Expand All @@ -26,6 +24,8 @@ import (
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/receiver/receiverhelper"
"go.opentelemetry.io/collector/receiver/scraperhelper"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/mysqlreceiver/internal/metadata"
)

const (
Expand All @@ -51,6 +51,7 @@ func createDefaultConfig() config.Receiver {
Endpoint: "localhost:3306",
Transport: "tcp",
},
Metrics: metadata.DefaultMetricsSettings(),
}
}

Expand Down
Loading

0 comments on commit 8a11e93

Please sign in to comment.