Skip to content

Inconsistent API design in logs client #1863

Description

@golergka

Describe the bug

Methods fetchLogs and aggregateLogs` have inconsistent API, affecting DX

Label the issue properly.

  • Add severity/ label.

To Reproduce

Steps to reproduce the behavior:

  1. Use log client to get and aggregate logs with the same parameters

Expected behavior

I expect to use a consistent API and re-use the same filter objects.

Actual behavior

Log client's fetchLogs and aggregateLogs have similar functionality, but different types for the same filters. Here's a snippet of my code:

  fetchLogs() {
    return this.logsClient.listLogsGet({
      filterFrom: this.filterFrom,
      pageLimit: this.limit,
      filterQuery: this.queryParts.join(" "),
    });
  }

  aggregateLogs() {
    return this.logsClient.aggregateLogs({
      body: {
        filter: {
          // Why not did Datadog API authors just reuse the same filter type
          // in list and aggregate endpoints? No idea.
          from: this.filterFrom?.toISOString(),
          query: this.queryParts.join(" "),
        },
      },
    });
  }

Environment and Versions (please complete the following information):

Library version 1.15.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions