Skip to content

Commit

Permalink
[chore] Update semconvgen README (#305)
Browse files Browse the repository at this point in the history
* [chore] Update semconvgen README

* Fix MD013/line-length lint errors

* Update --only arg options

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
  • Loading branch information
pellared and MrAlias authored May 18, 2023
1 parent a570d1a commit b199856
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
30 changes: 18 additions & 12 deletions semconvgen/README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
# Go Semantic Convention Generator

This tool is designed to generate constants in a semantic convention package for the Go API and the collector.
It may be used by other systems, but it's primary function beyond invoking the template processor is to ensure that
generated identifiers conform to Go's naming idiom, particularly with respect to initialisms and acronyms.
This tool is designed to generate constants in a semantic convention package
for the Go API and the collector.
It may be used by other systems,
but it's primary function beyond invoking the template processor is to ensure
that generated identifiers conform to Go's naming idiom,
particularly with respect to initialisms and acronyms.
Other users may be served just as well by using the template processor directly.

## Installation

```shell
$ go get go.opentelemetry.io/build-tools/semconvgen
go get go.opentelemetry.io/build-tools/semconvgen
```

## Usage

```shell
$ semconvgen -i <path to spec YAML> -t <path to template> -o <path to output>
semconvgen -i <path to spec YAML> -t <path to template> -o <path to output>
```

A full list of available options:

```txt
-c, --container string Container image ID (default "otel/semconvgen")
-f, --filename string Filename for templated output. If not specified 'basename(inputPath).go' will be used.
-i, --input string Path to semantic convention definition YAML. Should be a directory in the specification git repository.
--only string Process only semantic conventions of the specified type. {span, resource, event, metric_group, metric, units, scope, attribute_group}
-o, --output string Path to output target. Must be either an absolute path or relative to the repository root. If unspecified will output to a sub-directory with the name matching the version number specified via --specver flag.
-p, --parameters string List of key=value pairs separated by comma. These values are fed into the template as-is.
-s, --specver string Version of semantic convention to generate. Must be an existing version tag in the specification git repository.
-t, --template string Template filename (default "template.j2")
```
-c, --container string Container image ID (default "otel/semconvgen")
-f, --filename string Filename for templated output. If not specified 'basename(inputPath).go' will be used.
-i, --input string Path to semantic convention definition YAML. Should be a directory in the specification git repository.
-o, --output string Path to output target. Must be either an absolute path or relative to the repository root. If unspecified will output to a sub-directory with the name matching the version number specified via --specver flag.
-s, --specver string Version of semantic convention to generate. Must be an existing version tag in the specification git repository.
-t, --template string Template filename (default "template.j2")
```
2 changes: 1 addition & 1 deletion semconvgen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func main() {

cfg := config{}
flag.StringVarP(&cfg.inputPath, "input", "i", "", "Path to semantic convention definition YAML. Should be a directory in the specification git repository.")
flag.StringVarP(&cfg.onlyType, "only", "", "", "Process only semantic conventions of the specified type. {span,resource,event,metric,units,scope}")
flag.StringVarP(&cfg.onlyType, "only", "", "", "Process only semantic conventions of the specified type. {span, resource, event, metric_group, metric, units, scope, attribute_group}")
flag.StringVarP(&cfg.specVersion, "specver", "s", "", "Version of semantic convention to generate. Must be an existing version tag in the specification git repository.")
flag.StringVarP(&cfg.outputPath, "output", "o", "", "Path to output target. Must be either an absolute path or relative to the repository root. If unspecified will output to a sub-directory with the name matching the version number specified via --specver flag.")
flag.StringVarP(&cfg.containerImage, "container", "c", "otel/semconvgen", "Container image ID")
Expand Down

0 comments on commit b199856

Please sign in to comment.