E58B Define common data points · nginx/telemetry-exporter@2a35448 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2a35448

Browse files
committed
Define common data points
Problem: Ensure that our Kubernetes-related projects share common telemetry data points for consistency. Solution: - Define common data points type. - Generate Attributes() methods to allow using the type with the Exporter (to implement Exportable interface). A project that uses the exporter library will also export the defined data type. CLOSES - #8
1 parent 3fc010d commit 2a35448

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

pkg/telemetry/data_attributes_generated.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ import (
1313
func (d *Data) Attributes() []attribute.KeyValue {
1414
var attrs []attribute.KeyValue
1515

16-
attrs = append(attrs, attribute.Int64("Nodes", d.Nodes))
16+
attrs = append(attrs, attribute.String("ProjectName", d.ProjectName))
17+
attrs = append(attrs, attribute.String("ProjectVersion", d.ProjectVersion))
18+
attrs = append(attrs, attribute.String("ProjectArchitecture", d.ProjectArchitecture))
19+
attrs = append(attrs, attribute.String("ClusterID", d.ClusterID))
20+
attrs = append(attrs, attribute.Int64("ClusterNodeCount", d.ClusterNodeCount))
21+
attrs = append(attrs, attribute.String("ClusterVersion", d.ClusterVersion))
22+
attrs = append(attrs, attribute.String("ClusterPlatform", d.ClusterPlatform))
23+
attrs = append(attrs, attribute.String("DeploymentID", d.DeploymentID))
1724

1825

1926
return attrs

pkg/telemetry/exporter.go

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,27 @@ import (
1111
sdktrace "go.opentelemetry.io/otel/sdk/trace"
1212
)
1313

14-
// Data includes common telemetry data points.
15-
// FIXME(pleshakov): Define the data points.
16-
// Currently, only one data point is added, for the only reason that we can make sure the generator
17-
// generates code for a struct defined in this package.
18-
// https://github.com/nginxinc/telemetry-exporter/issues/8 will define the actual data points.
14+
// Data defines common telemetry data points for NGINX Kubernetes-related projects.
1915
//
2016
//go:generate go run -tags=generator github.com/nginxinc/telemetry-exporter/cmd/generator -type Data
2117
type Data struct {
22-
// Nodes is a number of nodes.
23-
Nodes int64
18+
// ProjectName is the name of the project.
19+
ProjectName string
20+
// ProjectVersion is the version of the project.
21+
ProjectVersion string
22+
// ProjectArchitecture is the architecture the project. For example, "amd64".
23+
ProjectArchitecture string
24+
// ClusterID is the unique id of the Kubernetes cluster where the project is installed.
25+
// It is the UID of the `kube-system` Namespace.
26+
ClusterID string
27+
// ClusterVersion is the Kubernetes version of the cluster.
28+
ClusterVersion string
29+
// ClusterPlatform is the Kubernetes platform of the cluster.
30+
ClusterPlatform string
31+
// DeploymentID is the unique id of the project installation in the cluster.
32+
DeploymentID string
33+
// ClusterNodeCount is the number of nodes in the cluster.
34+
ClusterNodeCount int64
2435
}
2536

2637
// Exportable allows exporting telemetry data using the Exporter.

0 commit comments

Comments
 (0)
0