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

Update utils.ts #906

Merged
merged 2 commits into from
May 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 81 additions & 29 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
};

export function assertNoExtraneousProperties(
obj: Record<string, any>,

Check warning on line 157 in src/utils.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
expectedProps: string[]
) {
const keys = new Set(Object.keys(obj));
Expand Down Expand Up @@ -206,11 +206,11 @@
return DiagLogLevel.NONE;
}

export function pick<T extends Record<string, any>, K extends string>(

Check warning on line 209 in src/utils.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
obj: T,
keys: readonly K[]
): { [P in keyof T as P extends K ? P : never]: T[P] } {
const result = {} as any;

Check warning on line 213 in src/utils.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
if (key in obj) {
Expand All @@ -222,15 +222,9 @@

export function listEnvVars() {
return [
{
name: 'OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT',
description: 'Maximum allowed attribute value size',
default: '12000',
type: 'number',
category: 'instrumentation',
},
{
name: 'OTEL_BSP_SCHEDULE_DELAY',
property: '',
description:
'The delay in milliseconds between 2 consecutive bath span processor exports.',
default: '500',
Expand All @@ -239,6 +233,7 @@
},
{
name: 'OTEL_EXPORTER_OTLP_CERTIFICATE',
property: '',
description:
"Path to a certificate to use when verifying a server's TLS credentials.",
default: '',
Expand All @@ -247,6 +242,7 @@
},
{
name: 'OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE',
property: '',
description:
"Path to a certificate to use when verifying a client's TLS credentials.",
default: '',
Expand All @@ -255,6 +251,7 @@
},
{
name: 'OTEL_EXPORTER_OTLP_CLIENT_KEY',
property: '',
description:
"Path to client's private key to use in mTLS communication in PEM format.",
default: '',
Expand All @@ -263,13 +260,15 @@
},
{
name: 'OTEL_EXPORTER_OTLP_ENDPOINT',
property: 'endpoint',
description: 'The OTLP endpoint to export to.',
default: 'http://localhost:4317',
type: 'string',
category: 'exporter',
},
{
name: 'OTEL_EXPORTER_OTLP_TRACES_PROTOCOL',
property: '',
description:
'Chooses the trace exporter protocol. Allowed values are grpc and http/protobuf',
default: 'grpc',
Expand All @@ -278,6 +277,7 @@
},
{
name: 'OTEL_EXPORTER_OTLP_METRICS_PROTOCOL',
property: 'metrics.metricReaderFactory',
description:
'Chooses the metric exporter protocol. Allowed values are grpc and http/protobuf',
default: 'grpc',
Expand All @@ -286,44 +286,68 @@
},
{
name: 'OTEL_EXPORTER_OTLP_PROTOCOL',
property: '',
description: 'The protocol to use for OTLP exports.',
default: 'grpc',
type: 'string',
category: 'exporter',
},
{
name: 'OTEL_EXPORTER_OTLP_TRACES_ENDPOINT',
property: '',
description: 'The traces OTLP endpoint to export to.',
default: 'http://localhost:4317',
type: 'string',
category: 'exporter',
},
{
name: 'OTEL_INSTRUMENTATION_COMMON_DEFAULT_ENABLED',
property: '',
description:
'Whether to activate all the embedded instrumentations. When you set this setting to false, use OTEL_INSTRUMENTATION_<NAME>_ENABLED=true to selectively turn on instrumentations.',
default: 'true',
type: 'boolean',
category: 'instrumentation',
},
{
name: 'OTEL_INSTRUMENTATION_<NAME>_ENABLED',
property: '',
description:
'When set to true, this setting activates a specific instrumentation, as defined by replacing <NAME> with the name of the instrumentation. The name is not case sensitive.',
default: 'true',
type: 'boolean',
category: 'instrumentation',
},
{
name: 'OTEL_LOG_LEVEL',
property: 'logLevel',
description:
'Log level for the OpenTelemetry diagnostic console logger. To activate debug logging, set the debug value. Available values are error, info, debug, and verbose.',
default: 'none',
type: 'string',
category: 'general',
},
{
name: 'OTEL_EXPORTER_OTLP_METRICS_ENDPOINT',
property: 'metrics.endpoint',
description:
'The metrics endpoint. Takes precedence over the value set in OTEL_EXPORTER_OTLP_ENDPOINT.',
default: 'https://ingest.<realm>.signalfx.com/v2/datapoint/otlp',
type: 'number',
category: 'metrics',
},
{
name: 'OTEL_METRIC_EXPORT_INTERVAL',
property: 'metrics.exportIntervalMillis',
description:
'The interval, in milliseconds, of metrics collection and exporting.',
default: '30000',
type: 'number',
category: 'exporter',
category: 'metrics',
},
{
name: 'OTEL_METRICS_EXPORTER',
property: 'metrics.metricReaderFactory',
description:
'Comma-separated list of metrics exporter to use. To output to the console, set the variable to console. If set to none, metric exports are turned off.',
default: 'otlp',
Expand All @@ -332,28 +356,24 @@
},
{
name: 'OTEL_PROPAGATORS',
property: 'tracing.propagators',
description: 'Comma-separated list of propagators you want to use.',
default: 'tracecontext,baggage',
type: 'string',
category: 'general',
category: 'propagator',
},
{
name: 'OTEL_SERVICE_NAME',
property: 'serviceName',
description:
'Name of the service or application you’re instrumenting. Takes precedence over the service name defined in the OTEL_RESOURCE_ATTRIBUTES variable.',
default: 'unnamed-node-service',
type: 'string',
category: 'general',
},
{
name: 'OTEL_SPAN_LINK_COUNT_LIMIT',
description: 'Maximum number of links per span.',
default: '1000',
type: 'number',
category: 'general',
},
{
name: 'OTEL_TRACES_EXPORTER',
property: 'tracing.spanExporterFactory',
description:
'Comma-separated list of trace exporters to use. To output to the console, set the variable to console.',
default: 'otlp',
Expand All @@ -362,6 +382,7 @@
},
{
name: 'SPLUNK_ACCESS_TOKEN',
property: 'accessToken',
description:
'A Splunk authentication token that lets exporters send data directly to Splunk Observability Cloud. Required if you need to send data to the Splunk Observability Cloud ingest endpoint.',
default: '',
Expand All @@ -370,58 +391,66 @@
},
{
name: 'SPLUNK_INSTRUMENTATION_METRICS_ENABLED',
property: '',
description:
'Emit metrics from instrumentation (e.g. http.server.duration)',
'Emit metrics from instrumentation (for example, http.server.duration)',
default: 'false',
type: 'boolean',
category: 'instrumentation',
},
{
name: 'SPLUNK_METRICS_ENABLED',
property: 'Activated by calling start()',
description: 'Activates metrics collection.',
default: 'false',
type: 'boolean',
category: 'general',
category: 'metrics',
},
{
name: 'SPLUNK_METRICS_ENDPOINT',
property: 'metrics.endpoint',
description:
'The metrics endpoint. Takes precedence over OTEL_EXPORTER_OTLP_METRICS_ENDPOINT. When SPLUNK_REALM is used, the default value is https://ingest.<realm>.signalfx.com/v2/datapoint/otlp.',
default: '',
type: 'string',
category: 'general',
},
{
name: 'SPLUNK_PROFILER_CALL_STACK_INTERVAL',
description:
'Frequency with which call stacks are sampled, in milliseconds.',
default: '1000',
type: 'number',
category: 'profiler',
category: 'metrics',
},
{
name: 'SPLUNK_PROFILER_ENABLED',
property: 'profilingEnabled',
description: 'Activates AlwaysOn CPU profiling.',
default: 'false',
type: 'boolean',
category: 'profiler',
},
{
name: 'SPLUNK_PROFILER_LOGS_ENDPOINT',
property: 'profiling.endpoint',
description: 'The collector endpoint for profiler logs.',
default: 'http://localhost:4317',
type: 'string',
category: 'profiler',
},
{
name: 'SPLUNK_PROFILER_MEMORY_ENABLED',
property: 'profiling.memoryProfilingEnabled',
description: 'Activates memory profiling for AlwaysOn Profiling.',
default: 'false',
type: 'string',
category: 'profiler',
},
{
name: 'SPLUNK_PROFILER_CALL_STACK_INTERVAL',
property: 'profiling.callstackInterval',
description:
'Frequency with which call stacks are sampled, in milliseconds.',
default: '1000',
type: 'number',
category: 'profiler',
},
{
name: 'SPLUNK_REALM',
property: 'realm',
description:
'The name of your organization’s realm, for example, us0. When you set the realm, telemetry is sent directly to the ingest endpoint of Splunk Observability Cloud, bypassing the Splunk Distribution of OpenTelemetry Collector.',
default: '',
Expand All @@ -430,30 +459,52 @@
},
{
name: 'SPLUNK_REDIS_INCLUDE_COMMAND_ARGS',
property: '',
description:
'Whether to include the full Redis query in db.statement span attributes when using the Redis instrumentation.',
default: 'false',
type: 'boolean',
category: 'instrumentation',
},
{
name: 'SPLUNK_GRAPHQL_RESOLVE_SPANS_ENABLED',
property: '',
description:
'Starting from version 2.7.0 of the instrumentation, GraphQL spans for resolvers are no longer generated. To collect resolve spans, set this environment variable to true. The default value is false.',
default: 'false',
type: 'boolean',
category: 'instrumentation',
},
{
name: 'SPLUNK_RUNTIME_METRICS_COLLECTION_INTERVAL',
property: 'metrics.runtimeMetricsCollectionIntervalMillis',
description:
'The interval, in milliseconds, during which GC and event loop statistics are collected.',
default: '5000',
type: 'number',
category: 'instrumentation',
category: 'metrics',
},
{
name: 'SPLUNK_RUNTIME_METRICS_ENABLED',
property: 'metrics.runtimeMetricsEnabled',
description:
'Activates the collection and export of runtime metrics. Runtime metrics are only sent if the SPLUNK_METRICS_ENABLED environment variable is set to true or if memory profiling is activated.',
default: 'true',
type: 'boolean',
category: 'instrumentation',
category: 'metrics',
},
{
name: 'SPLUNK_DEBUG_METRICS_ENABLED',
property: 'metrics.debugMetricsEnabled',
description:
'Activates the collection and export of internal debug metrics for troubleshooting. Debug metrics are only sent if the SPLUNK_METRICS_ENABLED environment variable is set to true.',
default: 'true',
type: 'boolean',
category: 'metrics',
},
{
name: 'SPLUNK_TRACE_RESPONSE_HEADER_ENABLED',
property: 'tracing.serverTimingEnabled',
description:
'Activates the addition of server trace information to HTTP response headers.',
default: 'true',
Expand All @@ -462,6 +513,7 @@
},
{
name: 'SPLUNK_TRACING_ENABLED',
property: '',
description: 'Enables tracing.',
default: 'true',
type: 'boolean',
Expand Down
Loading