Skip to content

Commit

Permalink
[chore] use mdatagen for exporterhelper metrics (open-telemetry#10094)
Browse files Browse the repository at this point in the history
Uses the new mdatagen capabilities to generate internal telemetry
details for exporterhelper.

---------

Signed-off-by: Alex Boten <223565+codeboten@users.noreply.github.com>
(cherry picked from commit 5c72c5d)
  • Loading branch information
codeboten authored and steves-canva committed Jun 13, 2024
1 parent 777fee6 commit edb1fa0
Show file tree
Hide file tree
Showing 8 changed files with 296 additions and 108 deletions.
24 changes: 12 additions & 12 deletions cmd/mdatagen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@ func run(ymlPath string) error {
filepath.Join(codeDir, "generated_status.go"), md, "metadata"); err != nil {
return err
}
if err = generateFile(filepath.Join(tmplDir, "telemetry.go.tmpl"),
filepath.Join(codeDir, "generated_telemetry.go"), md, "metadata"); err != nil {
return err
}
if err = generateFile(filepath.Join(tmplDir, "telemetry_test.go.tmpl"),
filepath.Join(codeDir, "generated_telemetry_test.go"), md, "metadata"); err != nil {
return err
}
if err = generateFile(filepath.Join(tmplDir, "component_test.go.tmpl"),
filepath.Join(ymlDir, "generated_component_test.go"), md, packageName); err != nil {
return err
}
if err = generateFile(filepath.Join(tmplDir, "package_test.go.tmpl"),
filepath.Join(ymlDir, "generated_package_test.go"), md, packageName); err != nil {
return err
}
}
if err = generateFile(filepath.Join(tmplDir, "telemetry.go.tmpl"),
filepath.Join(codeDir, "generated_telemetry.go"), md, "metadata"); err != nil {
return err
}
if err = generateFile(filepath.Join(tmplDir, "telemetry_test.go.tmpl"),
filepath.Join(codeDir, "generated_telemetry_test.go"), md, "metadata"); err != nil {
return err
}
if err = generateFile(filepath.Join(tmplDir, "package_test.go.tmpl"),
filepath.Join(ymlDir, "generated_package_test.go"), md, packageName); err != nil {
return err
}

if _, err = os.Stat(filepath.Join(ymlDir, "README.md")); err == nil {
Expand Down
2 changes: 2 additions & 0 deletions exporter/exporterhelper/doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

//go:generate mdatagen metadata.yaml

// Package exporterhelper provides helper functions for exporters.
package exporterhelper // import "go.opentelemetry.io/collector/exporter/exporterhelper"

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

17 changes: 17 additions & 0 deletions exporter/exporterhelper/internal/metadata/generated_status.go

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

100 changes: 100 additions & 0 deletions exporter/exporterhelper/internal/metadata/generated_telemetry.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.

81 changes: 81 additions & 0 deletions exporter/exporterhelper/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
type: exporterhelper

status:
class: pkg
stability:
beta: [traces, metrics, logs]
distributions: [core, contrib]

telemetry:
metrics:
exporter_sent_spans:
enabled: true
description: Number of spans successfully sent to destination.
unit: 1
sum:
value_type: int
monotonic: true

exporter_send_failed_spans:
enabled: true
description: Number of spans in failed attempts to send to destination.
unit: 1
sum:
value_type: int
monotonic: true

exporter_enqueue_failed_spans:
enabled: true
description: Number of spans failed to be added to the sending queue.
unit: 1
sum:
value_type: int
monotonic: true

exporter_sent_metric_points:
enabled: true
description: Number of metric points successfully sent to destination.
unit: 1
sum:
value_type: int
monotonic: true

exporter_send_failed_metric_points:
enabled: true
description: Number of metric points in failed attempts to send to destination.
unit: 1
sum:
value_type: int
monotonic: true

exporter_enqueue_failed_metric_points:
enabled: true
description: Number of metric points failed to be added to the sending queue.
unit: 1
sum:
value_type: int
monotonic: true

exporter_sent_log_records:
enabled: true
description: Number of log record successfully sent to destination.
unit: 1
sum:
value_type: int
monotonic: true

exporter_send_failed_log_records:
enabled: true
description: Number of log records in failed attempts to send to destination.
unit: 1
sum:
value_type: int
monotonic: true

exporter_enqueue_failed_log_records:
enabled: true
description: Number of log records failed to be added to the sending queue.
unit: 1
sum:
value_type: int
monotonic: true
Loading

0 comments on commit edb1fa0

Please sign in to comment.