Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap/swa-for-sapbas-vsx

Package Overview
Dependencies
Maintainers
0
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap/swa-for-sapbas-vsx

Typescript module for Azure Application Insights to be consumed by VSCode extensions

  • 2.0.7
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

SAP Web Analytics npm package for VSCode Extensions

Wrapper for application insights meant to be used in VSCode Extensions running in SAP Bussiness Application Studio.

Usage

Installation

npm install @sap/swa-for-sapbas-vsx

API

Initialize the client telemetry settings

This can be done in the activate stage of a vscode extension.

import { initTelemetrySettings } from "@sap/swa-for-sapbas-vsx";

initTelemetrySettings(extensionName: string, extensionVersion: number);

Note to take the extensionName and the extensionVersion dynamically from the package.json. The extensionName is constructed from the vsxPublisher and vsxPackageName: <vsxPublisher>.<vsxPackageName>.

report API
import { BASClientFactory, BASTelemetryClient } from "@sap/swa-for-sapbas-vsx";

const basTelemetryClient: BASTelemetryClient = BASClientFactory.getBASTelemetryClient();

// Prepare any string/numeric telemetry data to be submitted
const properties: { [key: string]: string } = {
  customProperty1: "HIGH",
  customProperty2: "DEFAULT",
  customProperty3: "LOW",
};

const measurements: { [key: string]: number } = {
  customMeasure1: 100,
  customMeasure2: 0.73,
  customMeasure3: 2019,
};

// Submit telemetry data
basTelemetryClient.report("eventName", properties, measurements);

Example of usage from a VSCode extension
import * as vscode from "vscode";
import { initTelemetrySettings } from "@sap/swa-for-sapbas-vsx";
import { BASClientFactory, BASTelemetryClient } from "@sap/swa-for-sapbas-vsx";
const packageJson = require("./package.json");

// this method is called when your extension is activated
export function activate(context: vscode.ExtensionContext) {
  const extensionName = `${packageJson.publisher}.${packageJson.name}`; // e.g. SAP.vscode-close-editor
  initTelemetrySettings(extensionName, packageJson.version);
  void vscode.commands.registerCommand("extension.closeActiveEditor", () => {
    void vscode.commands.executeCommand("workbench.action.closeActiveEditor");

    const basTelemetryClient: BASTelemetryClient = BASClientFactory.getBASTelemetryClient();
    // Only eventName is mandatory.
    basTelemetryClient.report("Close Active Editor");
  });
}

Configuring Telemetry Settings for BAS Usage Tracking

This module is designed to track usage metrics for BAS, and it requires the VSCode setting sapbas.telemetryEnabled to be explicitly set to true for telemetry data to be transmitted.

The tool gathers anonymized information regarding your interaction with the software to enhance its offerings. Should you prefer to opt-out of this data collection, simply adjust the sapbas.telemetryEnabled setting to false.

Utilizing Application Insights Events for Report Generation

The following fields can be used for creating reports:

Application Insights FieldOrigin
evenNameThe "eventName" parameter sent via report API. It is constructed by the extensionName/eventName
propertiesAdditional data used to filter events and metrics in the portal. Defaults to empty.
measurementsMetrics associated with this event. Defaults to empty.

You can assume the following properties are automatically being added to each report:

Property NameValue
iaasRefers to the Infrastructure as a Service provider where the extention is running. This could be a cloud provider like AWS, Azure, Google Cloud, etc., indicating the underlying infrastructure platform.
landscapeThe specific environment where the application operates.
is_sap_userA boolean flag indicating whether the user is associated with SAP.
bas_modeIndicates the mode of SAP Business Application Studio. Can be 'free', 'standard', 'buildCodeFree', 'buildCodeStandard'
extension_run_platformIndicates the platform on which the reporting VSCode extension is running.
extension_versionSpecifies the version of the extension or tool being used

FAQs

Package last updated on 20 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc