Skip to content

Commit

Permalink
[mdatagen] move ScopeName to generated_status (#10848)
Browse files Browse the repository at this point in the history
This will make it available to most components, as the
generated_telemetry is only generated for components that have internal
telemetry configured. Arguably the scope name should be moved to its own
file, but i'd rather not add yet another file if possible.

Signed-off-by: Alex Boten <[email protected]>
  • Loading branch information
codeboten authored Aug 9, 2024
1 parent 053d370 commit ef07ea0
Show file tree
Hide file tree
Showing 24 changed files with 54 additions and 57 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 8 additions & 10 deletions cmd/mdatagen/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,8 @@ import (
)
var (
Type = component.MustNewType("foo")
Type = component.MustNewType("foo")
ScopeName = ""
)
const (
Expand Down Expand Up @@ -491,7 +492,8 @@ import (
)
var (
Type = component.MustNewType("foo")
Type = component.MustNewType("foo")
ScopeName = ""
)
const (
Expand Down Expand Up @@ -546,14 +548,12 @@ import (
"go.opentelemetry.io/collector/config/configtelemetry"
)
const ScopeName = ""
func Meter(settings component.TelemetrySettings) metric.Meter {
return settings.MeterProvider.Meter(ScopeName)
return settings.MeterProvider.Meter("")
}
func Tracer(settings component.TelemetrySettings) trace.Tracer {
return settings.TracerProvider.Tracer(ScopeName)
return settings.TracerProvider.Tracer("")
}
`,
},
Expand Down Expand Up @@ -582,14 +582,12 @@ import (
"go.opentelemetry.io/collector/config/configtelemetry"
)
const ScopeName = ""
func Meter(settings component.TelemetrySettings) metric.Meter {
return settings.MeterProvider.Meter(ScopeName)
return settings.MeterProvider.Meter("")
}
func Tracer(settings component.TelemetrySettings) trace.Tracer {
return settings.TracerProvider.Tracer(ScopeName)
return settings.TracerProvider.Tracer("")
}
`,
},
Expand Down
3 changes: 2 additions & 1 deletion cmd/mdatagen/templates/status.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
)

var (
Type = component.MustNewType("{{ .Type }}")
Type = component.MustNewType("{{ .Type }}")
ScopeName = "{{ .ScopeName }}"
)

const (
Expand Down
6 changes: 2 additions & 4 deletions cmd/mdatagen/templates/telemetry.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ import (
"go.opentelemetry.io/collector/config/configtelemetry"
)

const ScopeName = "{{ .ScopeName }}"

func Meter(settings component.TelemetrySettings) metric.Meter {
return settings.MeterProvider.Meter(ScopeName)
return settings.MeterProvider.Meter("{{ .ScopeName }}")
}

func Tracer(settings component.TelemetrySettings) trace.Tracer {
return settings.TracerProvider.Tracer(ScopeName)
return settings.TracerProvider.Tracer("{{ .ScopeName }}")
}
{{- if .Telemetry.Metrics }}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion exporter/debugexporter/internal/metadata/generated_status.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion exporter/nopexporter/internal/metadata/generated_status.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion exporter/otlpexporter/internal/metadata/generated_status.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion receiver/nopreceiver/internal/metadata/generated_status.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion receiver/otlpreceiver/internal/metadata/generated_status.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions service/internal/metadata/generated_telemetry.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ef07ea0

Please sign in to comment.