Skip to content

Commit

Permalink
dep: update artillery-plugin-publish-metrics to use Got v14
Browse files Browse the repository at this point in the history
  • Loading branch information
hassy committed Jan 10, 2025
1 parent ef67801 commit 77f3971
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use strict';

const got = require('got');
const debug = require('debug')('plugin:publish-metrics:dynatrace');
const path = require('path');
const { sleep } = require('../util');

let got = null;

class DynatraceReporter {
constructor(config, events, script) {
if (
Expand Down Expand Up @@ -266,6 +267,10 @@ class DynatraceReporter {
}

async sendRequest(url, options, type = 'metrics') {
if (!got) {
got = (await import('got')).default;
}

this.pendingRequests += 1;

debug(`Sending ${type} to Dynatrace`);
Expand Down
11 changes: 10 additions & 1 deletion packages/artillery-plugin-publish-metrics/lib/newrelic/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const got = require('got');
const { sleep } = require('../util');
const debug = require('debug')('plugin:publish-metrics:newrelic');

let got = null;

class NewRelicReporter {
constructor(config, events, script) {
if (!config.licenseKey) {
Expand Down Expand Up @@ -192,6 +193,10 @@ class NewRelicReporter {
}

async sendStats(url, licenseKey, body) {
if (!got) {
got = (await import('got')).default;
}

this.pendingRequests += 1;
const headers = {
'Content-Type': 'application/json; charset=UTF-8',
Expand Down Expand Up @@ -236,6 +241,10 @@ class NewRelicReporter {
}

async sendEvent(url, licenseKey, eventOptions) {
if (!got) {
got = (await import('got')).default;
}

this.pendingRequests += 1;
const headers = {
'Content-Type': 'application/json; charset=UTF-8',
Expand Down
7 changes: 5 additions & 2 deletions packages/artillery-plugin-publish-metrics/lib/splunk/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const got = require('got');
const { sleep } = require('../util');
const debug = require('debug')('plugin:publish-metrics:splunk');

let got = null;
class SplunkReporter {
constructor(config, events, script) {
if (!config.accessToken) {
Expand Down Expand Up @@ -178,6 +177,10 @@ class SplunkReporter {
}

async sendRequest(url, payload, type) {
if (!got) {
got = (await import('got')).default;
}

this.pendingRequests += 1;
const options = this.formRequest(payload);

Expand Down

0 comments on commit 77f3971

Please sign in to comment.