Skip to content

CloudProfiler: Labels is always null in matadata.csv  #4323

@s4s7

Description

@s4s7

In which file did you encounter the issue?

labelBytes, err := json.Marshal(profile.Labels)

Did you change the file? If so, how?

To fill Labels value in matadata.csv

Before:

labelBytes, err := json.Marshal(profile.Labels)

After:

labelBytes, err := json.Marshal(profile.Deployment.Labels)

To make label data more readable:

Before:

err = writer.Write([]string{filename, profile.Name, profile.Deployment.Target, profile.Duration.String(), string(labelBytes)})

After:

err = writer.Write([]string{filename, profile.Name, profile.Deployment.Target, profile.Duration.String(), strings.ReplaceAll(string(labelBytes), `"`, ``)})

Describe the issue

Before: Output results of the metadata.csv

Labels is always null in my environment.

File,Name,ProfileType,Target,Duration,Labels
profiles_1723995611/profile000001.pb.gz,,api,,null
profiles_1723995611/profile000002.pb.gz,,api,,null
profiles_1723995611/profile000003.pb.gz,,api,,null
profiles_1723995611/profile000004.pb.gz,,api,,null
profiles_1723995611/profile000005.pb.gz,,api,,null

After: Output results of the metadata.csv

File,Name,ProfileType,Target,Duration,Labels
profiles_1723998663/profile000001.pb.gz,,api,,"{language:go,version:v1.0.6,zone:asia-northeast1-1}"
profiles_1723998663/profile000002.pb.gz,,api,,"{language:go,version:v1.0.6,zone:asia-northeast1-1}"
profiles_1723998663/profile000003.pb.gz,,api,,"{language:go,version:v1.0.6,zone:asia-northeast1-1}"
profiles_1723998663/profile000004.pb.gz,,api,,"{language:go,version:v1.0.6,zone:asia-northeast1-1}"
profiles_1723998663/profile000005.pb.gz,,api,,"{language:go,version:v1.0.6,zone:asia-northeast1-1}"

how do you think ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: cloudprofilerIssues related to the Cloud Profiler API.priority: p2Moderately-important priority. Fix may not be included in next release.samplesIssues that are directly related to samples.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions