Skip to content

Commit

Permalink
[mdatagen] Improvement on README for mdatagen new codegen file (#16770)
Browse files Browse the repository at this point in the history
[cmd/mdatagen] add the correct codegen file on readme
  • Loading branch information
dgoscn authored Dec 7, 2022
1 parent d71aab4 commit 551e5c9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/mdatagen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ Current examples:

See [metric-metadata.yaml](metric-metadata.yaml) for file format documentation.

If adding a new receiver a `codegen.go` file should also be added to trigger the generation. See below for details.
If adding a new receiver a `doc.go` file should also be added to trigger the generation. See below for details.

## Build

When `go generate` is run (it is run automatically in the make build targets) there are a few special build directives in `codegen.go` files:
When `go generate` is run (it is run automatically in the make build targets) there are a few special build directives in `doc.go` files:

`make install-tools` results in `cmd/mdatagen` being installed to `GOBIN`
* `make install-tools` results in `cmd/mdatagen` being installed to `GOBIN`

[/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/codegen.go](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/codegen.go) runs `mdatagen` for the `hostmetricsreceiver` metadata.yaml which generates the [/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/internal/metadata](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/internal/metadata) package which has Go files containing metric and label metadata.
* `make generate` on root `opentelemetry-collector-contrib project` it will results in the code below

[/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/doc.go](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/doc.go) runs `mdatagen` for the `hostmetricsreceiver` metadata.yaml which generates the [/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/internal/metadata](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/hostmetricsreceiver/internal/scraper/cpuscraper/internal/metadata) package which has Go files containing metric and label metadata.

0 comments on commit 551e5c9

Please sign in to comment.