Skip to content

Commit

Permalink
fix(qs-license): Write correct license type tags to InfluxDB
Browse files Browse the repository at this point in the history
Fixes #1085
  • Loading branch information
Göran Sander committed Apr 12, 2024
1 parent 2694d12 commit e550dea
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions src/lib/post_to_influxdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,12 @@ export async function postQlikSenseLicenseStatusToInfluxDB(qlikSenseLicenseStatu
if (qlikSenseLicenseStatus.analyzerAccess.enabled === true) {
tags.license_type = 'analyzer';

// Do a deep clone of the tags object
const tagsCloned = _.cloneDeep(tags);

datapoint.push({
measurement: 'qlik_sense_license',
tags,
tags: tagsCloned,
fields: {
allocated: qlikSenseLicenseStatus.analyzerAccess.allocated,
available: qlikSenseLicenseStatus.analyzerAccess.available,
Expand All @@ -135,9 +138,12 @@ export async function postQlikSenseLicenseStatusToInfluxDB(qlikSenseLicenseStatu
if (qlikSenseLicenseStatus.analyzerTimeAccess.enabled === true) {
tags.license_type = 'analyzer_capacity';

// Do a deep clone of the tags object
const tagsCloned = _.cloneDeep(tags);

datapoint.push({
measurement: 'qlik_sense_license',
tags,
tags: tagsCloned,
fields: {
allocated_minutes: qlikSenseLicenseStatus.analyzerTimeAccess.allocatedMinutes,
unavailable_minutes: qlikSenseLicenseStatus.analyzerTimeAccess.unavailableMinutes,
Expand All @@ -150,9 +156,12 @@ export async function postQlikSenseLicenseStatusToInfluxDB(qlikSenseLicenseStatu
if (qlikSenseLicenseStatus.professionalAccess.enabled === true) {
tags.license_type = 'professional';

// Do a deep clone of the tags object
const tagsCloned = _.cloneDeep(tags);

datapoint.push({
measurement: 'qlik_sense_license',
tags,
tags: tagsCloned,
fields: {
allocated: qlikSenseLicenseStatus.professionalAccess.allocated,
available: qlikSenseLicenseStatus.professionalAccess.available,
Expand All @@ -168,9 +177,12 @@ export async function postQlikSenseLicenseStatusToInfluxDB(qlikSenseLicenseStatu
if (qlikSenseLicenseStatus.loginAccess.enabled === true) {
tags.license_type = 'token_login';

// Do a deep clone of the tags object
const tagsCloned = _.cloneDeep(tags);

datapoint.push({
measurement: 'qlik_sense_license',
tags,
tags: tagsCloned,
fields: {
allocated_tokens: qlikSenseLicenseStatus.loginAccess.allocatedTokens,
token_cost: qlikSenseLicenseStatus.loginAccess.tokenCost,
Expand All @@ -184,9 +196,12 @@ export async function postQlikSenseLicenseStatusToInfluxDB(qlikSenseLicenseStatu
if (qlikSenseLicenseStatus.userAccess.enabled === true) {
tags.license_type = 'token_user';

// Do a deep clone of the tags object
const tagsCloned = _.cloneDeep(tags);

datapoint.push({
measurement: 'qlik_sense_license',
tags,
tags: tagsCloned,
fields: {
allocated_tokens: qlikSenseLicenseStatus.userAccess.allocatedTokens,
quarantined_tokens: qlikSenseLicenseStatus.userAccess.quarantinedTokens,
Expand All @@ -200,9 +215,12 @@ export async function postQlikSenseLicenseStatusToInfluxDB(qlikSenseLicenseStatu
if (qlikSenseLicenseStatus.tokensEnabled === true) {
tags.license_type = 'tokens_available';

// Do a deep clone of the tags object
const tagsCloned = _.cloneDeep(tags);

datapoint.push({
measurement: 'qlik_sense_license',
tags,
tags: tagsCloned,
fields: {
available_tokens: qlikSenseLicenseStatus.availableTokens,
total_tokens: qlikSenseLicenseStatus.totalTokens,
Expand Down

0 comments on commit e550dea

Please sign in to comment.