Convert Figma logo to code with AI

uptrace logobun

SQL-first Golang ORM

3,591
218
3,591
170

Top Related Projects

20,160

CNCF Jaeger, a Distributed Tracing Platform

OpenTelemetry Collector

3,881

Grafana Tempo is a high volume, minimal dependency distributed tracing backend.

Quick Overview

Uptrace/bun is an open-source distributed tracing system and application performance monitoring (APM) tool. It's designed to help developers monitor, troubleshoot, and optimize their applications by providing insights into system performance and behavior.

Pros

  • Easy to set up and integrate with existing applications
  • Supports multiple programming languages and frameworks
  • Provides detailed performance metrics and visualizations
  • Offers both self-hosted and cloud-based options

Cons

  • Relatively new project, may have fewer features compared to more established APM tools
  • Documentation could be more comprehensive
  • Limited community support compared to larger, more popular APM solutions

Code Examples

Here are a few examples of how to use Uptrace with different programming languages:

  1. Go example (using OpenTelemetry):
import (
    "go.opentelemetry.io/otel"
    "github.com/uptrace/uptrace-go/uptrace"
)

func main() {
    uptrace.ConfigureOpenTelemetry(
        uptrace.WithDSN("https://<token>@api.uptrace.dev/<project_id>"),
    )
    defer uptrace.Shutdown()

    tracer := otel.Tracer("my-app")
    ctx, span := tracer.Start(context.Background(), "main")
    defer span.End()

    // Your application code here
}
  1. Python example:
from opentelemetry import trace
from uptrace import configure_opentelemetry

configure_opentelemetry(
    dsn="https://<token>@api.uptrace.dev/<project_id>",
    service_name="myapp",
    service_version="1.0.0",
)

tracer = trace.get_tracer("my-app")

with tracer.start_as_current_span("main"):
    # Your application code here
  1. Node.js example:
