Skip to content

Commit

Permalink
chore(logs): add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fuaiyi committed Nov 28, 2022
1 parent 1747ec2 commit e05048d
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 14 deletions.
3 changes: 2 additions & 1 deletion experimental/packages/api-logs/test/api/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

import * as assert from "assert";

import { Logger, logs } from "../../src";
import type { Logger } from "../../src";
import { logs } from "../../src";
import { NoopLogger } from "../../src/NoopLogger";
import { NoopLoggerProvider } from "../../src/NoopLoggerProvider";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
* limitations under the License.
*/

import type { OTLPExporterConfigBase } from '@opentelemetry/otlp-exporter-base';
import { getEnv } from "@opentelemetry/core";
import {
appendResourcePathToUrl,
appendRootPathToUrlIfNeeded,
OTLPExporterConfigBase,
} from "@opentelemetry/otlp-exporter-base";
import { appendResourcePathToUrl, appendRootPathToUrlIfNeeded } from "@opentelemetry/otlp-exporter-base";

const DEFAULT_COLLECTOR_RESOURCE_PATH = "v1/logs";
export const DEFAULT_COLLECTOR_URL = `http://localhost:4318/${DEFAULT_COLLECTOR_RESOURCE_PATH}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import type { ReadableLogRecord } from "@opentelemetry/sdk-logs";
import { hrTimeToNanoseconds } from "@opentelemetry/core";

import type { IResource } from "../resource/types";
import type { IScopeLogs, ILogRecord, IResourceLogs } from "./types";
import { toAnyValue, toAttributes } from "../common/internal";

import type { IScopeLogs, ILogRecord, IResourceLogs } from "./types";

type ResourceMapValue = Map<string, ReadableLogRecord[]>;

Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/sdk-logs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/sdk-logs
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fmetrics.svg
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Flogs.svg
1 change: 1 addition & 0 deletions experimental/packages/sdk-logs/src/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class Logger implements logsAPI.Logger {
this._loggerSharedState = config.loggerSharedState;
this._instrumentationScope = config.instrumentationScope;
}

/**
* Get a new {@link LogRecord} instance
*
Expand Down
5 changes: 2 additions & 3 deletions experimental/packages/sdk-logs/src/LoggerProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ export class LoggerProvider implements logsAPI.LoggerProvider {
}

/**
* Notifies all registered LogRecordProcessor to flush any buffered data.
*
* Returns a promise which is resolved when all flushes are complete.
* Notifies all registered {@link LogRecordProcessor} to flush any buffered data.
* @returns Returns a promise which is resolved when all flushes are complete.
*/
public forceFlush(): Promise<void> {
if (this._shutdownOnceFeature.isCalled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class SimpleLogRecordProcessor implements LogRecordProcessor {
}

public forceFlush(): Promise<void> {
// do nothing as all spans are being exported without waiting
// do nothing as all logs are being exported without waiting
return Promise.resolve();
}

Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/sdk-logs/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import type { LogRecordOptions } from "@opentelemetry/api-logs";
import type { LoggerSharedState } from "./LoggerSharedState";

export interface LoggerProviderConfig {
/** Resource associated with trace telemetry */
/** Resource associated with log telemetry */
resource?: Resource;

/** Log Record Limits*/
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/sdk-logs/test/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const validAttributes = {
export const invalidAttributes = {
// invalid attribute type object
object: { foo: "bar" },
// invalid attribute inhomogenous array
// invalid attribute inhomogeneous array
"non-homogeneous-array": [0, ""],
// This empty length attribute should not be set
"": "empty-key",
Expand Down

0 comments on commit e05048d

Please sign in to comment.