Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define common data points #27

Merged
merged 4 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkg/telemetry/data_attributes_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ import (
func (d *Data) Attributes() []attribute.KeyValue {
var attrs []attribute.KeyValue

attrs = append(attrs, attribute.Int64("Nodes", d.Nodes))
attrs = append(attrs, attribute.String("ProjectName", d.ProjectName))
attrs = append(attrs, attribute.String("ProjectVersion", d.ProjectVersion))
attrs = append(attrs, attribute.String("ProjectArchitecture", d.ProjectArchitecture))
attrs = append(attrs, attribute.String("ClusterID", d.ClusterID))
attrs = append(attrs, attribute.String("ClusterVersion", d.ClusterVersion))
attrs = append(attrs, attribute.String("ClusterPlatform", d.ClusterPlatform))
attrs = append(attrs, attribute.String("DeploymentID", d.DeploymentID))
attrs = append(attrs, attribute.Int64("ClusterNodeCount", d.ClusterNodeCount))


return attrs
Expand Down
25 changes: 18 additions & 7 deletions pkg/telemetry/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,27 @@ import (
sdktrace "go.opentelemetry.io/otel/sdk/trace"
)

// Data includes common telemetry data points.
// FIXME(pleshakov): Define the data points.
// Currently, only one data point is added, for the only reason that we can make sure the generator
// generates code for a struct defined in this package.
// https://github.com/nginxinc/telemetry-exporter/issues/8 will define the actual data points.
// Data defines common telemetry data points for NGINX Kubernetes-related projects.
//
//go:generate go run -tags=generator github.com/nginxinc/telemetry-exporter/cmd/generator -type Data
type Data struct {
pleshakov marked this conversation as resolved.
Show resolved Hide resolved
// Nodes is a number of nodes.
Nodes int64
// ProjectName is the name of the project.
ProjectName string
// ProjectVersion is the version of the project.
ProjectVersion string
// ProjectArchitecture is the architecture the project. For example, "amd64".
pleshakov marked this conversation as resolved.
Show resolved Hide resolved
ProjectArchitecture string
pleshakov marked this conversation as resolved.
Show resolved Hide resolved
// ClusterID is the unique id of the Kubernetes cluster where the project is installed.
ciarams87 marked this conversation as resolved.
Show resolved Hide resolved
// It is the UID of the `kube-system` Namespace.
ClusterID string
// ClusterVersion is the Kubernetes version of the cluster.
ClusterVersion string
// ClusterPlatform is the Kubernetes platform of the cluster.
ClusterPlatform string
// DeploymentID is the unique id of the project installation in the cluster.
pleshakov marked this conversation as resolved.
Show resolved Hide resolved
DeploymentID string
pleshakov marked this conversation as resolved.
Show resolved Hide resolved
// ClusterNodeCount is the number of nodes in the cluster.
ClusterNodeCount int64
}

// Exportable allows exporting telemetry data using the Exporter.
Expand Down
Loading