Hi phoenix team, I want to update the project that collects the traces from a specific instance of a typescript server I set up using Manual Instrumentation. I tried out different variations but it always seems to send it to default project. Any pointers here that I can try to send the traces to a named project? Thanks in advance!
To send traces to a named project from a TypeScript server using manual instrumentation, you need to set the project name in the Resource attributes for the trace provider. Here's how you can do it: 1. Set Resource Attributes: Define the project name in the Resource attributes.
2. Configure Tracer Provider: Use the TracerProvider to set up the trace provider with the specified resource attributes.
3. Add Span Processor: Add a span processor to handle the spans.Here's a code snippet to illustrate this: LBKSimport { Resource } from '@opentelemetry/resources'; import { NodeTracerProvider } from '@opentelemetry/node'; import { SimpleSpanProcessor } from '@opentelemetry/tracing'; import { CollectorTraceExporter } from '@opentelemetry/exporter-collector';LBKS// Define the project name in the Resource attributes const resource = new Resource({ 'openinference.project.name': '<your-project-name> ', });LBKS// Configure the tracer provider const provider = new NodeTracerProvider({ resource: resource, });LBKS// Set up the span exporter const exporter = new CollectorTraceExporter({ url: '[http://phoenix:6006/v1/traces](http://phoenix:6006/v1/traces)', });LBKS// Add the span processor provider.addSpanProcessor(new SimpleSpanProcessor(exporter));LBKS// Register the tracer provider provider.register();LBKSThis setup ensures that all traces are sent to the specified project instead of the default project.Would you like more details on any specific part of this setup?Sources:
- Customize Traces
- GitHub Issue #3375
馃挕聽Hint: Mention RunLLM in the thread for followups.
