Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop exporting/using namespaces for string constants such as Semantic conventions and export individual strings. Stop using namespaces #4185

Closed
MSNev opened this issue Oct 4, 2023 · 3 comments
Assignees
Labels
never-stale triage:accepted This feature has been accepted

Comments

@MSNev
Copy link
Contributor

MSNev commented Oct 4, 2023

One significant minification issues is that for "common" strings such as the SemanticConventions if any single string is "used" then all of the members of the related SemanticConvension namespace also get included in the final bundle.

The suggestion here is to

  • export each "string" independently (as well as to continue to export as a single names (for backward compatability))
  • Ban the usage of the "namespace" within the OpenTelemetry packages and only use the individual exported strings (reducing the bundle size for individual components)

Example of change

Change from

// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates//templates/SemanticAttributes.ts.j2
export const SemanticAttributes = {
  /**
   * The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable).
   *
   * Note: This may be different from `faas.id` if an alias is involved.
   */
  AWS_LAMBDA_INVOKED_ARN: 'aws.lambda.invoked_arn',

  /**
   * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers.
   */
  DB_SYSTEM: 'db.system',

  ...
}

to

/**
 * The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable).
 *
 * Note: This may be different from `faas.id` if an alias is involved.
 */
export const SEMCONV_AWS_LAMBDA_INVOKED_ARN = 'aws.lambda.invoked_arn';

/**
 * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers.
 */
export const SEMCONV_DB_SYSTEM = 'db.system';

// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates//templates/SemanticAttributes.ts.j2
export const SemanticAttributes = {
  /**
   * The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable).
   *
   * Note: This may be different from `faas.id` if an alias is involved.
   */
  AWS_LAMBDA_INVOKED_ARN: SEMCONV_AWS_LAMBDA_INVOKED_ARN',

  /**
   * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers.
   */
  DB_SYSTEM: SEMCONV_DB_SYSTEM,

  /**
}

And then internal usages would only reference the SEMCONV_ constants

I'm not married to the SEMCONV_ prefix (and a prefix is not actually required), I just included here to avoid confusion and to make it easier to call out the differences.

@MSNev MSNev added this to the OpenTelemetry SDK 2.0 milestone Oct 4, 2023
@MSNev
Copy link
Contributor Author

MSNev commented Oct 4, 2023

And yes, as this is an autogenerated file this would be a tooling update, and assuming that we continue to export a Namespaced version (the objects with the strings) this is actually backward compatible.

@MSNev MSNev changed the title Update Semantic conventions to export individual strings and stop using namespaces within the OTel packages Stop exporting/using namespaces for string constants such as Semantic conventions and export individual strings. Stop using namespaces Oct 4, 2023
@MSNev MSNev added the triage label Oct 4, 2023
@dyladan dyladan added triage:accepted This feature has been accepted and removed triage labels Oct 18, 2023
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the stale label Dec 25, 2023
@dyladan dyladan added never-stale and removed stale labels Jan 3, 2024
@dyladan
Copy link
Member

dyladan commented Aug 7, 2024

This is done

@dyladan dyladan closed this as completed Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
never-stale triage:accepted This feature has been accepted
Projects
None yet
Development

No branches or pull requests

2 participants