# opentelemetry-plugin-gdpr

> Opentelemetry Plugin for specifiying runtime GDPR information to collect later on.

Latest version **1.1.2** (published 2020-07-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install opentelemetry-plugin-gdpr
pnpm add opentelemetry-plugin-gdpr
yarn add opentelemetry-plugin-gdpr
bun add opentelemetry-plugin-gdpr
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2020-07-24 |
| First published | 2020-07-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 9.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Daniel Habenicht |
| Maintainers | danielhabenicht |
| Keywords | opentelemetry, gdpr |

## Links

- npm: https://www.npmjs.com/package/opentelemetry-plugin-gdpr
- npm.io page: https://npm.io/package/opentelemetry-plugin-gdpr

## Dependencies (4)

- [@opentelemetry/api](https://npm.io/package/@opentelemetry/api.md) ^0.9.0
- [@opentelemetry/node](https://npm.io/package/@opentelemetry/node.md) ^0.9.0
- [@opentelemetry/tracing](https://npm.io/package/@opentelemetry/tracing.md) ^0.9.0
- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) ^0.9.0

## Recent versions

- 1.1.2 (latest) — 2020-07-24
- 1.1.1 — 2020-07-24
- 1.1.0 — 2020-07-24
- 1.0.6 — 2020-07-22
- 1.0.5 — 2020-07-21
- 1.0.4 — 2020-07-21
- 1.0.3 — 2020-07-21
- 1.0.2 — 2020-07-21
- 1.0.1 — 2020-07-21
- 1.0.0 — 2020-07-20

## README

# Opentelemetry - GDPR Plugin

This packages allows to quickly add GDPR Info to spans.
Currently implemented as a Proof of Concept for Express Servers.

## Quickstart

### In one line

Add this at the start of your app:

```typescript
// 1. Import this package
import { tracingFullConfiguration, OpenTelemetryGdprPluginConfiguration } from 'opentelemetry-plugin-gdpr';
// 2. Configure some base information (or add them via Environment Variables, see below)
const CONFIG: OpenTelemetryGdprPluginConfiguration = {
  serviceName: 'Example Service',
  location: 'Europe',
  baseTTL: 0,
  baseLegalBasis: 'Contractual',
  baseLegitimateInterest: '',
  baseAutomatedDecisionMaking: false,
  basePurpose: 'Webserver for providing our WebApp',
};
// Load Opentelemetry with our Plugin pre-configured
tracingFullConfiguration(CONFIG);
```

### Usage

All http requests made are automatically traced and the base information are attached. In order to assign specific information to a request Header can be used as a fast an easy way, for example:

```typescript
http.get(
  'http://localhost:4000',
  {
    headers: {
      // For a list of headers see below
      'gdpr.ttl': '0',
      purpose: 'Showing our example',
    },
  },
  (res) => {
    console.log(res.body);
  }
);
```

They will override the base information for this request.

### GDPR Information

You can use the follwing environment variables or header attributes to provide the GDPR information. Overwriting each other as follwing:

1. Header Attributes
2. Environment Variables
3. Code Configuration

| Header Attrbiute               | Environment Variable           | Code Configuration Property   | Description |
| ------------------------------ | ------------------------------ | ----------------------------- | ----------- |
| ---                            | `GDPR_LOCATION`                | `location`                    |             |
| `gdpr.ttl`                     | `GDPR_TTL`                     | `baseTTL`                     |             |
| `gdpr.legalBasis`              | `GDPR_LEGALBASIS`              | `baseLegalBasis`              |             |
| `gdpr.legitimateInterest`      | `GDPR_LEGITIMATEINTEREST`      | `baseLegitimateInterest`      |             |
| `gdpr.automatedDecisionMaking` | `GDPR_AUTOMATEDDECISIONMAKING` | `baseAutomatedDecisionMaking` |             |
| `gdpr.purpose`                 | `GDPR_PURPOSE`                 | `basePurpose`                 |

### More Configuration Options

1. Integrate with existing OpenTelemetry Configurations.
   Add it to the plugins sections

```typescript
const provider = new NodeTracerProvider({
  plugins: {
    http: {
      enabled: true,
      path: '@opentelemetry/plugin-http',
      // Add our plugin to the http-plugin
      ...GdprHttpPluginCustomAttributesFunction(configuration, (span, request, response) => {}),
    },
  },
});
```

---
_Source: https://npm.io/package/opentelemetry-plugin-gdpr · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
