Giter Site home page Giter Site logo

migration-assistant-demo's Introduction

LaunchDarkly Migration Assistant with OpenTelemetry

This project demonstrates how to use OpenTelemetry with LaunchDarkly migration flags to track the progress of a migration using manual instrumentation. It generates requests to showcase the integration and provides insights into the migration process.

Alt text LaunchDarkly Migration Insights dashboard

Alt text NewRelic Dashboard

Features

Automatically tracks consistency rate, latency, and error rate for migration flags Integrates with OpenTelemetry to export telemetry data Supports multiple exporters, including Prometheus and New Relic Provides a sample configuration for easy setup and customization

Prerequisites

  • NodeJS >=v16
  • LaunchDarkly account
  • New Relic account (optional)
  • Prometheus

Installation

  1. Clone the repository:
git clone [email protected]:tanben/sample-ld-migration.git
  1. Install the dependencies:
npm install
  1. Copy the .env.example file to .env and update it with your LaunchDarkly SDK key (server-side) and New Relic ingest key.

Configuration

The project uses a configuration file (.env) to customize various settings. Here's an example configuration:

# Application config
POLL_INTERVAL=60000
RANDOMIZE_READ=false
RANDOMIZE_WRITE=false

# LaunchDarkly config
LD_SDK_KEY=sdk-11111111-2222222-333333
LD_FLAG_KEY="sample-6-stage-flag"

# OpenTelemetry config
OTEL_ENABLED=false
EXPORTER_INTERVAL=60000
OTEL_DEBUG=false
OTEL_SERVICE_NAME="sample-migration"
OTEL_CONSOLE_LOG=false
OTEL_PROVIDERS=prometheus
# OTEL_PROVIDERS=newrelic,prometheus

# OpenTelemetry Provider config
NEW_RELIC_LICENSE_INGEST_KEY=aaaaa-bbbbbbbbb-cccccccc
OTEL_EXPORTER_OTLP_ENDPOINT=https://otlp.nr-data.net:4318

Usage

To run the project, use the following command:

npm run migration

or

node poll.js

The project will start generating requests and exporting telemetry data based on the configured settings.

Exported Telemetry Data

Metrics

  • migration.read
  • migration.write
  • migration.summary.consistent
  • migration.summary.read
  • migration.summary.write

Counters

  • operation: readNew, readOld, writeNew, writeOld
  • executionTime: Execution time in milliseconds
  • stage: off, dualwrite, shadow, rampdown, complete (see multi-stage migrations for details)

Sample Output


Running [1] Wed Dec 13 2023 14:20:09 GMT-0500 (Eastern Standard Time)
1702495209743: Stage[shadow] Operation[writeOld] user[Everett Gibson]
1702495209745: Stage[shadow] Operation[readOld] user[Everett Gibson]
1702495209753: Stage[shadow] Operation[writeNew] user[Everett Gibson]
1702495209755: => migration:write() Complete. result={"authoritative":{"origin":"old","success":true,"result":{"success":true,"value":"goodbye","executionTime":95,"operation":"writeOld","stage":"shadow"}},"nonAuthoritative":{"origin":"new","success":true,"result":{"success":true,"value":"goodbye","executionTime":8,"operation":"writeNew","stage":"shadow"}}}
1702495209787: Stage[shadow] Operation[readNew] user[Everett Gibson]
1702495209788: => Check: Read consistency validation. 
oldVal={"success":true,"value":"goodbye","executionTime":97,"operation":"readOld","stage":"shadow"}
newVal={"success":true,"value":"goodbye","executionTime":41,"operation":"readNew","stage":"shadow"}
1702495209788: => Check: Read consistency  Timediff= 56 oldVal=goodbye newVal=goodbye Status[Pass]
1702495209789: => migration:read() Complete. result={"origin":"old","success":true,"result":{"success":true,"value":"goodbye","executionTime":97,"operation":"readOld","stage":"shadow"}}

Resources

migration-assistant-demo's People

Contributors

tanben avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.