This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
Initialize the labels map in the response. #264
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes the following error when the
labels
is not initialized:Labels can be optionally extracted from OC_RESOURCE_TYPE and OC_RESOURCE_LABELS env vars (https://github.com/census-instrumentation/opencensus-go/blob/1901b56b9515b0c34f5d25a5bce982dfc543d64b/resource/resource.go#L30). In case those envs are not set, labels will not be initialized: https://github.com/census-instrumentation/opencensus-go/blob/1901b56b9515b0c34f5d25a5bce982dfc543d64b/resource/resource.go#L98
For the case here, we are in fact sending metrics to Stackdriver. So OC_RESOURCE_TYPE and OC_RESOURCE_LABELS may not be needed. But we should init the Labels field.