chitin-openclaw-plugin 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +11 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import { trace, SpanStatusCode } from "@opentelemetry/api";
16
16
  import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
17
17
  import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-node";
18
18
  import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
19
- import { Resource } from "@opentelemetry/resources";
19
+ import { resourceFromAttributes } from "@opentelemetry/resources";
20
20
  import { ATTR_SERVICE_NAME } from "@opentelemetry/semantic-conventions";
21
21
  import { HttpInstrumentation } from "@opentelemetry/instrumentation-http";
22
22
  import { UndiciInstrumentation } from "@opentelemetry/instrumentation-undici";
@@ -157,8 +157,16 @@ var plugin = {
157
157
  if (k) headerObj[k.trim()] = v.join("=").trim();
158
158
  }
159
159
  }
160
+ const agentName = process.env.AGENT_NAME || "unknown";
161
+ const agentId = process.env.AGENT_ID || "unknown";
162
+ const pluginResource = resourceFromAttributes({
163
+ [ATTR_SERVICE_NAME]: "chitin-plugin",
164
+ "service.instance.id": `${agentName}-${agentId.slice(0, 8)}`,
165
+ "agent.name": agentName,
166
+ "agent.id": agentId
167
+ });
160
168
  const provider = new NodeTracerProvider({
161
- resource: new Resource({ [ATTR_SERVICE_NAME]: "chitin-plugin" }),
169
+ resource: pluginResource,
162
170
  spanProcessors: [
163
171
  new BatchSpanProcessor(new OTLPTraceExporter({
164
172
  url: `${endpoint}/v1/traces`,
@@ -170,7 +178,7 @@ var plugin = {
170
178
  new HttpInstrumentation().enable();
171
179
  new UndiciInstrumentation().enable();
172
180
  const logProvider = new LoggerProvider({
173
- resource: new Resource({ [ATTR_SERVICE_NAME]: "chitin-plugin" }),
181
+ resource: pluginResource,
174
182
  processors: [
175
183
  new BatchLogRecordProcessor(
176
184
  new OTLPLogExporter({ url: `${endpoint}/v1/logs`, headers: headerObj })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chitin-openclaw-plugin",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "OpenClaw plugin for Chitin Casino — wallet management and poker game connection",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",