Socket
Book a DemoInstallSign in
Socket

api-integrations-logging

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

api-integrations-logging

This repository contains the backend API which is responsible for creating tokens for partner providers to push their logs to Grafana Loki instance, checking the heartbeats of deployments, and performing other operational tasks. The API provides a simple

1.0.0
unpublished
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

API3 logging service

This repository contains the backend API which is responsible for creating tokens for partner providers to push their logs to Grafana Loki instance, checking the heartbeats of deployments, and performing other operational tasks. The API provides a simple and secure way for partner providers to access the API3 log service, and ensures that deployments are running smoothly. To get started, see the "Getting Started" section below.

Getting Started

Configuration

  • Copy .env from the example.env file.
  • Open the .env file and update the environment variables:
    • TOKEN_REQUEST_MESSAGE: Message that is expected to be signed by frontend
    • GF_CLOUD_REGION: Region of the utilizied Grafana Cloud instance
    • GF_CLOUD_TOKEN: Grafana Cloud token that is enabled to generate token and read logs
    • GF_CLOUD_ACCESS_POLICY_ID: Policy to be used while generating token, expected to write-only logs (logs:write)
    • GF_LOKI_USER: Grafana Loki user able to use endpoint GF_LOKI_ENDPOINT
    • GF_LOKI_ENDPOINT: Grafana Loki HTTP API endpoint

Deployment

To deploy infrastructure to AWS:

pnpm deploy --region us-east-2 --stage dev

To remove deployment:

pnpm removeDeployment --region us-east-2 --stage dev

Public Endpoint

This service is publicly accessible at the following endpoint:

  • https://integration.nodary.io

Usage

The API provides the following endpoints:

  • POST /generateToken: Get token to push logs.
  • GET /deploymentStatus: Get status for the deployment.

Local development

Start local dynamodb server:

pnpm dynamodb-local-up

Initialize tables:

pnpm init-tables

Spin up local express server to mimic AWS API gateway:

pnpm start-local

You can use following valid examples in the next section to test server.

Examples

  • Generate token:

# Upsert batch of signed data (HTTP POST)
curl -L -X POST "https://integration.nodary.io/generateToken" -H "Content-Type: application/json" -H "X-API-KEY: exampleUser:exampleApiKey" -d "{\"airnode\":\"0x6CFec029322bfb6f8f6a5A6662b4A3136eeD83A7\"}"

# Response will be:
# {
#    "airnode": "0x6CFec029322bfb6f8f6a5A6662b4A3136eeD83A7",
#    "lokiEndpoint": "logs-prod-012.grafana.net",
#    "lokiToken": "glc_somelokiWV1LXQtoken==",
#    "lokiUser": "123456"
# }

  • Check deployment status for the airnode-feed with airnode address 0x6CFec029322bfb6f8f6a5A6662b4A3136eeD83A7
curl --location 'localhost:8090/deploymentStatus?airnode=0x6CFec029322bfb6f8f6a5A6662b4A3136eeD83A7&app=airnode-feed'

References

  • Custom domain support for AWS API Gateway and CDN caching, see the page.

FAQs

Package last updated on 08 Jan 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.