Skip to content

Commit ca99b0f

Browse files
committed
wip
1 parent ab4f15f commit ca99b0f

File tree

12 files changed

+143
-55
lines changed

12 files changed

+143
-55
lines changed

cmd/mdatagen/internal/sampleconnector/internal/metadata/generated_config.go

+1-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mdatagen/internal/sampleconnector/internal/metadata/generated_config_test.go

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mdatagen/internal/sampleconnector/internal/metadata/generated_metrics.go

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_config.go

+1-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_config_test.go

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mdatagen/internal/samplereceiver/internal/metadata/generated_metrics.go

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mdatagen/internal/samplescraper/internal/metadata/generated_config.go

+1-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mdatagen/internal/samplescraper/internal/metadata/generated_config_test.go

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mdatagen/internal/samplescraper/internal/metadata/generated_metrics.go

+30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/mdatagen/internal/templates/config.go.tmpl

-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
// MetricConfig provides common config for a particular metric.
1414
type MetricConfig struct {
1515
Enabled bool `mapstructure:"enabled"`
16-
Name string `mapstructure:"-"`
1716

1817
enabledSetByUser bool
1918
}
@@ -42,7 +41,6 @@ func DefaultMetricsConfig() MetricsConfig {
4241
{{- range $name, $metric := .Metrics }}
4342
{{ $name.Render }}: MetricConfig{
4443
Enabled: {{ $metric.Enabled }},
45-
Name: "{{ $name }}",
4644
},
4745
{{- end }}
4846
}

cmd/mdatagen/internal/templates/config_test.go.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestMetricsBuilderConfig(t *testing.T) {
2727
want: MetricsBuilderConfig{
2828
Metrics: MetricsConfig{
2929
{{- range $name, $_ := .Metrics }}
30-
{{ $name.Render }}: MetricConfig{Enabled: true, Name: "{{ $name }}"},
30+
{{ $name.Render }}: MetricConfig{Enabled: true},
3131
{{- end }}
3232
},
3333
{{- if .ResourceAttributes }}
@@ -44,7 +44,7 @@ func TestMetricsBuilderConfig(t *testing.T) {
4444
want: MetricsBuilderConfig{
4545
Metrics: MetricsConfig{
4646
{{- range $name, $_ := .Metrics }}
47-
{{ $name.Render }}: MetricConfig{Enabled: false, Name: "{{ $name }}"},
47+
{{ $name.Render }}: MetricConfig{Enabled: false},
4848
{{- end }}
4949
},
5050
{{- if .ResourceAttributes }}

cmd/mdatagen/internal/templates/metrics.go.tmpl

+18
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,24 @@ var MapAttribute{{ $name.Render }} = map[string]Attribute{{ $name.Render }}{
5656
{{ end }}
5757
{{- end }}
5858

59+
var MetricsInfo = metricsInfo{
60+
{{- range $name, $metric := .Metrics }}
61+
{{ $name.Render }}: metricInfo{
62+
Name: "{{ $name }}",
63+
},
64+
{{- end }}
65+
}
66+
67+
type metricsInfo struct {
68+
{{- range $name, $metric := .Metrics }}
69+
{{ $name.Render }} metricInfo
70+
{{- end }}
71+
}
72+
73+
type metricInfo struct {
74+
Name string
75+
}
76+
5977
{{ range $name, $metric := .Metrics -}}
6078
type metric{{ $name.Render }} struct {
6179
data pmetric.Metric // data buffer for generated metric.

0 commit comments

Comments
 (0)