Skip to content

Sending PII Handling Telemetry

Having defined each of your software systems with their own API key with appropriate permissions, defined data retention policies with your Data Protection Officer(s), you are now ready to start sending data use observations to Metronome.

telemetry.ts
import { ServerConfiguration, TelemetryApi, TelemetryRequest, createConfiguration } from "@privatedataservices/metronome-client";
import { explainError } from "./errors";
const clientConfig = createConfiguration( {
baseServer: new ServerConfiguration("https://the-flower-boutique.dev.eu-west-1.privatedataservices.com", {}),
authMethods: { ApiKeyAuth: process.env.METRONOME_API_KEY }
});
const telemetryApiClient = new TelemetryApi(clientConfig);
try {
const telemetryData: TelemetryRequest = {"observationTime": new Date(),
"policies": ["user-account-access"],
"observations": [ {"itemId": "mysql/CodeExamples/customer-123", "subItemIds": ["email", "address"]},
{"itemId": "mysql/CodeExamples/customer-456", "subItemIds": ["email", "phone", "cc_num"]}]};
await telemetryApiClient.postTelemetry(telemetryData);
console.log("Telementry data posted successfully.");
} catch (err) {
explainError(err);
}

Each TelemetryRequest has an observation time, a list of 1 or more policies that were used to handle the data, as well as a list of observations. Each observation must contain an item-id and a list of 1 or more sub-item-ids.

The item-id values are strings that are meaningful to your organisation and which will help you locate the data item in question. In the example above, the organisation has data in several different PII stores, and has chosen to identify the data store type, database or schema name, table name and then the ID value in that table. These are observations in a mysql server, in the CodeExamples database, customer table with ID values 123 and 456. If you have a central PII store and only wish to record the table name and ID, a simple value of customer-123 might be sufficient for you to identify the data item. We make no prescriptions about how you identify your data items. You decide what a meaningful identifier is for your organisation.