@monocle.sh/effect-agent 0.0.2 → 0.1.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/src/layer.mjs +17 -1
  2. package/package.json +2 -2
@@ -20,6 +20,18 @@ const DEV_BATCH_CONFIG = {
20
20
  ...DEFAULT_BATCH_CONFIG,
21
21
  scheduledDelayMillis: 100
22
22
  };
23
+ function resolveSdkVersion() {
24
+ return "0.1.0";
25
+ }
26
+ function buildNodejsResourceAttributes() {
27
+ const attributes = {
28
+ "monocle.language.name": "javascript",
29
+ "monocle.framework.name": "effect"
30
+ };
31
+ const sdkVersion = resolveSdkVersion();
32
+ if (sdkVersion) attributes["telemetry.sdk.version"] = sdkVersion;
33
+ return attributes;
34
+ }
23
35
  /**
24
36
  * Resolve the Monocle API key from config or MONOCLE_API_KEY env var.
25
37
  * Returns a Redacted value to prevent accidental logging.
@@ -53,6 +65,10 @@ function MonocleLayer(config) {
53
65
  const endpoint = isDev ? config.endpoint || DEV_ENDPOINT : config.endpoint || DEFAULT_ENDPOINT;
54
66
  const environment = resolveEnvironment(config.environment);
55
67
  const batchConfig = isDev ? DEV_BATCH_CONFIG : DEFAULT_BATCH_CONFIG;
68
+ const resourceAttributes = {
69
+ "deployment.environment": environment,
70
+ ...buildNodejsResourceAttributes()
71
+ };
56
72
  const headers = { "x-monocle-env": environment };
57
73
  if (Option.isSome(apiKey)) headers["x-api-key"] = Redacted.value(apiKey.value);
58
74
  const monocleProcessor = new MonocleSpanProcessor();
@@ -60,7 +76,7 @@ function MonocleLayer(config) {
60
76
  resource: {
61
77
  serviceName: config.serviceName,
62
78
  serviceVersion: config.serviceVersion ?? "0.0.0",
63
- attributes: { "deployment.environment": environment }
79
+ attributes: resourceAttributes
64
80
  },
65
81
  spanProcessor: [monocleProcessor, new BatchSpanProcessor(new OTLPTraceExporter({
66
82
  url: `${endpoint}/v1/traces`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monocle.sh/effect-agent",
3
- "version": "0.0.2",
3
+ "version": "0.1.0",
4
4
  "description": "Monocle observability agent for Effect applications",
5
5
  "keywords": [
6
6
  "effect",
@@ -38,7 +38,7 @@
38
38
  "@opentelemetry/sdk-logs": "^0.214.0",
39
39
  "@opentelemetry/sdk-metrics": "^2.6.1",
40
40
  "@opentelemetry/sdk-trace-node": "^2.6.1",
41
- "@monocle.sh/otel-utils": "1.0.2"
41
+ "@monocle.sh/otel-utils": "1.1.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@adonisjs/tsconfig": "^2.0.0",