foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.24k stars 1.73k forks source link

Feature: support distributed tracing for Anvil #2402

Closed sambacha closed 2 years ago

sambacha commented 2 years ago

Component

Anvil

Describe the feature you would like

Feature: Distributed Tracing for Anvil

In order to make a system observable, it must be instrumented. That is, the code must emit traces, metrics, and logs. The instrumented data must then be sent to an Observability back-end. There are a number of Observability back-ends out there, ranging from self-hosted open-source tools (e.g. Jaeger and Zipkin), to commercial SAAS offerings. This feature request asks for Open Telemetry to be integrated into Anvil.

For reference, Hyperledger Besu has support for OTEL.

Example: OTEL Config w/ docker-compose

# otel-collector-config.yml:
receivers:
  otlp:
    protocols:
      grpc:
      http:

exporters:
  zipkin:
    endpoint: "http://zipkin:9411/api/v2/spans"

processors:
  batch:

extensions:
  health_check:
  pprof:
  zpages:

service:
  extensions: [pprof, zpages, health_check]
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [zipkin]
      processors: [batch]

# docker-compose.yml
version: "3"
services:
  otel-collector:
    image: otel/opentelemetry-collector-contrib:0.11.0
    command: ["--config=/etc/otel-collector-config.yml"]
    volumes:
      - ./otel-collector-config.yml:/etc/otel-collector-config.yml
    ports:
      - "1888:1888"   # pprof extension
      - "8888:8888"   # Prometheus metrics exposed by the collector
      - "8889:8889"   # Prometheus exporter metrics
      - "13133:13133" # health_check extension
      - "55680:55680" # zpages extension
    depends_on:
      - zipkin
  foundry:
    image: manifoldfinance/foundry
    container_name: foundry
    command:
      - '--config.file=/etc/foundry/foundry.toml'
    ports:
      - 9090:9090
    restart: unless-stopped
    networks:
      - overlay
    deploy:
      endpoint_mode: vip
    volumes:
      - ./foundry:/etc/foundry
      - forge_data:/foundry
    environment:
      ETH_RPC_URL: development
      DAPP_SOLC_VERSION: 0.8.15
      DAPP_TEST_VERBOSITY: 1
  working_dir: /usr/src/app
  volumes:
    - .:/usr/src/app:cached
    - .:/opt/solc:cached

  #Zipkin
  zipkin:
    image: openzipkin/zipkin
    container_name: zipkin
    ports:
      - 9411:9411
      - ```

### Additional context

part of https://github.com/foundry-rs/foundry/issues/2396
onbjerg commented 2 years ago

Unsure what the benefit of having distributed tracing in a development node is? Anvil is not supposed to be deployed as a working node, just run locally or in CI

sambacha commented 2 years ago

Unsure what the benefit of having distributed tracing in a development node is? Anvil is not supposed to be deployed as a working node, just run locally or in CI

I am using it as part of a large testing environment where having this is useful

sambacha commented 2 years ago

Unsure what the benefit of having distributed tracing in a development node is? Anvil is not supposed to be deployed as a working node, just run locally or in CI

Maybe this will provide additional context, https://github.com/foundry-rs/foundry/issues/2404

onbjerg commented 2 years ago

I think this feature makes sense for large deployments of production nodes, but for a development node intended for local use or CI use it doesn't make a lot of sense especially compared to the complexity/overhead of implementing the feature. Closing this as out of scope for that reason