@monocle.sh/effect-agent 0.3.0 → 0.4.1

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.
@@ -6,6 +6,7 @@ import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
6
6
  import { BatchLogRecordProcessor } from "@opentelemetry/sdk-logs";
7
7
  import { NodeSdk } from "@effect/opentelemetry";
8
8
  import { Layer, Option, Redacted } from "effect";
9
+ import { ServiceVersionDetector, detectServiceVersion } from "@monocle.sh/otel-utils/service-version";
9
10
  import { parseMonocleDsn } from "@monocle.sh/otel-utils/connection";
10
11
  import { MonocleSpanProcessor, buildNodejsMonocleResourceAttributes } from "@monocle.sh/otel-utils";
11
12
  //#region src/layer.ts
@@ -22,7 +23,7 @@ const DEV_BATCH_CONFIG = {
22
23
  scheduledDelayMillis: 100
23
24
  };
24
25
  function resolveSdkVersion() {
25
- return "0.3.0";
26
+ return "0.4.1";
26
27
  }
27
28
  function buildNodejsResourceAttributes() {
28
29
  const sdkVersion = resolveSdkVersion();
@@ -71,9 +72,12 @@ function MonocleLayer(config) {
71
72
  const endpoint = isDev ? config.endpoint || DEV_ENDPOINT : connection?.endpoint || config.endpoint || DEFAULT_ENDPOINT;
72
73
  const environment = resolveEnvironment(config.environment);
73
74
  const batchConfig = isDev ? DEV_BATCH_CONFIG : DEFAULT_BATCH_CONFIG;
75
+ const version = detectServiceVersion({ serviceVersion: config.serviceVersion });
74
76
  const resourceAttributes = {
77
+ "deployment.environment.name": environment,
75
78
  "deployment.environment": environment,
76
- ...buildNodejsResourceAttributes()
79
+ ...buildNodejsResourceAttributes(),
80
+ ...ServiceVersionDetector.resourceAttributes(version)
77
81
  };
78
82
  const headers = { "x-monocle-env": environment };
79
83
  if (connection) headers["x-monocle-service-id"] = connection.serviceId;
@@ -82,7 +86,7 @@ function MonocleLayer(config) {
82
86
  return NodeSdk.layer(() => ({
83
87
  resource: {
84
88
  serviceName: config.serviceName ?? "unknown_service",
85
- serviceVersion: config.serviceVersion ?? "0.0.0",
89
+ serviceVersion: version.version,
86
90
  attributes: resourceAttributes
87
91
  },
88
92
  spanProcessor: [monocleProcessor, new BatchSpanProcessor(new OTLPTraceExporter({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monocle.sh/effect-agent",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
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.216.0",
39
39
  "@opentelemetry/sdk-metrics": "^2.7.1",
40
40
  "@opentelemetry/sdk-trace-node": "^2.7.1",
41
- "@monocle.sh/otel-utils": "1.6.0"
41
+ "@monocle.sh/otel-utils": "1.8.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@adonisjs/tsconfig": "^2.0.0",