const { NodeTracerProvider } = require('@opentelemetry/node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const { UptracePropagator, UptraceBatchSpanProcessor } = require('@uptrace/uptrace-node');

const provider = new NodeTracerProvider();
provider.register({
  propagator: new UptracePropagator(),
});

registerInstrumentations({
  instrumentations: getNodeAutoInstrumentations(),
});

const uptrace = new UptraceBatchSpanProcessor({
  dsn: 'https://<token>@api.uptrace.dev/<project_id>',
});

provider.addSpanProcessor(uptrace);

// Your application code here

Getting Started

To get started with Uptrace:

  1. Sign up for an Uptrace account at https://uptrace.dev/
  2. Create a new project and obtain your DSN (Data Source Name)
  3. Install the Uptrace library for your programming language (e.g., pip install uptrace for Python)
  4. Configure Uptrace in your application using the provided DSN
  5. Instrument your code with OpenTelemetry traces and metrics
  6. Deploy your application and start monitoring its performance in the Uptrace dashboard

For more detailed instructions and language-specific guides, refer to the official Uptrace documentation.

Competitor Comparisons

20,160

CNCF Jaeger, a Distributed Tracing Platform

Pros of Jaeger

  • More mature and widely adopted in the industry
  • Supports multiple storage backends (Cassandra, Elasticsearch, etc.)
  • Offers a rich set of features for distributed tracing

Cons of Jaeger

  • Can be complex to set up and configure
  • Requires more resources to run effectively
  • May have a steeper learning curve for beginners

Code Comparison

Jaeger (Go):

tracer, closer, err := cfg.NewTracer(
    config.Logger(jaeger.StdLogger),
)
defer closer.Close()

Bun (JavaScript):

const tracer = new BunTracer({
  serviceName: 'my-service',
  url: 'http://localhost:14318/v1/traces'
});

Additional Notes

Bun is a more lightweight and easy-to-use alternative to Jaeger, focusing on simplicity and developer experience. It's designed to work well with modern JavaScript and TypeScript applications, making it a good choice for teams already using these technologies.

Jaeger, on the other hand, offers a more comprehensive solution for distributed tracing across various languages and frameworks. It's better suited for large-scale, complex systems where advanced features and flexibility are required.

OpenTelemetry Collector

Pros of OpenTelemetry Collector

  • Widely adopted and supported by the OpenTelemetry community
  • Offers a more comprehensive set of features for telemetry data collection and processing
  • Highly extensible with a plugin architecture for custom receivers, processors, and exporters

Cons of OpenTelemetry Collector

  • More complex setup and configuration compared to Bun
  • Potentially higher resource usage due to its comprehensive feature set
  • Steeper learning curve for newcomers to observability and telemetry

Code Comparison

OpenTelemetry Collector configuration (YAML):

receivers:
  otlp:
    protocols:
      grpc:
processors:
  batch:
exporters:
  prometheus:
    endpoint: "0.0.0.0:8889"

Bun configuration (JavaScript):

import { BunTracer } from "bun";

const tracer = new BunTracer({
  serviceName: "my-service",
  endpoint: "http://localhost:14268/api/traces"
});

The OpenTelemetry Collector configuration demonstrates its flexibility in defining receivers, processors, and exporters. In contrast, Bun's configuration is more straightforward and focused on tracing setup. While the OpenTelemetry Collector offers more customization options, Bun provides a simpler approach for quick integration into JavaScript/TypeScript projects.

3,881

Grafana Tempo is a high volume, minimal dependency distributed tracing backend.

Pros of Tempo

  • More mature and widely adopted project with a larger community
  • Integrated with Grafana's ecosystem for visualization and querying
  • Supports multiple storage backends (S3, GCS, Azure Blob Storage)

Cons of Tempo

  • Higher resource requirements and complexity
  • Steeper learning curve for setup and configuration
  • Limited to tracing data, while Bun offers a more comprehensive observability solution

Code Comparison

Tempo (configuration example):

tempo:
  receivers:
    jaeger:
      protocols:
        thrift_http:
          endpoint: 0.0.0.0:14268

Bun (configuration example):

bun.Init(&bun.Config{
    DSN: "postgres://user:pass@localhost:5432/db",
    TracingEnabled: true,
})

Summary

Tempo is a robust distributed tracing backend with strong integration into the Grafana ecosystem, making it suitable for large-scale deployments. Bun, on the other hand, offers a more lightweight and comprehensive observability solution that includes tracing, metrics, and logging. While Tempo excels in tracing-specific features and scalability, Bun provides a simpler setup and broader observability capabilities in a single package. The choice between the two depends on specific project requirements, existing infrastructure, and the desired level of integration with other tools.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

SQL-first Golang ORM for PostgreSQL, MySQL, MSSQL, and SQLite

build workflow PkgGoDev Documentation Chat

Bun is brought to you by :star: uptrace/uptrace. Uptrace is an open-source APM tool that supports distributed tracing, metrics, and logs. You can use it to monitor applications and set up automatic alerts to receive notifications via email, Slack, Telegram, and others.

See OpenTelemetry example which demonstrates how you can use Uptrace to monitor Bun.

Features

Resources

Tutorials

Wrote a tutorial for Bun? Create a PR to add here and on Bun site.

Featured projects using Bun

Why another database client?

So you can elegantly write complex queries:

regionalSales := db.NewSelect().
	ColumnExpr("region").
	ColumnExpr("SUM(amount) AS total_sales").
	TableExpr("orders").
	GroupExpr("region")

topRegions := db.NewSelect().
	ColumnExpr("region").
	TableExpr("regional_sales").
	Where("total_sales > (SELECT SUM(total_sales) / 10 FROM regional_sales)")

var items []map[string]interface{}
err := db.NewSelect().
	With("regional_sales", regionalSales).
	With("top_regions", topRegions).
	ColumnExpr("region").
	ColumnExpr("product").
	ColumnExpr("SUM(quantity) AS product_units").
	ColumnExpr("SUM(amount) AS product_sales").
	TableExpr("orders").
	Where("region IN (SELECT region FROM top_regions)").
	GroupExpr("region").
	GroupExpr("product").
	Scan(ctx, &items)
WITH regional_sales AS (
    SELECT region, SUM(amount) AS total_sales
    FROM orders
    GROUP BY region
), top_regions AS (
    SELECT region
    FROM regional_sales
    WHERE total_sales > (SELECT SUM(total_sales)/10 FROM regional_sales)
)
SELECT region,
       product,
       SUM(quantity) AS product_units,
       SUM(amount) AS product_sales
FROM orders
WHERE region IN (SELECT region FROM top_regions)
GROUP BY region, product

And scan results into scalars, structs, maps, slices of structs/maps/scalars:

users := make([]User, 0)
if err := db.NewSelect().Model(&users).OrderExpr("id ASC").Scan(ctx); err != nil {
	panic(err)
}

user1 := new(User)
if err := db.NewSelect().Model(user1).Where("id = ?", 1).Scan(ctx); err != nil {
	panic(err)
}

See Getting started guide and check examples.

See also

Contributing

See CONTRIBUTING.md for some hints.

And thanks to all the people who already contributed!