@opencensus/resource-util
Advanced tools
Comparing version 0.0.13 to 0.0.14
@@ -17,2 +17,3 @@ /** | ||
export * from './resource-labels'; | ||
export * from './constants'; | ||
export * from './detect-resource'; |
@@ -22,3 +22,4 @@ "use strict"; | ||
__export(require("./resource-labels")); | ||
__export(require("./constants")); | ||
__export(require("./detect-resource")); | ||
//# sourceMappingURL=index.js.map |
@@ -19,37 +19,5 @@ /** | ||
export declare const AWS_EC2_INSTANCE_TYPE = "aws.com/ec2/instance"; | ||
/** AWS key that represents a region for the VM. */ | ||
export declare const AWS_REGION_KEY = "aws.com/ec2/region"; | ||
/** AWS key that represents the AWS account number for the VM. */ | ||
export declare const AWS_ACCOUNT_KEY = "aws.com/ec2/account_id"; | ||
/** AWS key that represents the VM instance identifier assigned by AWS. */ | ||
export declare const AWS_INSTANCE_ID_KEY = "aws.com/ec2/instance_id"; | ||
/** GCP GCE key that represents a type of the resource. */ | ||
export declare const GCP_GCE_INSTANCE_TYPE = "cloud.google.com/gce/instance"; | ||
/** GCP GCE key that represents the GCP account number for the instance. */ | ||
export declare const GCP_ACCOUNT_ID_KEY = "cloud.google.com/gce/project_id"; | ||
/** | ||
* GCP GCE key that represents the numeric VM instance identifier assigned by | ||
* GCE. | ||
*/ | ||
export declare const GCP_INSTANCE_ID_KEY = "cloud.google.com/gce/instance_id"; | ||
/** GCP GCE key that represents the GCE zone in which the VM is running. */ | ||
export declare const GCP_ZONE_KEY = "cloud.google.com/gce/zone"; | ||
/** Kubernetes resources key that represents a type of the resource. */ | ||
export declare const K8S_CONTAINER_TYPE = "k8s.io/container"; | ||
/** | ||
* Kubernetes resources key that represents the name for the cluster the | ||
* container is running in. | ||
*/ | ||
export declare const K8S_CLUSTER_NAME_KEY = "k8s.io/cluster/name"; | ||
/** Kubernetes resources key that represents the name of the container. */ | ||
export declare const K8S_CONTAINER_NAME_KEY = "k8s.io/container/name"; | ||
/** | ||
* Kubernetes resources key that represents the identifier for the GCE | ||
* instance the container is running in. | ||
*/ | ||
export declare const K8S_NAMESPACE_NAME_KEY = "k8s.io/namespace/name"; | ||
/** | ||
* Kubernetes resources key that represents the identifier for the pod the | ||
* container is running in. | ||
*/ | ||
export declare const K8S_POD_NAME_KEY = "k8s.io/pod/name"; |
@@ -21,38 +21,6 @@ "use strict"; | ||
exports.AWS_EC2_INSTANCE_TYPE = 'aws.com/ec2/instance'; | ||
/** AWS key that represents a region for the VM. */ | ||
exports.AWS_REGION_KEY = 'aws.com/ec2/region'; | ||
/** AWS key that represents the AWS account number for the VM. */ | ||
exports.AWS_ACCOUNT_KEY = 'aws.com/ec2/account_id'; | ||
/** AWS key that represents the VM instance identifier assigned by AWS. */ | ||
exports.AWS_INSTANCE_ID_KEY = 'aws.com/ec2/instance_id'; | ||
/** GCP GCE key that represents a type of the resource. */ | ||
exports.GCP_GCE_INSTANCE_TYPE = 'cloud.google.com/gce/instance'; | ||
/** GCP GCE key that represents the GCP account number for the instance. */ | ||
exports.GCP_ACCOUNT_ID_KEY = 'cloud.google.com/gce/project_id'; | ||
/** | ||
* GCP GCE key that represents the numeric VM instance identifier assigned by | ||
* GCE. | ||
*/ | ||
exports.GCP_INSTANCE_ID_KEY = 'cloud.google.com/gce/instance_id'; | ||
/** GCP GCE key that represents the GCE zone in which the VM is running. */ | ||
exports.GCP_ZONE_KEY = 'cloud.google.com/gce/zone'; | ||
/** Kubernetes resources key that represents a type of the resource. */ | ||
exports.K8S_CONTAINER_TYPE = 'k8s.io/container'; | ||
/** | ||
* Kubernetes resources key that represents the name for the cluster the | ||
* container is running in. | ||
*/ | ||
exports.K8S_CLUSTER_NAME_KEY = 'k8s.io/cluster/name'; | ||
/** Kubernetes resources key that represents the name of the container. */ | ||
exports.K8S_CONTAINER_NAME_KEY = 'k8s.io/container/name'; | ||
/** | ||
* Kubernetes resources key that represents the identifier for the GCE | ||
* instance the container is running in. | ||
*/ | ||
exports.K8S_NAMESPACE_NAME_KEY = 'k8s.io/namespace/name'; | ||
/** | ||
* Kubernetes resources key that represents the identifier for the pod the | ||
* container is running in. | ||
*/ | ||
exports.K8S_POD_NAME_KEY = 'k8s.io/pod/name'; | ||
//# sourceMappingURL=resource-labels.js.map |
@@ -29,2 +29,3 @@ "use strict"; | ||
const os = require("os"); | ||
const constants_1 = require("./constants"); | ||
const constants = require("./resource-labels"); | ||
@@ -81,7 +82,6 @@ exports.AWS_INSTANCE_IDENTITY_DOCUMENT_URI = 'http://169.254.169.254/latest/dynamic/instance-identity/document'; | ||
const awsIdentityDocument = yield awsMetadataAccessor(); | ||
awsResourceLabels[constants.AWS_ACCOUNT_KEY] = | ||
awsResourceLabels[constants_1.CLOUD_RESOURCE.ACCOUNT_ID_KEY] = | ||
awsIdentityDocument.accountId; | ||
awsResourceLabels[constants.AWS_REGION_KEY] = awsIdentityDocument.region; | ||
awsResourceLabels[constants.AWS_INSTANCE_ID_KEY] = | ||
awsIdentityDocument.instanceId; | ||
awsResourceLabels[constants_1.CLOUD_RESOURCE.REGION_KEY] = awsIdentityDocument.region; | ||
awsResourceLabels[constants_1.HOST_RESOURCE.ID_KEY] = awsIdentityDocument.instanceId; | ||
return true; | ||
@@ -99,5 +99,5 @@ } | ||
const [projectId, instanceId, zoneId] = yield Promise.all([getProjectId(), getInstanceId(), getZone()]); | ||
gceResourceLabels[constants.GCP_ACCOUNT_ID_KEY] = projectId; | ||
gceResourceLabels[constants.GCP_INSTANCE_ID_KEY] = instanceId; | ||
gceResourceLabels[constants.GCP_ZONE_KEY] = zoneId; | ||
gceResourceLabels[constants_1.CLOUD_RESOURCE.ACCOUNT_ID_KEY] = projectId; | ||
gceResourceLabels[constants_1.HOST_RESOURCE.ID_KEY] = instanceId; | ||
gceResourceLabels[constants_1.CLOUD_RESOURCE.ZONE_KEY] = zoneId; | ||
} | ||
@@ -113,9 +113,9 @@ return { type: constants.GCP_GCE_INSTANCE_TYPE, labels: gceResourceLabels }; | ||
const [projectId, zoneId, clusterName, hostname] = yield Promise.all([getProjectId(), getZone(), getClusterName(), getHostname()]); | ||
gkeResourceLabels[constants.GCP_ACCOUNT_ID_KEY] = projectId; | ||
gkeResourceLabels[constants.GCP_ZONE_KEY] = zoneId; | ||
gkeResourceLabels[constants.K8S_CLUSTER_NAME_KEY] = clusterName; | ||
gkeResourceLabels[constants.K8S_NAMESPACE_NAME_KEY] = | ||
gkeResourceLabels[constants_1.CLOUD_RESOURCE.ACCOUNT_ID_KEY] = projectId; | ||
gkeResourceLabels[constants_1.CLOUD_RESOURCE.ZONE_KEY] = zoneId; | ||
gkeResourceLabels[constants_1.K8S_RESOURCE.CLUSTER_NAME_KEY] = clusterName; | ||
gkeResourceLabels[constants_1.K8S_RESOURCE.NAMESPACE_NAME_KEY] = | ||
process.env.NAMESPACE || ''; | ||
gkeResourceLabels[constants.K8S_POD_NAME_KEY] = hostname; | ||
gkeResourceLabels[constants.K8S_CONTAINER_NAME_KEY] = | ||
gkeResourceLabels[constants_1.K8S_RESOURCE.POD_NAME_KEY] = hostname; | ||
gkeResourceLabels[constants_1.CONTAINER_RESOURCE.NAME_KEY] = | ||
process.env.CONTAINER_NAME || ''; | ||
@@ -122,0 +122,0 @@ } |
{ | ||
"name": "@opencensus/resource-util", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "The OpenCensus Monitored Resource Util for Node.js is a collection of utilities for auto detecting monitored resource when exporting stats, based on the environment where the application is running.", | ||
@@ -53,3 +53,3 @@ "main": "build/src/index.js", | ||
"@types/mocha": "^5.2.5", | ||
"@types/nock": "^9.1.3", | ||
"@types/nock": "^10.0.0", | ||
"@types/node": "^9.4.7", | ||
@@ -66,5 +66,5 @@ "codecov": "^3.4.0", | ||
"dependencies": { | ||
"@opencensus/core": "^0.0.13", | ||
"gcp-metadata": "^1.0.0" | ||
"@opencensus/core": "^0.0.14", | ||
"gcp-metadata": "^2.0.0" | ||
} | ||
} |
38028
13
595
+ Added@opencensus/core@0.0.14(transitive)
+ Addedagent-base@6.0.2(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addedgaxios@2.3.4(transitive)
+ Addedgcp-metadata@2.0.4(transitive)
+ Addedhttps-proxy-agent@5.0.1(transitive)
+ Addedis-stream@2.0.1(transitive)
- Removed@opencensus/core@0.0.13(transitive)
- Removedagent-base@4.3.0(transitive)
- Removeddebug@3.2.7(transitive)
- Removedes6-promise@4.2.8(transitive)
- Removedes6-promisify@5.0.0(transitive)
- Removedgaxios@1.8.4(transitive)
- Removedgcp-metadata@1.0.0(transitive)
- Removedhttps-proxy-agent@2.2.4(transitive)
Updated@opencensus/core@^0.0.14
Updatedgcp-metadata@^2.0.0