@uoa/lambda-tracing 2.0.0-beta.0 → 2.0.0-beta.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uoa/lambda-tracing",
3
- "version": "2.0.0-beta.0",
3
+ "version": "2.0.0-beta.1",
4
4
  "description": "Library for logging & distributed tracing in UoA Lambda projects",
5
5
  "repository": {
6
6
  "type": "git",
package/tracing.ts CHANGED
@@ -5,7 +5,6 @@ import {B3_INFO_KEY, UoaB3Propagator} from "./UoaB3Propagator";
5
5
  import {context} from "@opentelemetry/api";
6
6
  import {AlwaysOnSampler} from "@opentelemetry/sdk-trace-base";
7
7
  import {ZipkinExporter} from "./zipkin/zipkin";
8
- import {SemanticResourceAttributes} from "@opentelemetry/semantic-conventions";
9
8
 
10
9
  const provider = new NodeTracerProvider({sampler: new AlwaysOnSampler()});
11
10
  let infoHeader: string | undefined;
@@ -26,7 +25,6 @@ export function initializeTracing(serviceName: string) {
26
25
  new AwsLambdaInstrumentation({
27
26
  requestHook: (span, { event, context }) => {
28
27
  span.setAttribute('faas.name', context.functionName);
29
- span.setAttribute(SemanticResourceAttributes.SERVICE_NAME, serviceName);
30
28
  infoHeader = undefined; //reset header value in case lambda execution environment maintained since last invocation
31
29
  },
32
30
  responseHook: (span, { err, res }) => {
package/zipkin/zipkin.ts CHANGED
@@ -16,6 +16,8 @@
16
16
 
17
17
  /**
18
18
  * Copied from https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-exporter-zipkin/src/zipkin.ts
19
+ *
20
+ * Modified to prioritise input serviceName over SemanticResourceAttributes.SERVICE_NAME
19
21
  */
20
22
 
21
23
  import { diag } from '@opentelemetry/api';
@@ -137,9 +139,9 @@ export class ZipkinExporter implements SpanExporter {
137
139
  toZipkinSpan(
138
140
  span,
139
141
  String(
142
+ serviceName ||
140
143
  span.attributes[SemanticResourceAttributes.SERVICE_NAME] ||
141
- span.resource.attributes[SemanticResourceAttributes.SERVICE_NAME] ||
142
- serviceName
144
+ span.resource.attributes[SemanticResourceAttributes.SERVICE_NAME]
143
145
  ),
144
146
  this._statusCodeTagName,
145
147
  this._statusDescriptionTagName