rollbar-backend

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-08-19 09:56:50 +02:00
parent dbd7365130
commit 17f07f3070
6 changed files with 180 additions and 15 deletions
+162 -13
View File
@@ -7,13 +7,9 @@ import { Config } from '@backstage/config';
import express from 'express';
import { Logger } from 'winston';
// Warning: (ae-missing-release-tag) "createRouter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export function createRouter(options: RouterOptions): Promise<express.Router>;
// Warning: (ae-missing-release-tag) "getRequestHeaders" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export function getRequestHeaders(token: string): {
headers: {
@@ -21,8 +17,6 @@ export function getRequestHeaders(token: string): {
};
};
// Warning: (ae-missing-release-tag) "RollbarApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export class RollbarApi {
constructor(accessToken: string, logger: Logger);
@@ -100,8 +94,168 @@ export class RollbarApi {
>;
}
// Warning: (ae-missing-release-tag) "RouterOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type RollbarEnvironment = 'production' | string;
// @public (undocumented)
export enum RollbarFrameworkId {
// (undocumented)
'browser-js' = 7,
// (undocumented)
'node-js' = 4,
// (undocumented)
'rollbar-system' = 8,
// (undocumented)
'android' = 9,
// (undocumented)
'celery' = 17,
// (undocumented)
'django' = 2,
// (undocumented)
'flask' = 16,
// (undocumented)
'ios' = 10,
// (undocumented)
'logentries' = 12,
// (undocumented)
'mailgun' = 11,
// (undocumented)
'php' = 6,
// (undocumented)
'pylons' = 5,
// (undocumented)
'pyramid' = 3,
// (undocumented)
'python' = 13,
// (undocumented)
'rails' = 1,
// (undocumented)
'rq' = 18,
// (undocumented)
'ruby' = 14,
// (undocumented)
'sidekiq' = 15,
// (undocumented)
'unknown' = 0,
}
// @public (undocumented)
export type RollbarItem = {
publicItemId: number;
integrationsData: null;
levelLock: number;
controllingId: number;
lastActivatedTimestamp: number;
assignedUserId: number;
groupStatus: number;
hash: string;
id: number;
environment: RollbarEnvironment;
titleLock: number;
title: string;
lastOccurrenceId: number;
lastOccurrenceTimestamp: number;
platform: RollbarPlatformId;
firstOccurrenceTimestamp: number;
project_id: number;
resolvedInVersion: string;
status: 'enabled' | string;
uniqueOccurrences: number;
groupItemId: number;
framework: RollbarFrameworkId;
totalOccurrences: number;
level: RollbarLevel;
counter: number;
lastModifiedBy: number;
firstOccurrenceId: number;
activatingOccurrenceId: number;
lastResolvedTimestamp: number;
};
// @public (undocumented)
export type RollbarItemCount = {
timestamp: number;
count: number;
};
// @public (undocumented)
export type RollbarItemsResponse = {
items: RollbarItem[];
page: number;
totalCount: number;
};
// @public (undocumented)
export enum RollbarLevel {
// (undocumented)
critical = 50,
// (undocumented)
debug = 10,
// (undocumented)
error = 40,
// (undocumented)
info = 20,
// (undocumented)
warning = 30,
}
// @public (undocumented)
export enum RollbarPlatformId {
// (undocumented)
'google-app-engine' = 6,
// (undocumented)
'android' = 3,
// (undocumented)
'browser' = 1,
// (undocumented)
'client' = 7,
// (undocumented)
'flash' = 2,
// (undocumented)
'heroku' = 5,
// (undocumented)
'ios' = 4,
// (undocumented)
'unknown' = 0,
}
// @public (undocumented)
export type RollbarProject = {
id: number;
name: string;
accountId: number;
status: 'enabled' | string;
};
// @public (undocumented)
export type RollbarProjectAccessToken = {
projectId: number;
name: string;
scopes: RollbarProjectAccessTokenScope[];
accessToken: string;
status: 'enabled' | string;
};
// @public (undocumented)
export type RollbarProjectAccessTokenScope = 'read' | 'write';
// @public (undocumented)
export type RollbarTopActiveItem = {
item: {
id: number;
counter: number;
environment: RollbarEnvironment;
framework: RollbarFrameworkId;
lastOccurrenceTimestamp: number;
level: number;
occurrences: number;
projectId: number;
title: string;
uniqueOccurrences: number;
};
counts: number[];
};
// @public (undocumented)
export interface RouterOptions {
// (undocumented)
@@ -111,9 +265,4 @@ export interface RouterOptions {
// (undocumented)
rollbarApi?: RollbarApi;
}
// Warnings were encountered during analysis:
//
// src/api/RollbarApi.d.ts:21:9 - (ae-forgotten-export) The symbol "RollbarItem" needs to be exported by the entry point index.d.ts
// src/api/RollbarApi.d.ts:32:13 - (ae-forgotten-export) The symbol "RollbarFrameworkId" needs to be exported by the entry point index.d.ts
```
@@ -30,6 +30,7 @@ const baseUrl = 'https://api.rollbar.com/api/1';
const buildUrl = (url: string) => `${baseUrl}${url}`;
/** @public */
export class RollbarApi {
private projectMap: ProjectMetadataMap | undefined;
@@ -165,6 +166,7 @@ export class RollbarApi {
}
}
/** @public */
export function getRequestHeaders(token: string) {
return {
headers: {
+2 -1
View File
@@ -14,4 +14,5 @@
* limitations under the License.
*/
export { RollbarApi, getRequestHeaders } from './RollbarApi';
export { getRequestHeaders, RollbarApi } from './RollbarApi';
export * from './types';
+12
View File
@@ -16,9 +16,13 @@
// TODO: Make this re-usable with backend
/** @public */
export type RollbarProjectAccessTokenScope = 'read' | 'write';
/** @public */
export type RollbarEnvironment = 'production' | string;
/** @public */
export enum RollbarLevel {
debug = 10,
info = 20,
@@ -27,6 +31,7 @@ export enum RollbarLevel {
critical = 50,
}
/** @public */
export enum RollbarFrameworkId {
'unknown' = 0,
'rails' = 1,
@@ -49,6 +54,7 @@ export enum RollbarFrameworkId {
'rq' = 18,
}
/** @public */
export enum RollbarPlatformId {
'unknown' = 0,
'browser' = 1,
@@ -60,6 +66,7 @@ export enum RollbarPlatformId {
'client' = 7,
}
/** @public */
export type RollbarProject = {
id: number;
name: string;
@@ -67,6 +74,7 @@ export type RollbarProject = {
status: 'enabled' | string;
};
/** @public */
export type RollbarProjectAccessToken = {
projectId: number;
name: string;
@@ -75,6 +83,7 @@ export type RollbarProjectAccessToken = {
status: 'enabled' | string;
};
/** @public */
export type RollbarItem = {
publicItemId: number;
integrationsData: null;
@@ -107,17 +116,20 @@ export type RollbarItem = {
lastResolvedTimestamp: number;
};
/** @public */
export type RollbarItemsResponse = {
items: RollbarItem[];
page: number;
totalCount: number;
};
/** @public */
export type RollbarItemCount = {
timestamp: number;
count: number;
};
/** @public */
export type RollbarTopActiveItem = {
item: {
id: number;
@@ -21,12 +21,14 @@ import { errorHandler } from '@backstage/backend-common';
import { Config } from '@backstage/config';
import { RollbarApi } from '../api';
/** @public */
export interface RouterOptions {
rollbarApi?: RollbarApi;
logger: Logger;
config: Config;
}
/** @public */
export async function createRouter(
options: RouterOptions,
): Promise<express.Router> {
-1
View File
@@ -233,7 +233,6 @@ const ALLOW_WARNINGS = [
'plugins/newrelic',
'plugins/newrelic-dashboard',
'plugins/pagerduty',
'plugins/rollbar-backend',
'plugins/search-backend-module-pg',
'plugins/sentry',
'plugins/shortcuts',