Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Pretty difficult to use

Aberta
#1,795 2 comentários 2 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 2 dias

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
20/100
Tipo de issue
Bug
Clareza
Precisa de esclarecimento
Status de atividade
Estagnada
Stack de tecnologia
python
Domínio
api

Direção de pesquisa

Comece pelos pontos de entrada de SyntheticsApi mencionados no relatório—list_tests, get_api_test, patch_test e update_api_test—e reproduza o comportamento da versão 2.19.0, incluindo o erro de validação. Inspecione também o comportamento de repr() para Monitor e seu campo type. A issue precisa ser delimitada em bugs acionáveis, com comportamento esperado e testes separados, antes que a implementação possa ser considerada concluída.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

kind/bug stale

Describe the bug
This API is just not great.

I needed to write a script to just find & replace one Slack channel that was our notifications on monitors to another. This was … difficult.

I'm going to summarize a number of usability issues here; filing a bug for each would be onerous.

  • SyntheticsApi includes both a patch_test, and an update_api_test. I have absolutely no idea what the difference between "patch" and "update" is, and the docs don't tell me.

  • AFAICT, SyntheticsApi.patch_test (as documented here) is a lie? I have the latest version of the library, and AFAICT, that, and the associated types, just don't exist.

  • If you SyntheticsApi.list_tests, you get, essentially, a list of SyntheticsTestDetails. (It is wrapped by a pointless wrapper object, but that's whatever.) However, update_api_test requires a SyntheticsAPITest, so you can't pass the result to it!

  • If you call get_api_test, however, you'll get the right type: a SyntheticsAPITest! But attempting to then call update_api_test with that results in a runtime error:

    HTTP response body: {'errors': ["Additional properties are not allowed ('modified_at', 'creator', 'monitor_id', 'created_at' were unexpected)"]}
    

    I attempted a number of things to attempt to remove those properties form the object, but none of which worked. … the entire point of a type system is that if you function declares itself to take a Foo, then you should be able to pass it instances of Foo. If you can't, you have foo instances that aren't really Foo.

  • #1794, which was severe enough that I have split it out to a separate bug.

  • authn issues appear to return 403, which sent me down the wrong paths for a bit.

  • Many of the types in the library, when repr'd, do not emit faithful reprs. For example, if you repr a monitor, you'll get,

    …
     'type': 'synthetics alert'}
    

    This led to me writing bugs such as,

    monitor['type'] == 'synthetics alert'
    

    Which is False (!) for the above. That's because the value for 'type' there is not truly a string, it's a MonitorType. The repr here is just … lying.

    Python's has built-in support for enumerations in the form of the enum module, and it won't do stuff like this that will leave one pulling out one's hair mid debugging session.

    (Even the outer type there appears to be a dict when repr()'d … but its not.)

Environment and Versions (please complete the following information):
A clear and precise description of your setup:

  • version for this project in use: 2.19.0 (latest, as of the time of writing)

Additional context
As you might be able to tell from the above, most of my frustration was around the synthetics portion. I was actually successful at updating non-synthetics monitors — except for running into errors with monitors that were actually synthetics (another Liskov substitutability violation, really), and then attempting to update those with SyntheticsApi. I eventually gave up, and just did it by hand … we don't have that many synthetics.

Linguagem predominante
Python
Estrelas
167
Forks
55
Merge médio
3d 17h
PRs com merge (30d)
80

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de DataDog/datadog-api-client-python

Todas as issues de DataDog/datadog-api-client-python

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.