You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
We have a simple setInterval that monitors the nodejs memory usage. (basically a hello world example)
(this is a hapi.js plugin)
const{ globalStats, MeasureUnit, AggregationType }=require('@opencensus/core');const{ StackdriverStatsExporter }=require('@opencensus/exporter-stackdriver');constEXPORT_INTERVAL=process.env.EXPORT_INTERVAL||60;constMEMORY_RSS=globalStats.createMeasureInt64('memory_rss',MeasureUnit.BYTE,'Total memory used');globalStats.registerView(globalStats.createView('nodejs_memory_rss',MEMORY_RSS,AggregationType.LAST_VALUE,[],'Total memory used by this process',));exports.register=async()=>{constprojectId='hardcoded-project-name-here';constexporter=newStackdriverStatsExporter({
projectId,period: EXPORT_INTERVAL*1000,});// Pass the created exporter to StatsglobalStats.registerExporter(exporter);setInterval(()=>{constmemoryStats=process.memoryUsage();globalStats.record([{measure: MEMORY_RSS,value: memoryStats.rss,}]);},10000);};exports.name='monitor';
What did you expect to see?
The stats should automatically have kubernetes (pod, container, etc) labels when deployed in a GKE container.
What did you see instead?
It does not make a difference if running locally or on GKE. Both stats end up in the "global" resource without any additional labels (just project_id)
Additional context
The container has the env variable KUBERNETES_SERVICE_HOST=10.111.0.1
We do not use GOOGLE_APPLICATION_CREDENTIALS as it works without that on GKE
Any help is welcome. We would like to debug this, but don't see an easy way. Is there some verbose logging mode in this exporter?
The text was updated successfully, but these errors were encountered:
The container needs the NAMESPACE and CONTAINER_NAME environment variables. Otherwise this line will reset the resource type and all labels to some default stuff.
I don't get why this line is there. Seems to make everything worse for me..
The required env variables should at least be documented.
AFAIK Stackdriver exporter required us to pass all the labels with a value, in case of GKE these labels. If any of the expected label is missing, the exporter will be unhappy and throw an exception.
Something like this:
One or more TimeSeries could not be written: The set of resource labels is incomplete.
Missing labels: (<label>).: timeSeries[<number>]
This line is added as a preemptive measure to handle the missing labels case.
What version of OpenCensus are you using?
What version of Node are you using?
12.14.1
What did you do?
We have a simple setInterval that monitors the nodejs memory usage. (basically a hello world example)
(this is a hapi.js plugin)
What did you expect to see?
The stats should automatically have kubernetes (pod, container, etc) labels when deployed in a GKE container.
What did you see instead?
It does not make a difference if running locally or on GKE. Both stats end up in the "global" resource without any additional labels (just project_id)
Additional context
KUBERNETES_SERVICE_HOST=10.111.0.1
GOOGLE_APPLICATION_CREDENTIALS
as it works without that on GKEAny help is welcome. We would like to debug this, but don't see an easy way. Is there some verbose logging mode in this exporter?
The text was updated successfully, but these errors were encountered: