Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message when using Bun as the engine #5260

Open
lostbean opened this issue Dec 13, 2024 · 2 comments
Open

Error message when using Bun as the engine #5260

lostbean opened this issue Dec 13, 2024 · 2 comments
Labels
bug Something isn't working has:reproducer This bug/feature has a minimal reproducer provided runtime:bun Unsupported Runtime Bun triage

Comments

@lostbean
Copy link

What happened?

Steps to Reproduce

Follow the any basic example of using Phoenix but Bun as the engine.

Actual Result

The logs are send and received by the Phoenix service but an error message is logged in the client for every request.

Expected Result

Keep sending the logs but no error messages in the client side.

Additional Details

Switch the JS engine to Node.js makes the system work normally with any error message.

OpenTelemetry Setup Code

import { LangChainInstrumentation } from "@arizeai/openinference-instrumentation-langchain";
import { SEMRESATTRS_PROJECT_NAME } from "@arizeai/openinference-semantic-conventions";
import * as CallbackManagerModule from "@langchain/core/callbacks/manager";
import { diag, DiagConsoleLogger, DiagLogLevel } from "@opentelemetry/api";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
import { Resource } from "@opentelemetry/resources";
// import { ConsoleSpanExporter } from "@opentelemetry/sdk-trace-base";
import {
  NodeTracerProvider,
  SimpleSpanProcessor,
} from "@opentelemetry/sdk-trace-node";
import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";

export function setupTracing() {
  // For troubleshooting, set the log level to DiagLogLevel.DEBUG
  diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.INFO);

  const provider = new NodeTracerProvider({
    resource: new Resource({
      [ATTR_SERVICE_NAME]: "user-load-agent",
      [SEMRESATTRS_PROJECT_NAME]: "user-load-agent",
    }),
  });

  const otlpExporter = new OTLPTraceExporter({
    timeoutMillis: 50000,
  });

  // provider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
  provider.addSpanProcessor(new SimpleSpanProcessor(otlpExporter));

  const lcInstrumentation = new LangChainInstrumentation();
  // LangChain must be manually instrumented as it doesn't have a traditional module structure
  lcInstrumentation.manuallyInstrument(CallbackManagerModule);

  provider.register();

  // eslint-disable-next-line no-console
  console.log("👀 OpenInference initialized");

  return {
    forceFlush: async () => {
      otlpExporter.forceFlush();
      provider.forceFlush();
    },
  };
}

package.json

{
  "name": "myapp",
  "private": true,
  "version": "1.0.0",
  "type": "module",
  "module": "src/client.ts",
  "scripts": {
    "build": "tsc",
    "start": "bun run dist/client.js",
    "dev": "bun run --watch src/client.ts"
  },
  "engines": {
    "bun": "1.1.37"
  },
  "dependencies": {
    "@anthropic-ai/sdk": "^0.32.1",
    "@arizeai/openinference-instrumentation-langchain": "^0.2.0",
    "@opentelemetry/exporter-trace-otlp-http": "^0.49.1",
    "@opentelemetry/exporter-trace-otlp-proto": "^0.56.0",
    "@opentelemetry/sdk-trace-base": "^1.22.0",
    "@opentelemetry/sdk-trace-node": "^1.22.0",
    "dotenv": "^16.4.5",
    "express": "^4.21.1",
    "langchain": "^0.3.5",
    "typescript": "^5.6.3",
    "uuid": "^11.0.3",
    "ws": "^8.18.0"
  },
  "devDependencies": {
    "@types/bun": "latest",
    "@types/express": "^5.0.0",
    "@types/ws": "^8.5.13",
    "typescript": "^5.6.3"
  },
  "peerDependencies": {
    "prettier": "^3.3.3",
    "eslint": "^8"
  },
  "prettier": {}
}

Relevant log output

{"message":"Request timed out","originalLine":"59","originalColumn":"25","line":"87","column":"24","sourceURL":"/code/node_modules/@opentelemetry/exporter-trace-otlp-proto/node_modules/@opentelemetry/otlp-exporter-base/build/src/transport/http-transport-utils.js","stack":"Error: Request timed out\n    at <anonymous> (/code/node_modules/@opentelemetry/exporter-trace-otlp-proto/node_modules/@opentelemetry/otlp-exporter-base/build/src/transport/http-transport-utils.js:87:24)\n    at emit (node:events:183:48)\n    at emitCloseNT (node:http:191:21)\n    at <anonymous> (node:http:1074:18)\n    at <anonymous> (native:19:28)\n    at processTicksAndRejections (native:7:39)","name":"Error"}

Operating System and Version

macOS 15.1

Runtime and Version

bun 1.1.31, Node.js v20.17.0

@lostbean lostbean added bug Something isn't working triage labels Dec 13, 2024
@pichlermarc pichlermarc added the runtime:bun Unsupported Runtime Bun label Dec 13, 2024
@pichlermarc
Copy link
Member

pichlermarc commented Dec 13, 2024

Hi @lostbean - thanks for reaching out.

Please note that bun is currently not supported by this project. If you can provide a fix that still passes the tests for Node.js we're happy to accept that fix.

@dyladan dyladan added the needs:reproducer This bug/feature is in need of a minimal reproducer label Dec 18, 2024
@pichlermarc
Copy link
Member

pichlermarc commented Dec 18, 2024

link to reproducer: https://github.com/pichlermarc/repro-5260
Two observations:

  • the timeout happens immediately on export
  • the export never arrives on the collector

@lostbean - in the issue you opened it says that "logs" arrive in Phoenix - are you trying to say that the trace export fails but you can see the traces that were exported? Or are you referring to something else? 🤔

@pichlermarc pichlermarc added has:reproducer This bug/feature has a minimal reproducer provided and removed needs:reproducer This bug/feature is in need of a minimal reproducer labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has:reproducer This bug/feature has a minimal reproducer provided runtime:bun Unsupported Runtime Bun triage
Projects
None yet
Development

No branches or pull requests

3 participants