opentelemetry-go icon indicating copy to clipboard operation
opentelemetry-go copied to clipboard

semconv: Add metric generation

Open pellared opened this issue 11 months ago • 3 comments

Generate semconv's type: metric. E.g. the following could be generated (at least the instrument name, but maybe something that creates a whole instrument would be better? but it may be too complex): https://github.com/open-telemetry/semantic-conventions/blob/e880bddb63437119a33caddd643e069b500851a6/model/metrics/http.yaml#L91C1-L96

The new functionality could be used e.g. here: https://github.com/open-telemetry/opentelemetry-go-contrib/blob/f44f5ad46d64fb5f1d8615bfea479ed29ac540dc/instrumentation/google.golang.org/grpc/otelgrpc/config.go#L75-L77

pellared avatar Sep 18 '23 13:09 pellared

I have attempted a variety of arguments to semconvgen with no success so I likely need a bit more guidance. I tried following the directions here: https://github.com/open-telemetry/opentelemetry-go/blob/main/RELEASING.md and running it manually from .tools/. I was trying many different values to try and get the generator to read the metrics/http.yaml, but it felt like it was reading everything but that file in the metrics directory :)

Perhaps I am not going the correct direction on this though.

Here is an example of what I was attempting:

➜ ./semconvgen -i "/Users/ben/after_work/otel/semantic-conventions/model/." --only=metric -p conventionType=metric -s "v1.24.0" -t ../semconv/template.j2 -f metric.go

carrbs avatar Jan 17 '24 04:01 carrbs

I have no idea. Probably you would have to debug it.

Here is the source code of semconvgen (written in Go). Here is the source code of otel/semconvgen (written in Python) which is used as a docker container by semconvgen (written in Go).

pellared avatar Jan 17 '24 07:01 pellared

I have no idea. Probably you would have to debug it.

Here is the source code of semconvgen (written in Go). Here is the source code of otel/semconvgen (written in Python) which is used as a docker container by semconvgen (written in Go).

This was my next guess, just wanted to make sure I was headed in the right direction, thanks @pellared.

carrbs avatar Jan 17 '24 17:01 carrbs